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
@@ -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
  # # IssuingStock object
@@ -16,7 +15,7 @@ module StarkInfra
16
15
  # - embosser_id [string]: Embosser unique id. ex: "5656565656565656"
17
16
  # - updated [DateTime]: latest update datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
18
17
  # - created [DateTime]: creation datetime for the IssuingStock. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
19
- class IssuingStock < StarkInfra::Utils::Resource
18
+ class IssuingStock < StarkCore::Utils::Resource
20
19
  attr_reader :id, :balance, :design_id, :embosser_id, :updated, :created
21
20
  def initialize(
22
21
  id: nil, balance: nil, design_id: nil, embosser_id: nil, updated: nil, created: nil
@@ -25,8 +24,8 @@ module StarkInfra
25
24
  @balance = balance
26
25
  @design_id = design_id
27
26
  @embosser_id = embosser_id
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 IssuingStock
@@ -65,8 +64,8 @@ module StarkInfra
65
64
  def self.query(
66
65
  limit: nil, after: nil, before: nil, design_ids: nil, embosser_ids: nil, ids: nil, expand: nil, user: nil
67
66
  )
68
- after = StarkInfra::Utils::Checks.check_date(after)
69
- before = StarkInfra::Utils::Checks.check_date(before)
67
+ after = StarkCore::Utils::Checks.check_date(after)
68
+ before = StarkCore::Utils::Checks.check_date(before)
70
69
  StarkInfra::Utils::Rest.get_stream(
71
70
  limit: limit,
72
71
  after: after,
@@ -103,8 +102,8 @@ module StarkInfra
103
102
  cursor: nil, limit: nil, after: nil, before: nil, design_ids: nil, embosser_ids: nil,
104
103
  ids: nil, expand: nil, user: nil
105
104
  )
106
- after = StarkInfra::Utils::Checks.check_date(after)
107
- before = StarkInfra::Utils::Checks.check_date(before)
105
+ after = StarkCore::Utils::Checks.check_date(after)
106
+ before = StarkCore::Utils::Checks.check_date(before)
108
107
  StarkInfra::Utils::Rest.get_page(
109
108
  cursor: cursor,
110
109
  limit: limit,
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('IssuingStock')
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 IssuingStock
@@ -18,14 +17,14 @@ module StarkInfra
18
17
  # - type [string]: type of the IssuingStock event which triggered the log creation. ex: "created", "spent", "restocked", "lost"
19
18
  # - count [integer]: shift in stock balance. ex: 10
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, :stock, :type, :count, :created
23
22
  def initialize(id: nil, stock: nil, type: nil, count: nil, created: nil)
24
23
  super(id)
25
24
  @stock = stock
26
25
  @type = type
27
26
  @count = count
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 IssuingStock::Log
@@ -60,8 +59,8 @@ module StarkInfra
60
59
  # ## Return:
61
60
  # - generator of IssuingStock::Log objects with updated attributes
62
61
  def self.query(limit: nil, after: nil, before: nil, types: nil, stock_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,
@@ -95,8 +94,8 @@ module StarkInfra
95
94
  def self.page(
96
95
  cursor: nil, limit: nil, after: nil, before: nil, types: nil, stock_ids: nil, ids: nil, user: nil
97
96
  )
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_page(
101
100
  cursor: cursor,
102
101
  limit: limit,
@@ -117,7 +116,7 @@ module StarkInfra
117
116
  resource_maker: proc { |json|
118
117
  Log.new(
119
118
  id: json['id'],
120
- stock: StarkInfra::Utils::API.from_api_json(request_maker, json['stock']),
119
+ stock: StarkCore::Utils::API.from_api_json(request_maker, json['stock']),
121
120
  type: json['type'],
122
121
  count: json['count'],
123
122
  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
  # # IssuingTransaction object
@@ -17,7 +16,7 @@ module StarkInfra
17
16
  # - source [string]: source of the transaction. ex: 'issuing-purchase/5656565656565656'
18
17
  # - tags [string]: list of strings inherited from the source resource. ex: ['tony', 'stark']
19
18
  # - created [DateTime]: creation datetime for the IssuingTransaction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class IssuingTransaction < StarkInfra::Utils::Resource
19
+ class IssuingTransaction < StarkCore::Utils::Resource
21
20
  attr_reader :id, :amount, :balance, :description, :source, :tags, :created
22
21
 
23
22
  def initialize(id: nil, amount: nil, balance: nil, description: nil, source: nil, tags: nil, created: nil)
@@ -27,7 +26,7 @@ module StarkInfra
27
26
  @description = description
28
27
  @source = source
29
28
  @tags = tags
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 IssuingTransaction
@@ -63,8 +62,8 @@ module StarkInfra
63
62
  # ## Return:
64
63
  # - generator of IssuingTransaction objects with updated attributes
65
64
  def self.query(tags: nil, external_ids: nil, after: nil, before: nil, status: nil, ids: nil, limit: nil, user: nil)
66
- after = StarkInfra::Utils::Checks.check_date(after)
67
- before = StarkInfra::Utils::Checks.check_date(before)
65
+ after = StarkCore::Utils::Checks.check_date(after)
66
+ before = StarkCore::Utils::Checks.check_date(before)
68
67
  StarkInfra::Utils::Rest.get_stream(
69
68
  tags: tags,
70
69
  external_ids: external_ids,
@@ -99,8 +98,8 @@ module StarkInfra
99
98
  # - cursor to retrieve the next page of IssuingTransactions objects
100
99
  def self.page(cursor: nil, tags: nil, external_ids: nil, after: nil, before: nil, status: nil, ids: nil, limit: nil,
101
100
  user: nil)
102
- after = StarkInfra::Utils::Checks.check_date(after)
103
- before = StarkInfra::Utils::Checks.check_date(before)
101
+ after = StarkCore::Utils::Checks.check_date(after)
102
+ before = StarkCore::Utils::Checks.check_date(before)
104
103
  StarkInfra::Utils::Rest.get_page(
105
104
  cursor: cursor,
106
105
  tags: tags,
@@ -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
  # # IssuingWithdrawal object
@@ -23,7 +22,7 @@ module StarkInfra
23
22
  # - issuing_transaction_id [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
24
23
  # - updated [DateTime]: latest update datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
25
24
  # - created [DateTime]: creation datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
26
- class IssuingWithdrawal < StarkInfra::Utils::Resource
25
+ class IssuingWithdrawal < StarkCore::Utils::Resource
27
26
  attr_reader :amount, :external_id, :description, :tags, :id, :transaction_id, :issuing_transaction_id, :updated, :created
28
27
  def initialize(
29
28
  amount:, external_id:, description:, tags: nil, id: nil, transaction_id: nil, issuing_transaction_id: nil,
@@ -36,8 +35,8 @@ module StarkInfra
36
35
  @tags = tags
37
36
  @transaction_id = transaction_id
38
37
  @issuing_transaction_id = issuing_transaction_id
39
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
40
- @created = StarkInfra::Utils::Checks.check_datetime(created)
38
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
39
+ @created = StarkCore::Utils::Checks.check_datetime(created)
41
40
  end
42
41
 
43
42
  # # Create an IssuingWithdrawal
@@ -87,8 +86,8 @@ module StarkInfra
87
86
  # ## Return:
88
87
  # - generator of IssuingWithdrawal objects with updated attributes
89
88
  def self.query(limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil)
90
- after = StarkInfra::Utils::Checks.check_date(after)
91
- before = StarkInfra::Utils::Checks.check_date(before)
89
+ after = StarkCore::Utils::Checks.check_date(after)
90
+ before = StarkCore::Utils::Checks.check_date(before)
92
91
  StarkInfra::Utils::Rest.get_stream(
93
92
  limit: limit,
94
93
  external_ids: external_ids,
@@ -118,8 +117,8 @@ module StarkInfra
118
117
  # - list of IssuingWithdrawal objects with updated attributes
119
118
  # - cursor to retrieve the next page of IssuingWithdrawal objects
120
119
  def self.page(cursor: nil, limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil)
121
- after = StarkInfra::Utils::Checks.check_date(after)
122
- before = StarkInfra::Utils::Checks.check_date(before)
120
+ after = StarkCore::Utils::Checks.check_date(after)
121
+ before = StarkCore::Utils::Checks.check_date(before)
123
122
  StarkInfra::Utils::Rest.get_page(
124
123
  cursor: cursor,
125
124
  limit: limit,
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/sub_resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # MerchantCategory object
@@ -19,7 +19,7 @@ module StarkInfra
19
19
  # Attributes (return-only):
20
20
  # - name [string]: category's name. ex: 'Veterinary services', 'Fast food restaurants'
21
21
  # - number [string]: category's number. ex: '742', '5814'
22
- class MerchantCategory < StarkInfra::Utils::SubResource
22
+ class MerchantCategory < StarkCore::Utils::SubResource
23
23
  attr_reader :code, :type, :name, :number
24
24
  def initialize(code:, type:, name: nil, number: nil)
25
25
  @code = code
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/sub_resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # MerchantCountry object
@@ -15,7 +15,7 @@ module StarkInfra
15
15
  # - name [string]: country's name. ex: 'Brazil'
16
16
  # - number [string]: country's number. ex: '076'
17
17
  # - short_code [string]: country's short code. ex: 'BR'
18
- class MerchantCountry < StarkInfra::Utils::SubResource
18
+ class MerchantCountry < StarkCore::Utils::SubResource
19
19
  attr_reader :code, :short_code, :name, :number
20
20
  def initialize(code:, name: nil, number: nil, short_code: nil)
21
21
  @code = code
@@ -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
  # # PixBalance object
@@ -17,7 +16,7 @@ module StarkInfra
17
16
  # - amount [integer]: current balance amount of the workspace in cents. ex: 200 (= R$ 2.00)
18
17
  # - currency [string]: currency of the current workspace. Expect others to be added eventually. ex: 'BRL'
19
18
  # - updated [DateTime]: latest update datetime for the balance. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
20
- class PixBalance < StarkInfra::Utils::Resource
19
+ class PixBalance < StarkCore::Utils::Resource
21
20
  attr_reader :id, :amount, :currency, :updated
22
21
  def initialize(id: nil, amount: nil, currency: nil, updated: nil)
23
22
  super(id)
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('pixchargeback')
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 PixChargeback
@@ -19,11 +18,11 @@ module StarkInfra
19
18
  # - type [string]: type of the PixChargeback event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
20
19
  # - errors [list of strings]: list of errors linked to this PixChargeback event.
21
20
  # - chargeback [PixChargeback]: PixChargeback entity to which the log refers to.
22
- class Log < StarkInfra::Utils::Resource
21
+ class Log < StarkCore::Utils::Resource
23
22
  attr_reader :id, :created, :type, :errors, :chargeback
24
23
  def initialize(id:, created:, type:, errors:, chargeback:)
25
24
  super(id)
26
- @created = StarkInfra::Utils::Checks.check_datetime(created)
25
+ @created = StarkCore::Utils::Checks.check_datetime(created)
27
26
  @type = type
28
27
  @errors = errors
29
28
  @chargeback = chargeback
@@ -61,8 +60,8 @@ module StarkInfra
61
60
  # ## Return:
62
61
  # - generator of PixChargeback::Log objects with updated attributes
63
62
  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_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
  ids: ids,
68
67
  limit: limit,
@@ -94,8 +93,8 @@ module StarkInfra
94
93
  # - list of PixChargeback::Log objects with updated attributes
95
94
  # - cursor to retrieve the next page of Log objects
96
95
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, chargeback_ids: nil, user: nil)
97
- after = StarkInfra::Utils::Checks.check_date(after)
98
- before = StarkInfra::Utils::Checks.check_date(before)
96
+ after = StarkCore::Utils::Checks.check_date(after)
97
+ before = StarkCore::Utils::Checks.check_date(before)
99
98
  StarkInfra::Utils::Rest.get_page(
100
99
  cursor: cursor,
101
100
  ids: ids,
@@ -119,7 +118,7 @@ module StarkInfra
119
118
  created: json['created'],
120
119
  type: json['type'],
121
120
  errors: json['errors'],
122
- chargeback: StarkInfra::Utils::API.from_api_json(chargeback_maker, json['chargeback'])
121
+ chargeback: StarkCore::Utils::API.from_api_json(chargeback_maker, json['chargeback'])
123
122
  )
124
123
  }
125
124
  }
@@ -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
  # # PixChargeback object
@@ -36,7 +35,7 @@ module StarkInfra
36
35
  # - status [string]: current PixChargeback status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
37
36
  # - created [DateTime]: creation datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
38
37
  # - updated [DateTime]: latest update datetime for the PixChargeback. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
39
- class PixChargeback < StarkInfra::Utils::Resource
38
+ class PixChargeback < StarkCore::Utils::Resource
40
39
  attr_reader :amount, :reference_id, :reason, :description, :tags, :id, :analysis, :sender_bank_code,
41
40
  :receiver_bank_code, :rejection_reason, :reversal_reference_id, :result, :flow, :status, :created, :updated
42
41
  def initialize(
@@ -58,8 +57,8 @@ module StarkInfra
58
57
  @result = result
59
58
  @flow = flow
60
59
  @status = status
61
- @created = StarkInfra::Utils::Checks.check_datetime(created)
62
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
60
+ @created = StarkCore::Utils::Checks.check_datetime(created)
61
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
63
62
  end
64
63
 
65
64
  # # Create PixChargebacks
@@ -111,8 +110,8 @@ module StarkInfra
111
110
  # ## Return:
112
111
  # - generator of PixChargeback objects with updated attributes
113
112
  def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
114
- after = StarkInfra::Utils::Checks.check_date(after)
115
- before = StarkInfra::Utils::Checks.check_date(before)
113
+ after = StarkCore::Utils::Checks.check_date(after)
114
+ before = StarkCore::Utils::Checks.check_date(before)
116
115
  StarkInfra::Utils::Rest.get_stream(
117
116
  limit: limit,
118
117
  after: after,
@@ -146,8 +145,8 @@ module StarkInfra
146
145
  # - list of PixChargeback objects with updated attributes
147
146
  # - cursor to retrieve the next page of PixChargeback objects
148
147
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, user: nil)
149
- after = StarkInfra::Utils::Checks.check_date(after)
150
- before = StarkInfra::Utils::Checks.check_date(before)
148
+ after = StarkCore::Utils::Checks.check_date(after)
149
+ before = StarkCore::Utils::Checks.check_date(before)
151
150
  StarkInfra::Utils::Rest.get_page(
152
151
  cursor: cursor,
153
152
  limit: limit,
data/lib/pixclaim/log.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('pixclaim')
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 PixClaim
@@ -20,11 +19,11 @@ module StarkInfra
20
19
  # - errors [list of strings]: list of errors linked to this PixClaim event.
21
20
  # - reason [string]: reason why the PixClaim was modified, resulting in the Log. Options: 'fraud', 'userRequested', 'accountClosure', 'defaultOperation', 'reconciliation'
22
21
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
23
- class Log < StarkInfra::Utils::Resource
22
+ class Log < StarkCore::Utils::Resource
24
23
  attr_reader :id, :created, :type, :errors, :reason, :claim
25
24
  def initialize(id:, created:, type:, errors:, reason:, claim:)
26
25
  super(id)
27
- @created = StarkInfra::Utils::Checks.check_datetime(created)
26
+ @created = StarkCore::Utils::Checks.check_datetime(created)
28
27
  @type = type
29
28
  @errors = errors
30
29
  @reason = reason
@@ -63,8 +62,8 @@ module StarkInfra
63
62
  # ## Return:
64
63
  # - generator of PixClaim::Log objects with updated attributes
65
64
  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, claim_ids: nil, user: nil)
66
- after = StarkInfra::Utils::Checks.check_date(after)
67
- before = StarkInfra::Utils::Checks.check_date(before)
65
+ after = StarkCore::Utils::Checks.check_date(after)
66
+ before = StarkCore::Utils::Checks.check_date(before)
68
67
  StarkInfra::Utils::Rest.get_stream(
69
68
  ids: ids,
70
69
  limit: limit,
@@ -96,8 +95,8 @@ module StarkInfra
96
95
  # - list of Log objects with updated attributes
97
96
  # - cursor to retrieve the next page of Log objects
98
97
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, claim_ids: nil, user: nil)
99
- after = StarkInfra::Utils::Checks.check_date(after)
100
- before = StarkInfra::Utils::Checks.check_date(before)
98
+ after = StarkCore::Utils::Checks.check_date(after)
99
+ before = StarkCore::Utils::Checks.check_date(before)
101
100
  StarkInfra::Utils::Rest.get_page(
102
101
  cursor: cursor,
103
102
  ids: ids,
@@ -122,7 +121,7 @@ module StarkInfra
122
121
  type: json['type'],
123
122
  errors: json['errors'],
124
123
  reason: json['reason'],
125
- claim: StarkInfra::Utils::API.from_api_json(claim_maker, json['claim'])
124
+ claim: StarkCore::Utils::API.from_api_json(claim_maker, json['claim'])
126
125
  )
127
126
  }
128
127
  }
@@ -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
  # # PixClaim object
@@ -36,7 +35,7 @@ module StarkInfra
36
35
  # - claimed_bank_code [string]: bank_code of the account donating the PixClaim. ex: '20018183'.
37
36
  # - created [DateTime]: creation datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
38
37
  # - updated [DateTime]: update datetime for the PixClaim. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
39
- class PixClaim < StarkInfra::Utils::Resource
38
+ class PixClaim < StarkCore::Utils::Resource
40
39
  attr_reader :account_created, :account_number, :account_type, :branch_code, :name, :tax_id, :key_id,
41
40
  :tags, :id, :status, :type, :key_type, :flow, :claimer_bank_code, :claimed_bank_code, :created, :updated
42
41
  def initialize(
@@ -59,8 +58,8 @@ module StarkInfra
59
58
  @flow = flow
60
59
  @claimer_bank_code = claimer_bank_code
61
60
  @claimed_bank_code = claimed_bank_code
62
- @created = StarkInfra::Utils::Checks.check_datetime(created)
63
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
61
+ @created = StarkCore::Utils::Checks.check_datetime(created)
62
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
64
63
  end
65
64
 
66
65
  # # Create a PixClaim object
@@ -119,8 +118,8 @@ module StarkInfra
119
118
  limit: nil, after: nil, before: nil, status: nil, ids: nil,
120
119
  type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
121
120
  )
122
- after = StarkInfra::Utils::Checks.check_date(after)
123
- before = StarkInfra::Utils::Checks.check_date(before)
121
+ after = StarkCore::Utils::Checks.check_date(after)
122
+ before = StarkCore::Utils::Checks.check_date(before)
124
123
  StarkInfra::Utils::Rest.get_stream(
125
124
  limit: limit,
126
125
  after: after,
@@ -163,8 +162,8 @@ module StarkInfra
163
162
  cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil,
164
163
  type: nil, flow: nil, tags: nil, key_type: nil, key_id: nil, user: nil
165
164
  )
166
- after = StarkInfra::Utils::Checks.check_date(after)
167
- before = StarkInfra::Utils::Checks.check_date(before)
165
+ after = StarkCore::Utils::Checks.check_date(after)
166
+ before = StarkCore::Utils::Checks.check_date(before)
168
167
  StarkInfra::Utils::Rest.get_page(
169
168
  cursor: cursor,
170
169
  limit: limit,
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # PixDirector object
@@ -24,7 +24,7 @@ module StarkInfra
24
24
  #
25
25
  # ## Attributes (return-only):
26
26
  # - status [string]: current PixDirector status. ex: 'success'
27
- class PixDirector < StarkInfra::Utils::SubResource
27
+ class PixDirector < StarkCore::Utils::SubResource
28
28
  attr_reader :name, :tax_id, :phone, :email, :password, :team_email, :team_phones, :status
29
29
  def initialize(name:, tax_id:, phone:, email:, password:, team_email:, team_phones:, status: nil)
30
30
  @name = name
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('../utils/rest')
4
- require_relative('../utils/resource')
5
5
 
6
6
  module StarkInfra
7
7
  # # PixDomain::Certificate object
@@ -10,7 +10,7 @@ module StarkInfra
10
10
  #
11
11
  # ## Attributes (return-only):
12
12
  # - content [string]: certificate of the Pix participant in PEM format.
13
- class Certificate < StarkInfra::Utils::SubResource
13
+ class Certificate < StarkCore::Utils::SubResource
14
14
  attr_reader :content
15
15
  def initialize(content: nil)
16
16
  @content = content
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('certificate')
4
5
  require_relative('../utils/rest')
5
- require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
8
  # # PixDomain object
@@ -14,7 +14,7 @@ module StarkInfra
14
14
  # ## Attributes (return-only):
15
15
  # - certificates [list of PixDomain::Certificate objects]: certificate information of the Pix participant.
16
16
  # - name [string]: current active domain (URL) of the Pix participant.
17
- class PixDomain < StarkInfra::Utils::SubResource
17
+ class PixDomain < StarkCore::Utils::SubResource
18
18
  attr_reader :certificates, :name
19
19
  def initialize(certificates: nil, name: nil)
20
20
  @certificates = certificates
@@ -38,7 +38,7 @@ module StarkInfra
38
38
  certificate_maker = StarkInfra::Certificate.resource[:resource_maker]
39
39
  parsed_certificates = []
40
40
  certificates.each do |certificate|
41
- parsed_certificates << StarkInfra::Utils::API.from_api_json(certificate_maker, certificate)
41
+ parsed_certificates << StarkCore::Utils::API.from_api_json(certificate_maker, certificate)
42
42
  end
43
43
  parsed_certificates
44
44
  end
@@ -1,9 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require('starkcore')
3
4
  require_relative('pixinfraction')
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 PixInfraction
@@ -19,14 +18,14 @@ module StarkInfra
19
18
  # - type [string]: type of the PixInfraction event which triggered the log creation. Options: 'created', 'failed', 'delivering', 'delivered', 'closed', 'canceled'
20
19
  # - errors [list of strings]: list of errors linked to this PixInfraction event.
21
20
  # - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
22
- class Log < StarkInfra::Utils::Resource
21
+ class Log < StarkCore::Utils::Resource
23
22
  attr_reader :id, :created, :type, :errors, :infraction
24
23
  def initialize(id:, created:, type:, errors:, infraction:)
25
24
  super(id)
26
25
  @infraction = infraction
27
26
  @type = type
28
27
  @errors = errors
29
- @created = StarkInfra::Utils::Checks.check_datetime(created)
28
+ @created = StarkCore::Utils::Checks.check_datetime(created)
30
29
  end
31
30
 
32
31
  # # Retrieve a specific PixInfraction::Log
@@ -61,8 +60,8 @@ module StarkInfra
61
60
  # ## Return:
62
61
  # - list of PixInfraction::Log objects with updated attributes
63
62
  def self.query(ids: nil, limit: nil, after: nil, before: nil, types: nil, infraction_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
  ids: ids,
68
67
  limit: limit,
@@ -94,8 +93,8 @@ module StarkInfra
94
93
  # - list of PixInfraction::Log objects with updated attributes
95
94
  # - Cursor to retrieve the next page of Log objects
96
95
  def self.page(cursor: nil, ids: nil, limit: nil, after: nil, before: nil, types: nil, infraction_ids: nil, user: nil)
97
- after = StarkInfra::Utils::Checks.check_date(after)
98
- before = StarkInfra::Utils::Checks.check_date(before)
96
+ after = StarkCore::Utils::Checks.check_date(after)
97
+ before = StarkCore::Utils::Checks.check_date(before)
99
98
  StarkInfra::Utils::Rest.get_page(
100
99
  cursor: cursor,
101
100
  ids: ids,
@@ -116,7 +115,7 @@ module StarkInfra
116
115
  resource_maker: proc { |json|
117
116
  Log.new(
118
117
  id: json['id'],
119
- infraction: StarkInfra::Utils::API.from_api_json(infraction_maker, json['infraction']),
118
+ infraction: StarkCore::Utils::API.from_api_json(infraction_maker, json['infraction']),
120
119
  type: json['type'],
121
120
  errors: json['errors'],
122
121
  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
  # # PixInfraction object
@@ -32,7 +31,7 @@ module StarkInfra
32
31
  # - status [string]: current PixInfraction status. Options: 'created', 'failed', 'delivered', 'closed', 'canceled'.
33
32
  # - created [DateTime]: creation datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
34
33
  # - updated [DateTime]: latest update datetime for the PixInfraction. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
35
- class PixInfraction < StarkInfra::Utils::Resource
34
+ class PixInfraction < StarkCore::Utils::Resource
36
35
  attr_reader :reference_id, :type, :description, :tags, :id, :credited_bank_code, :flow, :analysis,
37
36
  :debited_bank_code, :reported_by, :result, :status, :created, :updated
38
37
  def initialize(
@@ -51,8 +50,8 @@ module StarkInfra
51
50
  @reported_by = reported_by
52
51
  @result = result
53
52
  @status = status
54
- @created = StarkInfra::Utils::Checks.check_datetime(created)
55
- @updated = StarkInfra::Utils::Checks.check_datetime(updated)
53
+ @created = StarkCore::Utils::Checks.check_datetime(created)
54
+ @updated = StarkCore::Utils::Checks.check_datetime(updated)
56
55
  end
57
56
 
58
57
  # # Create PixInfractions
@@ -105,8 +104,8 @@ module StarkInfra
105
104
  # ## Return:
106
105
  # - generator of PixInfraction objects with updated attributes
107
106
  def self.query(limit: nil, after: nil, before: nil, status: nil, ids: nil, type: nil, flow: nil, tags: nil, user: nil)
108
- after = StarkInfra::Utils::Checks.check_date(after)
109
- before = StarkInfra::Utils::Checks.check_date(before)
107
+ after = StarkCore::Utils::Checks.check_date(after)
108
+ before = StarkCore::Utils::Checks.check_date(before)
110
109
  StarkInfra::Utils::Rest.get_stream(
111
110
  limit: limit,
112
111
  after: after,
@@ -142,8 +141,8 @@ module StarkInfra
142
141
  # - list of PixInfraction objects with updated attributes
143
142
  # - cursor to retrieve the next page of PixInfraction objects
144
143
  def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, ids: nil, flow: nil, tags: nil, type: nil, user: nil)
145
- after = StarkInfra::Utils::Checks.check_date(after)
146
- before = StarkInfra::Utils::Checks.check_date(before)
144
+ after = StarkCore::Utils::Checks.check_date(after)
145
+ before = StarkCore::Utils::Checks.check_date(before)
147
146
  StarkInfra::Utils::Rest.get_page(
148
147
  cursor: cursor,
149
148
  limit: limit,