starkinfra 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +2 -5
  3. data/lib/cardmethod/cardmethod.rb +2 -2
  4. data/lib/creditholmes/creditholmes.rb +8 -11
  5. data/lib/creditnote/creditnote.rb +10 -11
  6. data/lib/creditnote/invoice/description.rb +3 -5
  7. data/lib/creditnote/invoice/discount.rb +3 -4
  8. data/lib/creditnote/invoice/invoice.rb +5 -6
  9. data/lib/creditnote/log.rb +8 -9
  10. data/lib/creditnote/transfer.rb +4 -5
  11. data/lib/creditpreview/creditnotepreview.rb +2 -3
  12. data/lib/creditpreview/creditpreview.rb +3 -4
  13. data/lib/creditsigner/creditsigner.rb +3 -6
  14. data/lib/dynamicbrcode/dynamicbrcode.rb +17 -19
  15. data/lib/error.rb +7 -40
  16. data/lib/event/attempt.rb +7 -8
  17. data/lib/event/event.rb +8 -11
  18. data/lib/individualdocument/individualdocument.rb +7 -8
  19. data/lib/individualdocument/log.rb +8 -9
  20. data/lib/individualidentity/individualidentity.rb +7 -8
  21. data/lib/individualidentity/log.rb +8 -9
  22. data/lib/issuingbalance/issuingbalance.rb +2 -3
  23. data/lib/issuingcard/issuingcard.rb +9 -10
  24. data/lib/issuingcard/log.rb +8 -9
  25. data/lib/issuingdesign/issuingdesign.rb +5 -6
  26. data/lib/issuingembossingkit/issuingembossingkit.rb +4 -5
  27. data/lib/issuingembossingrequest/issuingembossingrequest.rb +8 -9
  28. data/lib/issuingembossingrequest/log.rb +8 -9
  29. data/lib/issuingholder/issuingholder.rb +9 -10
  30. data/lib/issuingholder/log.rb +8 -9
  31. data/lib/issuinginvoice/issuinginvoice.rb +8 -9
  32. data/lib/issuinginvoice/log.rb +8 -9
  33. data/lib/issuingproduct/issuingproduct.rb +3 -4
  34. data/lib/issuingpurchase/issuingpurchase.rb +32 -24
  35. data/lib/issuingpurchase/log.rb +8 -9
  36. data/lib/issuingrestock/issuingrestock.rb +8 -9
  37. data/lib/issuingrestock/log.rb +8 -9
  38. data/lib/issuingrule/issuingrule.rb +6 -7
  39. data/lib/issuingstock/issuingstock.rb +8 -9
  40. data/lib/issuingstock/log.rb +8 -9
  41. data/lib/issuingtransaction/issuingtransaction.rb +7 -8
  42. data/lib/issuingwithdrawal/issuingwithdrawal.rb +8 -9
  43. data/lib/merchantcategory/merchantcategory.rb +2 -2
  44. data/lib/merchantcountry/merchantcountry.rb +2 -2
  45. data/lib/pixbalance/pixbalance.rb +2 -3
  46. data/lib/pixchargeback/log.rb +8 -9
  47. data/lib/pixchargeback/pixchargeback.rb +8 -9
  48. data/lib/pixclaim/log.rb +8 -9
  49. data/lib/pixclaim/pixclaim.rb +8 -9
  50. data/lib/pixdirector/pixdirector.rb +2 -2
  51. data/lib/pixdomain/certificate.rb +2 -2
  52. data/lib/pixdomain/pixdomain.rb +3 -3
  53. data/lib/pixinfraction/log.rb +8 -9
  54. data/lib/pixinfraction/pixinfraction.rb +8 -9
  55. data/lib/pixkey/log.rb +8 -9
  56. data/lib/pixkey/pixkey.rb +8 -9
  57. data/lib/pixrequest/log.rb +8 -9
  58. data/lib/pixrequest/pixrequest.rb +9 -10
  59. data/lib/pixreversal/log.rb +7 -9
  60. data/lib/pixreversal/pixreversal.rb +9 -10
  61. data/lib/pixstatement/pixstatement.rb +6 -7
  62. data/lib/request/request.rb +152 -0
  63. data/lib/starkinfra.rb +14 -6
  64. data/lib/staticbrcode/staticbrcode.rb +8 -9
  65. data/lib/utils/parse.rb +23 -42
  66. data/lib/utils/rest.rb +211 -110
  67. data/lib/webhook/webhook.rb +2 -3
  68. metadata +6 -21
  69. data/lib/key.rb +0 -33
  70. data/lib/user/organization.rb +0 -54
  71. data/lib/user/project.rb +0 -37
  72. data/lib/user/user.rb +0 -20
  73. data/lib/utils/api.rb +0 -89
  74. data/lib/utils/bacenid.rb +0 -19
  75. data/lib/utils/cache.rb +0 -10
  76. data/lib/utils/case.rb +0 -21
  77. data/lib/utils/checks.rb +0 -100
  78. data/lib/utils/endtoendid.rb +0 -11
  79. data/lib/utils/environment.rb +0 -14
  80. data/lib/utils/request.rb +0 -79
  81. data/lib/utils/resource.rb +0 -13
  82. data/lib/utils/returnid.rb +0 -11
  83. data/lib/utils/sub_resource.rb +0 -27
  84. data/lib/utils/url.rb +0 -28
data/lib/event/attempt.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('event')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class Event
@@ -19,7 +18,7 @@ module StarkInfra
19
18
  # - event_id [string]: ID of the Event whose delivery failed. ex: '4848484848484848'
20
19
  # - webhook_id [string]: ID of the Webhook that triggered this event. ex: '5656565656565656'
21
20
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
22
- class Attempt < StarkInfra::Utils::Resource
21
+ class Attempt < StarkCore::Utils::Resource
23
22
  attr_reader :id, :code, :message, :event_id, :webhook_id, :created
24
23
  def initialize(id:, code:, message:, event_id:, webhook_id:, created:)
25
24
  super(id)
@@ -27,7 +26,7 @@ module StarkInfra
27
26
  @message = message
28
27
  @event_id = event_id
29
28
  @webhook_id = webhook_id
30
- @created = StarkInfra::Utils::Checks.check_datetime(created)
29
+ @created = StarkCore::Utils::Checks.check_datetime(created)
31
30
  end
32
31
 
33
32
  # # Retrieve a specific Event::Attempt
@@ -61,8 +60,8 @@ module StarkInfra
61
60
  # ## Return:
62
61
  # - generator of Event::Attempt objects with updated attributes
63
62
  def self.query(limit: nil, after: nil, before: nil, event_ids: nil, webhook_ids: nil, user: nil)
64
- after = StarkInfra::Utils::Checks.check_date(after)
65
- before = StarkInfra::Utils::Checks.check_date(before)
63
+ after = StarkCore::Utils::Checks.check_date(after)
64
+ before = StarkCore::Utils::Checks.check_date(before)
66
65
  StarkInfra::Utils::Rest.get_stream(
67
66
  limit: limit,
68
67
  after: after,
@@ -92,8 +91,8 @@ module StarkInfra
92
91
  # - list of Event::Attempt objects with updated attributes
93
92
  # - cursor to retrieve the next page of Attempt objects
94
93
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, event_ids: nil, webhook_ids: nil, user: nil)
95
- after = StarkInfra::Utils::Checks.check_date(after)
96
- before = StarkInfra::Utils::Checks.check_date(before)
94
+ after = StarkCore::Utils::Checks.check_date(after)
95
+ before = StarkCore::Utils::Checks.check_date(before)
97
96
 
98
97
  StarkInfra::Utils::Rest.get_page(
99
98
  cursor: cursor,
data/lib/event/event.rb CHANGED
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require('json')
4
- require('starkbank-ecdsa')
4
+ require('starkcore')
5
5
  require_relative('../error')
6
6
  require_relative('../utils/rest')
7
7
  require_relative('../utils/parse')
8
- require_relative('../utils/cache')
9
- require_relative('../utils/checks')
10
- require_relative('../utils/resource')
11
8
  require_relative('../pixrequest/log')
12
9
  require_relative('../pixreversal/log')
13
10
 
@@ -25,11 +22,11 @@ module StarkInfra
25
22
  # - is_delivered [bool]: true if the event has been successfully delivered to the user url. ex: False
26
23
  # - workspace_id [string]: ID of the Workspace that generated this event. Mostly used when multiple Workspaces have Webhooks registered to the same endpoint. ex: '4545454545454545'
27
24
  # - subscription [string]: service that triggered this event. ex: 'pix-request.in', 'pix-request.out'
28
- class Event < StarkInfra::Utils::Resource
25
+ class Event < StarkCore::Utils::Resource
29
26
  attr_reader :id, :log, :created, :is_delivered, :workspace_id, :subscription
30
27
  def initialize(id:, log:, created:, is_delivered:, workspace_id:, subscription:)
31
28
  super(id)
32
- @created = StarkInfra::Utils::Checks.check_datetime(created)
29
+ @created = StarkCore::Utils::Checks.check_datetime(created)
33
30
  @is_delivered = is_delivered
34
31
  @workspace_id = workspace_id
35
32
  @subscription = subscription
@@ -50,7 +47,7 @@ module StarkInfra
50
47
  }[subscription.to_sym]
51
48
 
52
49
  @log = log
53
- @log = StarkInfra::Utils::API.from_api_json(resource[:resource_maker], log) unless resource.nil?
50
+ @log = StarkCore::Utils::API.from_api_json(resource[:resource_maker], log) unless resource.nil?
54
51
  end
55
52
 
56
53
  # # Retrieve a specific notification Event
@@ -83,8 +80,8 @@ module StarkInfra
83
80
  # ## Return:
84
81
  # - generator of Event objects with updated attributes
85
82
  def self.query(limit: nil, after: nil, before: nil, is_delivered: nil, user: nil)
86
- after = StarkInfra::Utils::Checks.check_date(after)
87
- before = StarkInfra::Utils::Checks.check_date(before)
83
+ after = StarkCore::Utils::Checks.check_date(after)
84
+ before = StarkCore::Utils::Checks.check_date(before)
88
85
  StarkInfra::Utils::Rest.get_stream(
89
86
  user: user,
90
87
  limit: limit,
@@ -112,8 +109,8 @@ module StarkInfra
112
109
  # - list of Event objects with updated attributes
113
110
  # - cursor to retrieve the next page of Event objects
114
111
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, is_delivered: nil, user: nil)
115
- after = StarkInfra::Utils::Checks.check_date(after)
116
- before = StarkInfra::Utils::Checks.check_date(before)
112
+ after = StarkCore::Utils::Checks.check_date(after)
113
+ before = StarkCore::Utils::Checks.check_date(before)
117
114
  StarkInfra::Utils::Rest.get_page(
118
115
  cursor: cursor,
119
116
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
5
  require_relative('../utils/parse')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  # # IndividualDocument object
@@ -29,7 +28,7 @@ module StarkInfra
29
28
  # - id [string]: unique id returned when the IndividualDocument is created. ex: "5656565656565656"
30
29
  # - status [string]: current status of the IndividualDocument. Options: "created", "canceled", "processing", "failed", "success"
31
30
  # - created [DateTime]: creation datetime for the IndividualDocument. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
32
- class IndividualDocument < StarkInfra::Utils::Resource
31
+ class IndividualDocument < StarkCore::Utils::Resource
33
32
  attr_reader :type, :content, :content_type, :identity_id, :tags, :id, :status, :created
34
33
  def initialize(type:, content:, content_type:, identity_id:, tags: nil, id: nil, status: nil, created: nil)
35
34
  super(id)
@@ -37,7 +36,7 @@ module StarkInfra
37
36
  @identity_id = identity_id
38
37
  @tags = tags
39
38
  @status = status
40
- @created = StarkInfra::Utils::Checks.check_datetime(created)
39
+ @created = StarkCore::Utils::Checks.check_datetime(created)
41
40
  @content = content
42
41
  @content_type = content_type
43
42
 
@@ -95,8 +94,8 @@ module StarkInfra
95
94
  # ## Return:
96
95
  # - generator of IndividualDocument objects with updated attributes
97
96
  def self.query(limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
98
- after = StarkInfra::Utils::Checks.check_date(after)
99
- before = StarkInfra::Utils::Checks.check_date(before)
97
+ after = StarkCore::Utils::Checks.check_date(after)
98
+ before = StarkCore::Utils::Checks.check_date(before)
100
99
  StarkInfra::Utils::Rest.get_stream(
101
100
  limit: limit,
102
101
  after: after,
@@ -128,8 +127,8 @@ module StarkInfra
128
127
  # - list of IndividualDocument objects with updated attributes
129
128
  # - cursor to retrieve the next page of IndividualDocument objects
130
129
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
131
- after = StarkInfra::Utils::Checks.check_date(after)
132
- before = StarkInfra::Utils::Checks.check_date(before)
130
+ after = StarkCore::Utils::Checks.check_date(after)
131
+ before = StarkCore::Utils::Checks.check_date(before)
133
132
  StarkInfra::Utils::Rest.get_page(
134
133
  cursor: cursor,
135
134
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
5
  require_relative('IndividualDocument')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IndividualDocument
@@ -18,14 +17,14 @@ module StarkInfra
18
17
  # - errors [list of strings]: list of errors linked to this IndividualDocument event
19
18
  # - type [string]: type of the IndividualDocument event which triggered the log creation. ex: 'approved', 'canceled', 'confirmed', 'denied', 'reversed', 'voided'.
20
19
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
21
- class Log < StarkInfra::Utils::Resource
20
+ class Log < StarkCore::Utils::Resource
22
21
  attr_reader :id, :document, :errors, :type, :created
23
22
  def initialize(id: nil, document: nil, errors: nil, type: nil, created: nil)
24
23
  super(id)
25
24
  @document = document
26
25
  @errors = errors
27
26
  @type = type
28
- @created = StarkInfra::Utils::Checks.check_datetime(created)
27
+ @created = StarkCore::Utils::Checks.check_datetime(created)
29
28
  end
30
29
 
31
30
  # # Retrieve a specific IndividualDocument::Log
@@ -59,8 +58,8 @@ module StarkInfra
59
58
  # ## Return:
60
59
  # - generator of IndividualDocument::Log objects with updated attributes
61
60
  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, document_ids: nil, user: nil)
62
- after = StarkInfra::Utils::Checks.check_date(after)
63
- before = StarkInfra::Utils::Checks.check_date(before)
61
+ after = StarkCore::Utils::Checks.check_date(after)
62
+ before = StarkCore::Utils::Checks.check_date(before)
64
63
  StarkInfra::Utils::Rest.get_stream(
65
64
  ids: ids,
66
65
  limit: limit,
@@ -91,8 +90,8 @@ module StarkInfra
91
90
  # - list of IndividualDocument::Log objects with updated attributes
92
91
  # - cursor to retrieve the next page of Log objects
93
92
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, document_ids: nil, user: nil)
94
- after = StarkInfra::Utils::Checks.check_date(after)
95
- before = StarkInfra::Utils::Checks.check_date(before)
93
+ after = StarkCore::Utils::Checks.check_date(after)
94
+ before = StarkCore::Utils::Checks.check_date(before)
96
95
  StarkInfra::Utils::Rest.get_page(
97
96
  cursor: cursor,
98
97
  limit: limit,
@@ -112,7 +111,7 @@ module StarkInfra
112
111
  resource_maker: proc { |json|
113
112
  Log.new(
114
113
  id: json['id'],
115
- document: StarkInfra::Utils::API.from_api_json(request_maker, json['document']),
114
+ document: StarkCore::Utils::API.from_api_json(request_maker, json['document']),
116
115
  errors: json['errors'],
117
116
  type: json['type'],
118
117
  created: json['created']
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
5
  require_relative('../utils/parse')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  # # IndividualIdentity object
@@ -29,7 +28,7 @@ module StarkInfra
29
28
  # - id [string]: unique id returned when the IndividualIdentity is created. ex: "5656565656565656"
30
29
  # - status [string]: current status of the IndividualIdentity. Options: "created", "canceled", "processing", "failed", "success"
31
30
  # - created [DateTime]: creation datetime for the IndividualIdentity. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
32
- class IndividualIdentity < StarkInfra::Utils::Resource
31
+ class IndividualIdentity < StarkCore::Utils::Resource
33
32
  attr_reader :name, :tax_id, :tags, :id, :status, :created
34
33
  def initialize(name:, tax_id:, tags: nil, id: nil, status: nil, created: nil)
35
34
  super(id)
@@ -37,7 +36,7 @@ module StarkInfra
37
36
  @tax_id = tax_id
38
37
  @tags = tags
39
38
  @status = status
40
- @created = StarkInfra::Utils::Checks.check_datetime(created)
39
+ @created = StarkCore::Utils::Checks.check_datetime(created)
41
40
  end
42
41
 
43
42
  # # Create IndividualIdentities
@@ -88,8 +87,8 @@ module StarkInfra
88
87
  # ## Return:
89
88
  # - generator of IndividualIdentity objects with updated attributes
90
89
  def self.query(limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
91
- after = StarkInfra::Utils::Checks.check_date(after)
92
- before = StarkInfra::Utils::Checks.check_date(before)
90
+ after = StarkCore::Utils::Checks.check_date(after)
91
+ before = StarkCore::Utils::Checks.check_date(before)
93
92
  StarkInfra::Utils::Rest.get_stream(
94
93
  limit: limit,
95
94
  after: after,
@@ -121,8 +120,8 @@ module StarkInfra
121
120
  # - list of IndividualIdentity objects with updated attributes
122
121
  # - cursor to retrieve the next page of IndividualIdentity objects
123
122
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
124
- after = StarkInfra::Utils::Checks.check_date(after)
125
- before = StarkInfra::Utils::Checks.check_date(before)
123
+ after = StarkCore::Utils::Checks.check_date(after)
124
+ before = StarkCore::Utils::Checks.check_date(before)
126
125
  StarkInfra::Utils::Rest.get_page(
127
126
  cursor: cursor,
128
127
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
5
  require_relative('IndividualIdentity')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IndividualIdentity
@@ -18,14 +17,14 @@ module StarkInfra
18
17
  # - errors [list of strings]: list of errors linked to this IndividualIdentity event
19
18
  # - type [string]: type of the IndividualIdentity event which triggered the log creation. ex: "created", "canceled", "processing", "failed", "success"
20
19
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
21
- class Log < StarkInfra::Utils::Resource
20
+ class Log < StarkCore::Utils::Resource
22
21
  attr_reader :id, :identity, :errors, :type, :created
23
22
  def initialize(id: nil, identity: nil, errors: nil, type: nil, created: nil)
24
23
  super(id)
25
24
  @identity = identity
26
25
  @errors = errors
27
26
  @type = type
28
- @created = StarkInfra::Utils::Checks.check_datetime(created)
27
+ @created = StarkCore::Utils::Checks.check_datetime(created)
29
28
  end
30
29
 
31
30
  # # Retrieve a specific IndividualIdentity::Log
@@ -59,8 +58,8 @@ module StarkInfra
59
58
  # ## Return:
60
59
  # - generator of IndividualIdentity::Log objects with updated attributes
61
60
  def self.query(limit: nil, after: nil, before: nil, types: nil, identity_ids: nil, user: nil)
62
- after = StarkInfra::Utils::Checks.check_date(after)
63
- before = StarkInfra::Utils::Checks.check_date(before)
61
+ after = StarkCore::Utils::Checks.check_date(after)
62
+ before = StarkCore::Utils::Checks.check_date(before)
64
63
  StarkInfra::Utils::Rest.get_stream(
65
64
  limit: limit,
66
65
  after: after,
@@ -90,8 +89,8 @@ module StarkInfra
90
89
  # - list of IndividualIdentity::Log objects with updated attributes
91
90
  # - cursor to retrieve the next page of Log objects
92
91
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, identity_ids: nil, user: nil)
93
- after = StarkInfra::Utils::Checks.check_date(after)
94
- before = StarkInfra::Utils::Checks.check_date(before)
92
+ after = StarkCore::Utils::Checks.check_date(after)
93
+ before = StarkCore::Utils::Checks.check_date(before)
95
94
  StarkInfra::Utils::Rest.get_page(
96
95
  cursor: cursor,
97
96
  limit: limit,
@@ -111,7 +110,7 @@ module StarkInfra
111
110
  resource_maker: proc { |json|
112
111
  Log.new(
113
112
  id: json['id'],
114
- identity: StarkInfra::Utils::API.from_api_json(request_maker, json['identity']),
113
+ identity: StarkCore::Utils::API.from_api_json(request_maker, json['identity']),
115
114
  errors: json['errors'],
116
115
  type: json['type'],
117
116
  created: json['created']
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingBalance object
@@ -16,7 +15,7 @@ module StarkInfra
16
15
  # - amount [integer]: current issuing balance amount of the Workspace in cents. ex: 200 (= R$ 2.00)
17
16
  # - currency [string]: currency of the current Workspace. Expect others to be added eventually. ex: 'BRL'
18
17
  # - updated [DateTime]: latest update datetime for the IssuingBalance. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
19
- class IssuingBalance < StarkInfra::Utils::Resource
18
+ class IssuingBalance < StarkCore::Utils::Resource
20
19
  attr_reader :amount, :currency, :updated, :id
21
20
  def initialize(amount: nil, currency: nil, updated: nil, id: nil)
22
21
  super(id)
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingCard object
@@ -37,7 +36,7 @@ module StarkInfra
37
36
  # - expiration [DateTime]: [EXPANDABLE] masked card expiration datetime. Expand to unmask the value. ex: DateTime.new(2032, 3, 10, 10, 30, 0, 0)
38
37
  # - created [DateTime]: creation datetime for the IssuingCard. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
39
38
  # - updated [DateTime]: latest update datetime for the IssuingCard. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
40
- class IssuingCard < StarkInfra::Utils::Resource
39
+ class IssuingCard < StarkCore::Utils::Resource
41
40
  attr_reader :id, :holder_name, :holder_tax_id, :holder_external_id, :display_name, :rules, :product_id, :tags,
42
41
  :street_line_1, :street_line_2, :district, :city, :state_code, :zip_code, :holder_id,
43
42
  :type, :status, :number, :security_code, :expiration, :created, :updated
@@ -66,9 +65,9 @@ module StarkInfra
66
65
  @number = number
67
66
  @security_code = security_code
68
67
  expiration = nil if !expiration.nil? && expiration.include?('*')
69
- @expiration = StarkInfra::Utils::Checks.check_datetime(expiration)
70
- @created = StarkInfra::Utils::Checks.check_datetime(created)
71
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
68
+ @expiration = StarkCore::Utils::Checks.check_datetime(expiration)
69
+ @created = StarkCore::Utils::Checks.check_datetime(created)
70
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
72
71
  end
73
72
 
74
73
  # # Create IssuingCards
@@ -124,8 +123,8 @@ module StarkInfra
124
123
  # - generator of IssuingCards objects with updated attributes
125
124
  def self.query(limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil, tags: nil,
126
125
  expand: nil, user: nil)
127
- after = StarkInfra::Utils::Checks.check_date(after)
128
- before = StarkInfra::Utils::Checks.check_date(before)
126
+ after = StarkCore::Utils::Checks.check_date(after)
127
+ before = StarkCore::Utils::Checks.check_date(before)
129
128
  StarkInfra::Utils::Rest.get_stream(
130
129
  limit: limit,
131
130
  ids: ids,
@@ -164,8 +163,8 @@ module StarkInfra
164
163
  # - cursor to retrieve the next page of IssuingCards objects
165
164
  def self.page(cursor: nil, limit: nil, ids: nil, after: nil, before: nil, status: nil, types: nil, holder_ids: nil,
166
165
  tags: nil, expand: nil, user: nil)
167
- after = StarkInfra::Utils::Checks.check_date(after)
168
- before = StarkInfra::Utils::Checks.check_date(before)
166
+ after = StarkCore::Utils::Checks.check_date(after)
167
+ before = StarkCore::Utils::Checks.check_date(before)
169
168
  StarkInfra::Utils::Rest.get_page(
170
169
  cursor: cursor,
171
170
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('issuingcard')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingCard
@@ -17,13 +16,13 @@ module StarkInfra
17
16
  # - card [IssuingCard]: IssuingCard entity to which the log refers to.
18
17
  # - type [string]: type of the IssuingCard event which triggered the log creation. ex: 'processing' or 'success'
19
18
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class Log < StarkInfra::Utils::Resource
19
+ class Log < StarkCore::Utils::Resource
21
20
  attr_reader :id, :created, :type, :card
22
21
  def initialize(id:, created:, type:, card:)
23
22
  super(id)
24
23
  @type = type
25
24
  @card = card
26
- @created = StarkInfra::Utils::Checks.check_datetime(created)
25
+ @created = StarkCore::Utils::Checks.check_datetime(created)
27
26
  end
28
27
 
29
28
  # # Retrieve a specific IssuingCard::Log
@@ -58,8 +57,8 @@ module StarkInfra
58
57
  # ## Return:
59
58
  # - generator of IssuingCard::Log objects with updated attributes
60
59
  def self.query(limit: nil, after: nil, before: nil, types: nil, card_ids: nil, user: nil)
61
- after = StarkInfra::Utils::Checks.check_date(after)
62
- before = StarkInfra::Utils::Checks.check_date(before)
60
+ after = StarkCore::Utils::Checks.check_date(after)
61
+ before = StarkCore::Utils::Checks.check_date(before)
63
62
  StarkInfra::Utils::Rest.get_stream(
64
63
  limit: limit,
65
64
  after: after,
@@ -90,8 +89,8 @@ module StarkInfra
90
89
  # - list of IssuingCard::Log objects with updated attributes
91
90
  # - Cursor to retrieve the next page of Log objects
92
91
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, card_ids: nil, user: nil)
93
- after = StarkInfra::Utils::Checks.check_date(after)
94
- before = StarkInfra::Utils::Checks.check_date(before)
92
+ after = StarkCore::Utils::Checks.check_date(after)
93
+ before = StarkCore::Utils::Checks.check_date(before)
95
94
  StarkInfra::Utils::Rest.get_page(
96
95
  cursor: cursor,
97
96
  limit: limit,
@@ -113,7 +112,7 @@ module StarkInfra
113
112
  id: json['id'],
114
113
  created: json['created'],
115
114
  type: json['type'],
116
- card: StarkInfra::Utils::API.from_api_json(request_maker, json['card'])
115
+ card: StarkCore::Utils::API.from_api_json(request_maker, json['card'])
117
116
  )
118
117
  }
119
118
  }
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingDesign object
@@ -16,7 +15,7 @@ module StarkInfra
16
15
  # - type [string]: card or package design type. Options: "card", "envelope"
17
16
  # - updated [DateTime]: latest update datetime for the IssuingDesign. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
17
  # - created [DateTime]: creation datetime for the IssuingDesign. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
19
- class IssuingDesign < StarkInfra::Utils::Resource
18
+ class IssuingDesign < StarkCore::Utils::Resource
20
19
  attr_reader :id, :name, :embosser_ids, :type, :updated, :created
21
20
  def initialize(
22
21
  id: nil, name: nil, embosser_ids: nil, type: nil, updated: nil, created: nil
@@ -25,8 +24,8 @@ module StarkInfra
25
24
  @name = name
26
25
  @embosser_ids = embosser_ids
27
26
  @type = type
28
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
29
- @created = StarkInfra::Utils::Checks.check_datetime(created)
27
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
28
+ @created = StarkCore::Utils::Checks.check_datetime(created)
30
29
  end
31
30
 
32
31
  # # Retrieve a specific IssuingDesign
@@ -112,7 +111,7 @@ module StarkInfra
112
111
  parsed_designs = []
113
112
  designs.each do |design|
114
113
  unless design.is_a? IssuingDesign
115
- design = StarkInfra::Utils::API.from_api_json(resource_maker, design)
114
+ design = StarkCore::Utils::API.from_api_json(resource_maker, design)
116
115
  end
117
116
  parsed_designs << design
118
117
  end
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingEmbossingKit object
@@ -15,7 +14,7 @@ module StarkInfra
15
14
  # - designs [list of IssuingDesign objects]: list of IssuingDesign objects. ex: [IssuingDesign(), IssuingDesign()]
16
15
  # - updated [DateTime]: latest update datetime for the IssuingEmbossingKit. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
17
16
  # - created [DateTime]: creation datetime for the IssuingEmbossingKit. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
- class IssuingEmbossingKit < StarkInfra::Utils::Resource
17
+ class IssuingEmbossingKit < StarkCore::Utils::Resource
19
18
  attr_reader :id, :name, :designs, :updated, :created
20
19
  def initialize(
21
20
  id: nil, name: nil, designs: nil, updated: nil, created: nil
@@ -23,8 +22,8 @@ module StarkInfra
23
22
  super(id)
24
23
  @name = name
25
24
  @designs = IssuingDesign::parse_designs(designs)
26
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
27
- @created = StarkInfra::Utils::Checks.check_datetime(created)
25
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
26
+ @created = StarkCore::Utils::Checks.check_datetime(created)
28
27
  end
29
28
 
30
29
  # # Retrieve a specific IssuingEmbossingKit
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/checks')
5
- require_relative('../utils/resource')
6
5
 
7
6
  module StarkInfra
8
7
  # # IssuingEmbossingRequest object
@@ -36,7 +35,7 @@ module StarkInfra
36
35
  # - status [string]: status of the IssuingEmbossingRequest. ex: "created", "processing", "success", "failed"
37
36
  # - updated [DateTime]: latest update datetime for the IssuingEmbossingRequest. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
38
37
  # - created [DateTime]: creation datetime for the IssuingEmbossingRequest. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
39
- class IssuingEmbossingRequest < StarkInfra::Utils::Resource
38
+ class IssuingEmbossingRequest < StarkCore::Utils::Resource
40
39
  attr_reader :card_id, :kit_id, :display_name_1, :shipping_city, :shipping_country_code,
41
40
  :shipping_district, :shipping_state_code, :shipping_street_line_1, :shipping_street_line_2,
42
41
  :shipping_service, :shipping_tracking_number, :shipping_zip_code, :embosser_id, :display_name_2,
@@ -68,8 +67,8 @@ module StarkInfra
68
67
  @tags = tags
69
68
  @fee = fee
70
69
  @status = status
71
- @created = StarkInfra::Utils::Checks.check_datetime(created)
72
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
70
+ @created = StarkCore::Utils::Checks.check_datetime(created)
71
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
73
72
  end
74
73
 
75
74
  # # Create IssuingEmbossingRequests
@@ -124,8 +123,8 @@ module StarkInfra
124
123
  limit: nil, after: nil, before: nil, status: nil, card_ids: nil, ids: nil,
125
124
  tags: nil, user: nil
126
125
  )
127
- after = StarkInfra::Utils::Checks.check_date(after)
128
- before = StarkInfra::Utils::Checks.check_date(before)
126
+ after = StarkCore::Utils::Checks.check_date(after)
127
+ before = StarkCore::Utils::Checks.check_date(before)
129
128
  StarkInfra::Utils::Rest.get_stream(
130
129
  limit: limit,
131
130
  after: after,
@@ -159,8 +158,8 @@ module StarkInfra
159
158
  # - list of IssuingEmbossingRequests objects with updated attributes
160
159
  # - cursor to retrieve the next page of IssuingEmbossingRequests objects
161
160
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, card_ids: nil, ids: nil, tags: nil, user: nil)
162
- after = StarkInfra::Utils::Checks.check_date(after)
163
- before = StarkInfra::Utils::Checks.check_date(before)
161
+ after = StarkCore::Utils::Checks.check_date(after)
162
+ before = StarkCore::Utils::Checks.check_date(before)
164
163
  StarkInfra::Utils::Rest.get_page(
165
164
  cursor: cursor,
166
165
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('IssuingEmbossingRequest')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/checks')
6
- require_relative('../utils/resource')
7
6
 
8
7
  module StarkInfra
9
8
  class IssuingEmbossingRequest
@@ -18,14 +17,14 @@ module StarkInfra
18
17
  # - errors [list of string]: list of errors linked to this IssuingEmbossingRequest event.
19
18
  # - type [string]: type of the IssuingEmbossingRequest event which triggered the log creation. ex: "created", "sending", "sent", "processing", "success", "failed"
20
19
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
21
- class Log < StarkInfra::Utils::Resource
20
+ class Log < StarkCore::Utils::Resource
22
21
  attr_reader :id, :request,:errors,:type, :created
23
22
  def initialize(id: nil, request: nil, errors: nil, type: nil, created: nil)
24
23
  super(id)
25
24
  @request = request
26
25
  @type = type
27
26
  @errors = errors
28
- @created = StarkInfra::Utils::Checks.check_datetime(created)
27
+ @created = StarkCore::Utils::Checks.check_datetime(created)
29
28
  end
30
29
 
31
30
  # # Retrieve a specific IssuingEmbossingRequest::Log
@@ -60,8 +59,8 @@ module StarkInfra
60
59
  # ## Return:
61
60
  # - generator of IssuingEmbossingRequest::Log objects with updated attributes
62
61
  def self.query(limit: nil, after: nil, before: nil, types: nil, request_ids: nil, ids: nil, user: nil)
63
- after = StarkInfra::Utils::Checks.check_date(after)
64
- before = StarkInfra::Utils::Checks.check_date(before)
62
+ after = StarkCore::Utils::Checks.check_date(after)
63
+ before = StarkCore::Utils::Checks.check_date(before)
65
64
  StarkInfra::Utils::Rest.get_stream(
66
65
  limit: limit,
67
66
  after: after,
@@ -93,8 +92,8 @@ module StarkInfra
93
92
  # - list of IssuingEmbossingRequest::Log objects with updated attributes
94
93
  # - Cursor to retrieve the next page of Log objects
95
94
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, request_ids: nil, ids: nil, user: nil)
96
- after = StarkInfra::Utils::Checks.check_date(after)
97
- before = StarkInfra::Utils::Checks.check_date(before)
95
+ after = StarkCore::Utils::Checks.check_date(after)
96
+ before = StarkCore::Utils::Checks.check_date(before)
98
97
  StarkInfra::Utils::Rest.get_page(
99
98
  cursor: cursor,
100
99
  limit: limit,
@@ -115,7 +114,7 @@ module StarkInfra
115
114
  resource_maker: proc { |json|
116
115
  Log.new(
117
116
  id: json['id'],
118
- request: StarkInfra::Utils::API.from_api_json(request_maker, json['request']),
117
+ request: StarkCore::Utils::API.from_api_json(request_maker, json['request']),
119
118
  errors: json['errors'],
120
119
  created: json['created'],
121
120
  type: json['type']