starkbank 2.4.0 → 2.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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/balance/balance.rb +1 -1
  3. data/lib/boleto/boleto.rb +49 -10
  4. data/lib/boleto/log.rb +35 -4
  5. data/lib/boleto_holmes/boleto_holmes.rb +39 -4
  6. data/lib/boleto_holmes/log.rb +35 -4
  7. data/lib/boleto_payment/boleto_payment.rb +38 -5
  8. data/lib/boleto_payment/log.rb +35 -4
  9. data/lib/brcode_payment/brcode_payment.rb +52 -13
  10. data/lib/brcode_payment/log.rb +35 -4
  11. data/lib/brcode_preview/brcode_preview.rb +2 -2
  12. data/lib/darf_payment/darf_payment.rb +218 -0
  13. data/lib/darf_payment/log.rb +125 -0
  14. data/lib/deposit/deposit.rb +45 -7
  15. data/lib/deposit/log.rb +35 -4
  16. data/lib/dict_key/dict_key.rb +44 -8
  17. data/lib/error.rb +13 -5
  18. data/lib/event/attempt.rb +125 -0
  19. data/lib/event/event.rb +40 -4
  20. data/lib/institution/institution.rb +67 -0
  21. data/lib/invoice/invoice.rb +66 -9
  22. data/lib/invoice/log.rb +51 -4
  23. data/lib/invoice/payment.rb +57 -0
  24. data/lib/payment_request/payment_request.rb +47 -7
  25. data/lib/starkbank.rb +7 -0
  26. data/lib/tax_payment/log.rb +125 -0
  27. data/lib/tax_payment/tax_payment.rb +203 -0
  28. data/lib/transaction/transaction.rb +37 -4
  29. data/lib/transfer/log.rb +35 -4
  30. data/lib/transfer/transfer.rb +47 -8
  31. data/lib/user/organization.rb +1 -1
  32. data/lib/user/project.rb +1 -1
  33. data/lib/utility_payment/log.rb +35 -4
  34. data/lib/utility_payment/utility_payment.rb +38 -5
  35. data/lib/utils/api.rb +1 -0
  36. data/lib/utils/request.rb +1 -1
  37. data/lib/utils/resource.rb +2 -21
  38. data/lib/utils/rest.rb +28 -12
  39. data/lib/utils/sub_resource.rb +28 -0
  40. data/lib/utils/url.rb +3 -1
  41. data/lib/webhook/webhook.rb +23 -2
  42. data/lib/workspace/workspace.rb +57 -8
  43. metadata +15 -7
@@ -0,0 +1,203 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative('../utils/resource')
4
+ require_relative('../utils/rest')
5
+ require_relative('../utils/checks')
6
+
7
+ module StarkBank
8
+ # # TaxPayment object
9
+ #
10
+ # When you initialize a TaxPayment, the entity will not be automatically
11
+ # created in the Stark Bank API. The 'create' function sends the objects
12
+ # to the Stark Bank API and returns the list of created objects.
13
+ #
14
+ # ## Parameters (conditionally required):
15
+ # - line [string, default nil]: Number sequence that describes the payment. Either 'line' or 'bar_code' parameters are required. If both are sent, they must match. ex: '85800000003 0 28960328203 1 56072020190 5 22109674804 0'
16
+ # - bar_code [string, default nil]: Bar code number that describes the payment. Either 'line' or 'barCode' parameters are required. If both are sent, they must match. ex: '83660000001084301380074119002551100010601813'
17
+ #
18
+ # ## Parameters (required):
19
+ # - description [string]: Text to be displayed in your statement (min. 10 characters). ex: 'payment ABC'
20
+ #
21
+ # ## Parameters (optional):
22
+ # - scheduled [Date, DateTime, Time or string, default today]: payment scheduled date. ex: Date.new(2020, 3, 10)
23
+ # - tags [list of strings, default nil]: list of strings for tagging
24
+ #
25
+ # ## Attributes (return-only):
26
+ # - id [string, default nil]: unique id returned when payment is created. ex: '5656565656565656'
27
+ # - type [string, default nil]: tax type. ex: 'das'
28
+ # - status [string, default nil]: current payment status. ex: 'success' or 'failed'
29
+ # - amount [int, default nil]: amount automatically calculated from line or bar_code. ex: 23456 (= R$ 234.56)
30
+ # - fee [integer, default nil]: fee charged when tax payment is created. ex: 200 (= R$ 2.00)
31
+ # - created [DateTime, default nil]: creation datetime for the Invoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
32
+ # - updated [DateTime, default nil]: latest update datetime for the Invoice. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
33
+ class TaxPayment < StarkBank::Utils::Resource
34
+ attr_reader :id, :line, :bar_code, :description, :tags, :scheduled, :status, :amount, :fee, :type, :updated, :created
35
+ def initialize(
36
+ id: nil, line: nil, bar_code: nil, description:, tags: nil, scheduled: nil,
37
+ status: nil, amount: nil, fee: nil, type: nil, updated: nil, created: nil
38
+ )
39
+ super(id)
40
+ @line = line
41
+ @bar_code = bar_code
42
+ @description = description
43
+ @tags = tags
44
+ @scheduled = StarkBank::Utils::Checks.check_date(scheduled)
45
+ @status = status
46
+ @amount = amount
47
+ @fee = fee
48
+ @type = type
49
+ @updated = StarkBank::Utils::Checks.check_datetime(updated)
50
+ @created = StarkBank::Utils::Checks.check_datetime(created)
51
+ end
52
+
53
+ # # Create TaxPayments
54
+ #
55
+ # Send a list of TaxPayment objects for creation in the Stark Bank API
56
+ #
57
+ # ## Parameters (required):
58
+ # - payments [list of TaxPayment objects]: list of TaxPayment objects to be created in the API
59
+ #
60
+ # ## Parameters (optional):
61
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
62
+ #
63
+ # ## Return:
64
+ # - list of TaxPayment objects with updated attributes
65
+ def self.create(payments, user: nil)
66
+ StarkBank::Utils::Rest.post(entities: payments, user: user, **resource)
67
+ end
68
+
69
+ # # Retrieve a specific TaxPayment
70
+ #
71
+ # Receive a single TaxPayment object previously created by the Stark Bank API by passing its id
72
+ #
73
+ # ## Parameters (required):
74
+ # - id [string]: object unique id. ex: '5656565656565656'
75
+ #
76
+ # ## Parameters (optional):
77
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
78
+ #
79
+ # ## Return:
80
+ # - TaxPayment object with updated attributes
81
+ def self.get(id, user: nil)
82
+ StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
83
+ end
84
+
85
+ # # Retrieve a specific TaxPayment pdf file
86
+ #
87
+ # Receive a single TaxPayment pdf file generated in the Stark Bank API by passing its id.
88
+ # Only valid for tax payments with 'success' status.
89
+ #
90
+ # ## Parameters (required):
91
+ # - id [string]: object unique id. ex: '5656565656565656'
92
+ #
93
+ # ## Parameters (optional):
94
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
95
+ #
96
+ # ## Return:
97
+ # - TaxPayment pdf file
98
+ def self.pdf(id, user: nil)
99
+ StarkBank::Utils::Rest.get_content(id: id, user: user, sub_resource_name: 'pdf', **resource)
100
+ end
101
+
102
+ # # Retrieve TaxPayments
103
+ #
104
+ # Receive a generator of TaxPayment objects previously created in the Stark Bank API
105
+ #
106
+ # ## Parameters (optional):
107
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
108
+ # - after [Date , DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
109
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
110
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
111
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
112
+ # - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
113
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
114
+ #
115
+ # ## Return:
116
+ # - generator of TaxPayment objects with updated attributes
117
+ def self.query(limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
118
+ after = StarkBank::Utils::Checks.check_date(after)
119
+ before = StarkBank::Utils::Checks.check_date(before)
120
+ StarkBank::Utils::Rest.get_stream(
121
+ limit: limit,
122
+ after: after,
123
+ before: before,
124
+ tags: tags,
125
+ ids: ids,
126
+ status: status,
127
+ user: user,
128
+ **resource
129
+ )
130
+ end
131
+
132
+ # # Retrieve paged Tax Payments
133
+ #
134
+ # Receive a list of up to 100 Tax Payment objects previously created in the Stark Bank API and the cursor to the next page.
135
+ # Use this function instead of query if you want to manually page your requests.
136
+ #
137
+ # ## Parameters (optional):
138
+ # - cursor [string, default nil]: cursor returned on the previous page function call
139
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
140
+ # - after [Date , DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
141
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
142
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
143
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
144
+ # - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
145
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
146
+ #
147
+ # ## Return:
148
+ # - list of Tax Payment objects with updated attributes and cursor to retrieve the next page of Tax Payment objects
149
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, user: nil)
150
+ after = StarkBank::Utils::Checks.check_date(after)
151
+ before = StarkBank::Utils::Checks.check_date(before)
152
+ return StarkBank::Utils::Rest.get_page(
153
+ cursor: cursor,
154
+ limit: limit,
155
+ after: after,
156
+ before: before,
157
+ tags: tags,
158
+ ids: ids,
159
+ status: status,
160
+ user: user,
161
+ **resource
162
+ )
163
+ end
164
+
165
+ # # Delete a TaxPayment entity
166
+ #
167
+ # Delete a TaxPayment entity previously created in the Stark Bank API
168
+ #
169
+ # ## Parameters (required):
170
+ # - id [string]: UtilityPayment unique id. ex:'5656565656565656'
171
+ #
172
+ # ## Parameters (optional):
173
+ # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
174
+ #
175
+ # ## Return:
176
+ # - deleted TaxPayment object
177
+ def self.delete(id, user: nil)
178
+ StarkBank::Utils::Rest.delete_id(id: id, user: user, **resource)
179
+ end
180
+
181
+ def self.resource
182
+ {
183
+ resource_name: 'TaxPayment',
184
+ resource_maker: proc { |json|
185
+ TaxPayment.new(
186
+ id: json['id'],
187
+ line: json['line'],
188
+ bar_code: json['bar_code'],
189
+ description: json['description'],
190
+ tags: json['tags'],
191
+ scheduled: json['scheduled'],
192
+ status: json['status'],
193
+ amount: json['amount'],
194
+ fee: json['fee'],
195
+ type: json['type'],
196
+ updated: json['updated'],
197
+ created: json['created']
198
+ )
199
+ }
200
+ }
201
+ end
202
+ end
203
+ end
@@ -85,19 +85,52 @@ module StarkBank
85
85
  #
86
86
  # ## Parameters (optional):
87
87
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
88
- # - after [Date, DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
89
- # - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
88
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
89
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
90
90
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
91
91
  # - external_ids [list of strings, default nil]: list of external ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
92
92
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
93
- # - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
93
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
94
94
  #
95
95
  # ## Return:
96
96
  # - generator of Transaction objects with updated attributes
97
97
  def self.query(limit: nil, after: nil, before: nil, tags: nil, external_ids: nil, ids: nil, user: nil)
98
98
  after = StarkBank::Utils::Checks.check_date(after)
99
99
  before = StarkBank::Utils::Checks.check_date(before)
100
- StarkBank::Utils::Rest.get_list(
100
+ StarkBank::Utils::Rest.get_stream(
101
+ limit: limit,
102
+ after: after,
103
+ before: before,
104
+ tags: tags,
105
+ external_ids: external_ids,
106
+ ids: ids,
107
+ user: user,
108
+ **resource
109
+ )
110
+ end
111
+
112
+ # # Retrieve paged Transactions
113
+ #
114
+ # Receive a list of up to 100 Transaction objects previously created in the Stark Bank API and the cursor to the next page.
115
+ # Use this function instead of query if you want to manually page your requests.
116
+ #
117
+ # ## Parameters (optional):
118
+ # - cursor [string, default nil]: cursor returned on the previous page function call
119
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
120
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
121
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
122
+ # - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
123
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
124
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
125
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
126
+ #
127
+ # ## Return:
128
+ # - list of Transaction objects with updated attributes and cursor to retrieve the next page of Transaction objects
129
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, tags: nil, external_ids: nil, ids: nil, user: nil)
130
+ after = StarkBank::Utils::Checks.check_date(after)
131
+ before = StarkBank::Utils::Checks.check_date(before)
132
+ return StarkBank::Utils::Rest.get_page(
133
+ cursor: cursor,
101
134
  limit: limit,
102
135
  after: after,
103
136
  before: before,
data/lib/transfer/log.rb CHANGED
@@ -51,18 +51,49 @@ module StarkBank
51
51
  #
52
52
  # ## Parameters (optional):
53
53
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
54
- # - after [Date, DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
55
- # - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
54
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
55
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
56
56
  # - types [list of strings, default nil]: filter retrieved objects by types. ex: 'success' or 'failed'
57
57
  # - transfer_ids [list of strings, default nil]: list of Transfer ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
58
- # - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
58
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
59
59
  #
60
60
  # ## Return:
61
61
  # - list of Log objects with updated attributes
62
62
  def self.query(limit: nil, after: nil, before: nil, types: nil, transfer_ids: nil, user: nil)
63
63
  after = StarkBank::Utils::Checks.check_date(after)
64
64
  before = StarkBank::Utils::Checks.check_date(before)
65
- StarkBank::Utils::Rest.get_list(
65
+ StarkBank::Utils::Rest.get_stream(
66
+ limit: limit,
67
+ after: after,
68
+ before: before,
69
+ types: types,
70
+ transfer_ids: transfer_ids,
71
+ user: user,
72
+ **resource
73
+ )
74
+ end
75
+
76
+ # # Retrieve paged Logs
77
+ #
78
+ # Receive a list of up to 100 Log objects previously created in the Stark Bank API and the cursor to the next page.
79
+ # Use this function instead of query if you want to manually page your requests.
80
+ #
81
+ # ## Parameters (optional):
82
+ # - cursor [string, default nil]: cursor returned on the previous page function call
83
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
84
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
85
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
86
+ # - types [list of strings, default nil]: filter retrieved objects by types. ex: 'success' or 'failed'
87
+ # - transfer_ids [list of strings, default nil]: list of Transfer ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
88
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
89
+ #
90
+ # ## Return:
91
+ # - list of Log objects with updated attributes and cursor to retrieve the next page of Log objects
92
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, transfer_ids: nil, user: nil)
93
+ after = StarkBank::Utils::Checks.check_date(after)
94
+ before = StarkBank::Utils::Checks.check_date(before)
95
+ return StarkBank::Utils::Rest.get_page(
96
+ cursor: cursor,
66
97
  limit: limit,
67
98
  after: after,
68
99
  before: before,
@@ -20,9 +20,10 @@ module StarkBank
20
20
  # - account_number [string]: receiver bank account number. Use '-' before the verifier digit. ex: '876543-2'
21
21
  #
22
22
  # ## Parameters (optional):
23
- # - account_type [string, default 'checking']: receiver bank account type. This parameter only has effect on Pix Transfers. ex: 'checking', 'savings' or 'salary'
23
+ # - account_type [string, default 'checking']: receiver bank account type. This parameter only has effect on Pix Transfers. ex: 'checking', 'savings', 'salary' or 'payment'
24
24
  # - external_id [string, default nil]: url safe string that must be unique among all your transfers. Duplicated external_ids will cause failures. By default, this parameter will block any transfer that repeats amount and receiver information on the same date. ex: 'my-internal-id-123456'
25
25
  # - scheduled [string, default now]: datetime when the transfer will be processed. May be pushed to next business day if necessary. ex: DateTime.new(2020, 3, 11, 8, 13, 12, 11)
26
+ # - description [string, default nil]: optional description to override default description to be shown in the bank statement. ex: 'Payment for service #1234'
26
27
  # - tags [list of strings]: list of strings for reference when searching for transfers. ex: ['employees', 'monthly']
27
28
  #
28
29
  # ## Attributes (return-only):
@@ -33,8 +34,8 @@ module StarkBank
33
34
  # - created [DateTime, default nil]: creation datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
34
35
  # - updated [DateTime, default nil]: latest update datetime for the transfer. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
35
36
  class Transfer < StarkBank::Utils::Resource
36
- attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :transaction_ids, :fee, :tags, :status, :id, :created, :updated
37
- def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, transaction_ids: nil, fee: nil, tags: nil, status: nil, id: nil, created: nil, updated: nil)
37
+ attr_reader :amount, :name, :tax_id, :bank_code, :branch_code, :account_number, :account_type, :external_id, :scheduled, :description, :transaction_ids, :fee, :tags, :status, :id, :created, :updated
38
+ def initialize(amount:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type: nil, external_id: nil, scheduled: nil, description: nil, transaction_ids: nil, fee: nil, tags: nil, status: nil, id: nil, created: nil, updated: nil)
38
39
  super(id)
39
40
  @amount = amount
40
41
  @name = name
@@ -45,6 +46,7 @@ module StarkBank
45
46
  @account_type = account_type
46
47
  @external_id = external_id
47
48
  @scheduled = StarkBank::Utils::Checks.check_date_or_datetime(scheduled)
49
+ @description = description
48
50
  @transaction_ids = transaction_ids
49
51
  @fee = fee
50
52
  @tags = tags
@@ -115,7 +117,7 @@ module StarkBank
115
117
  # ## Return:
116
118
  # - Transfer pdf file
117
119
  def self.pdf(id, user: nil)
118
- StarkBank::Utils::Rest.get_pdf(id: id, user: user, **resource)
120
+ StarkBank::Utils::Rest.get_content(id: id, user: user, sub_resource_name: 'pdf', **resource)
119
121
  end
120
122
 
121
123
  # # Retrieve Transfers
@@ -124,21 +126,57 @@ module StarkBank
124
126
  #
125
127
  # ## Parameters (optional):
126
128
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
127
- # - after [Date, DateTime, Time or string, default nil] date filter for objects created or updated only after specified date. ex: Date.new(2020, 3, 10)
128
- # - before [Date, DateTime, Time or string, default nil] date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
129
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created or updated only after specified date. ex: Date.new(2020, 3, 10)
130
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created or updated only before specified date. ex: Date.new(2020, 3, 10)
129
131
  # - transactionIds [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
130
132
  # - status [string, default nil]: filter for status of retrieved objects. ex: 'success' or 'failed'
131
133
  # - tax_id [string, default nil]: filter for transfers sent to the specified tax ID. ex: '012.345.678-90'
132
134
  # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
133
135
  # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
134
- # - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
136
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
135
137
  #
136
138
  # ## Return:
137
139
  # - generator of Transfer objects with updated attributes
138
140
  def self.query(limit: nil, after: nil, before: nil, transaction_ids: nil, status: nil, tax_id: nil, sort: nil, tags: nil, ids: nil, user: nil)
139
141
  after = StarkBank::Utils::Checks.check_date(after)
140
142
  before = StarkBank::Utils::Checks.check_date(before)
141
- StarkBank::Utils::Rest.get_list(
143
+ StarkBank::Utils::Rest.get_stream(
144
+ limit: limit,
145
+ after: after,
146
+ before: before,
147
+ transaction_ids: transaction_ids,
148
+ status: status,
149
+ tax_id: tax_id,
150
+ sort: sort,
151
+ tags: tags,
152
+ ids: ids,
153
+ user: user,
154
+ **resource
155
+ )
156
+ end
157
+
158
+ # # Retrieve paged Transfers
159
+ #
160
+ # Receive a list of up to 100 Transfer objects previously created in the Stark Bank API and the cursor to the next page.
161
+ # Use this function instead of query if you want to manually page your requests.
162
+ #
163
+ # ## Parameters (optional):
164
+ # - cursor [string, default nil]: cursor returned on the previous page function call
165
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
166
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
167
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
168
+ # - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
169
+ # - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
170
+ # - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
171
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
172
+ #
173
+ # ## Return:
174
+ # - list of Transfer objects with updated attributes and cursor to retrieve the next page of Transfer objects
175
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, transaction_ids: nil, status: nil, tax_id: nil, sort: nil, tags: nil, ids: nil, user: nil)
176
+ after = StarkBank::Utils::Checks.check_date(after)
177
+ before = StarkBank::Utils::Checks.check_date(before)
178
+ return StarkBank::Utils::Rest.get_page(
179
+ cursor: cursor,
142
180
  limit: limit,
143
181
  after: after,
144
182
  before: before,
@@ -168,6 +206,7 @@ module StarkBank
168
206
  account_type: json['account_type'],
169
207
  external_id: json['external_id'],
170
208
  scheduled: json['scheduled'],
209
+ description: json['description'],
171
210
  transaction_ids: json['transaction_ids'],
172
211
  fee: json['fee'],
173
212
  tags: json['tags'],
@@ -10,7 +10,7 @@ module StarkBank
10
10
  # of your organization can register or change the Organization credentials.
11
11
  # All requests to the Stark Bank API must be authenticated via an SDK user,
12
12
  # which must have been previously created at the Stark Bank website
13
- # [https://sandbox.web.starkbank.com] or [https://web.starkbank.com]
13
+ # [https://web.sandbox.starkbank.com] or [https://web.starkbank.com]
14
14
  # before you can use it in this SDK. Organizations may be passed as the user parameter on
15
15
  # each request or may be defined as the default user at the start (See README).
16
16
  # If you are accessing a specific Workspace using Organization credentials, you should
data/lib/user/project.rb CHANGED
@@ -9,7 +9,7 @@ module StarkBank
9
9
  # linked to a specific Workspace.
10
10
  # All requests to the Stark Bank API must be authenticated via an SDK user,
11
11
  # which must have been previously created at the Stark Bank website
12
- # [https://sandbox.web.starkbank.com] or [https://web.starkbank.com]
12
+ # [https://web.sandbox.starkbank.com] or [https://web.starkbank.com]
13
13
  # before you can use it in this SDK. Projects may be passed as the user parameter on
14
14
  # each request or may be defined as the default user at the start (See README).
15
15
  #
@@ -51,24 +51,55 @@ module StarkBank
51
51
  #
52
52
  # ## Parameters (optional):
53
53
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
54
- # - after [Date, DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
55
- # - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
54
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
55
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
56
56
  # - types [list of strings, default nil]: filter retrieved objects by event types. ex: 'paid' or 'registered'
57
57
  # - payment_ids [list of strings, default nil]: list of UtilityPayment ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
58
- # - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
58
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
59
59
  #
60
60
  # ## Return:
61
61
  # - list of Log objects with updated attributes
62
62
  def self.query(limit: nil, after: nil, before: nil, types: nil, payment_ids: nil, user: nil)
63
63
  after = StarkBank::Utils::Checks.check_date(after)
64
64
  before = StarkBank::Utils::Checks.check_date(before)
65
- StarkBank::Utils::Rest.get_list(
65
+ StarkBank::Utils::Rest.get_stream(
66
+ limit: limit,
67
+ after: after,
68
+ before: before,
69
+ types: types,
70
+ payment_ids: payment_ids,
66
71
  user: user,
72
+ **resource
73
+ )
74
+ end
75
+
76
+ # # Retrieve paged Logs
77
+ #
78
+ # Receive a list of up to 100 Log objects previously created in the Stark Bank API and the cursor to the next page.
79
+ # Use this function instead of query if you want to manually page your requests.
80
+ #
81
+ # ## Parameters (optional):
82
+ # - cursor [string, default nil]: cursor returned on the previous page function call
83
+ # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
84
+ # - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
85
+ # - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
86
+ # - types [list of strings, default nil]: filter retrieved objects by event types. ex: 'paid' or 'registered'
87
+ # - payment_ids [list of strings, default nil]: list of UtilityPayment ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
88
+ # - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
89
+ #
90
+ # ## Return:
91
+ # - list of Log objects with updated attributes and cursor to retrieve the next page of Log objects
92
+ def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, payment_ids: nil, user: nil)
93
+ after = StarkBank::Utils::Checks.check_date(after)
94
+ before = StarkBank::Utils::Checks.check_date(before)
95
+ return StarkBank::Utils::Rest.get_page(
96
+ cursor: cursor,
67
97
  limit: limit,
68
98
  after: after,
69
99
  before: before,
70
100
  types: types,
71
101
  payment_ids: payment_ids,
102
+ user: user,
72
103
  **resource
73
104
  )
74
105
  end