starkbank 2.2.1 → 2.6.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.
- checksums.yaml +4 -4
- data/lib/balance/balance.rb +2 -2
- data/lib/boleto/boleto.rb +53 -14
- data/lib/boleto/log.rb +36 -5
- data/lib/boleto_holmes/boleto_holmes.rb +41 -6
- data/lib/boleto_holmes/log.rb +36 -5
- data/lib/boleto_payment/boleto_payment.rb +42 -9
- data/lib/boleto_payment/log.rb +36 -5
- data/lib/brcode_payment/brcode_payment.rb +56 -17
- data/lib/brcode_payment/log.rb +36 -5
- data/lib/brcode_preview/brcode_preview.rb +5 -3
- data/lib/darf_payment/darf_payment.rb +218 -0
- data/lib/darf_payment/log.rb +125 -0
- data/lib/deposit/deposit.rb +46 -8
- data/lib/deposit/log.rb +36 -5
- data/lib/dict_key/dict_key.rb +45 -9
- data/lib/error.rb +13 -5
- data/lib/event/attempt.rb +125 -0
- data/lib/event/event.rb +44 -8
- data/lib/institution/institution.rb +67 -0
- data/lib/invoice/invoice.rb +81 -15
- data/lib/invoice/log.rb +52 -5
- data/lib/invoice/payment.rb +57 -0
- data/lib/payment_preview/boleto_preview.rb +75 -0
- data/lib/payment_preview/brcode_preview.rb +75 -0
- data/lib/payment_preview/payment_preview.rb +67 -0
- data/lib/payment_preview/tax_preview.rb +45 -0
- data/lib/payment_preview/utility_preview.rb +45 -0
- data/lib/payment_request/payment_request.rb +53 -11
- data/lib/starkbank.rb +14 -0
- data/lib/tax_payment/log.rb +125 -0
- data/lib/tax_payment/tax_payment.rb +203 -0
- data/lib/transaction/transaction.rb +39 -6
- data/lib/transfer/log.rb +36 -5
- data/lib/transfer/transfer.rb +59 -14
- data/lib/user/organization.rb +54 -0
- data/lib/user/project.rb +11 -6
- data/lib/user/user.rb +0 -4
- data/lib/utility_payment/log.rb +36 -5
- data/lib/utility_payment/utility_payment.rb +42 -9
- data/lib/utils/api.rb +1 -0
- data/lib/utils/request.rb +1 -1
- data/lib/utils/resource.rb +2 -21
- data/lib/utils/rest.rb +29 -14
- data/lib/utils/sub_resource.rb +28 -0
- data/lib/utils/url.rb +3 -1
- data/lib/webhook/webhook.rb +30 -9
- data/lib/workspace/workspace.rb +141 -0
- metadata +22 -7
data/lib/starkbank.rb
CHANGED
@@ -2,10 +2,13 @@
|
|
2
2
|
|
3
3
|
require_relative('key')
|
4
4
|
require_relative('user/project')
|
5
|
+
require_relative('user/organization')
|
6
|
+
require_relative('workspace/workspace')
|
5
7
|
require_relative('balance/balance')
|
6
8
|
require_relative('transaction/transaction')
|
7
9
|
require_relative('invoice/invoice')
|
8
10
|
require_relative('invoice/log')
|
11
|
+
require_relative('invoice/payment')
|
9
12
|
require_relative('dict_key/dict_key')
|
10
13
|
require_relative('deposit/deposit')
|
11
14
|
require_relative('deposit/log')
|
@@ -22,9 +25,20 @@ require_relative('boleto_payment/boleto_payment')
|
|
22
25
|
require_relative('boleto_payment/log')
|
23
26
|
require_relative('utility_payment/utility_payment')
|
24
27
|
require_relative('utility_payment/log')
|
28
|
+
require_relative('tax_payment/tax_payment')
|
29
|
+
require_relative('tax_payment/log')
|
30
|
+
require_relative('darf_payment/darf_payment')
|
31
|
+
require_relative('darf_payment/log')
|
25
32
|
require_relative('webhook/webhook')
|
26
33
|
require_relative('event/event')
|
34
|
+
require_relative('event/attempt')
|
27
35
|
require_relative('payment_request/payment_request')
|
36
|
+
require_relative('payment_preview/payment_preview')
|
37
|
+
require_relative('payment_preview/brcode_preview')
|
38
|
+
require_relative('payment_preview/boleto_preview')
|
39
|
+
require_relative('payment_preview/tax_preview')
|
40
|
+
require_relative('payment_preview/utility_preview')
|
41
|
+
require_relative('institution/institution')
|
28
42
|
|
29
43
|
# SDK to facilitate Ruby integrations with Stark Bank
|
30
44
|
module StarkBank
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative('../utils/resource')
|
4
|
+
require_relative('../utils/rest')
|
5
|
+
require_relative('../utils/checks')
|
6
|
+
require_relative('tax_payment')
|
7
|
+
|
8
|
+
module StarkBank
|
9
|
+
class TaxPayment
|
10
|
+
# # TaxPayment::Log object
|
11
|
+
#
|
12
|
+
# Every time a TaxPayment entity is updated, a corresponding TaxPayment::Log
|
13
|
+
# is generated for the entity. This log is never generated by the
|
14
|
+
# user, but it can be retrieved to check additional information
|
15
|
+
# on the TaxPayment.
|
16
|
+
#
|
17
|
+
# ## Attributes:
|
18
|
+
# - id [string]: unique id returned when the log is created. ex: '5656565656565656'
|
19
|
+
# - payment [TaxPayment]: TaxPayment entity to which the log refers to.
|
20
|
+
# - errors [list of strings]: list of errors linked to this TaxPayment event
|
21
|
+
# - type [string]: type of the TaxPayment event which triggered the log creation. ex: 'canceled' or 'paid'
|
22
|
+
# - created [DateTime]: creation datetime for the log. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
23
|
+
class Log < StarkBank::Utils::Resource
|
24
|
+
attr_reader :id, :created, :type, :errors, :payment
|
25
|
+
def initialize(id:, created:, type:, errors:, payment:)
|
26
|
+
super(id)
|
27
|
+
@type = type
|
28
|
+
@errors = errors
|
29
|
+
@payment = payment
|
30
|
+
@created = StarkBank::Utils::Checks.check_datetime(created)
|
31
|
+
end
|
32
|
+
|
33
|
+
# # Retrieve a specific Log
|
34
|
+
#
|
35
|
+
# Receive a single Log object previously created by the Stark Bank API by passing its id
|
36
|
+
#
|
37
|
+
# ## Parameters (required):
|
38
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
39
|
+
#
|
40
|
+
# ## Parameters (optional):
|
41
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
|
+
#
|
43
|
+
# ## Return:
|
44
|
+
# - Log object with updated attributes
|
45
|
+
def self.get(id, user: nil)
|
46
|
+
StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
|
47
|
+
end
|
48
|
+
|
49
|
+
# # Retrieve Logs
|
50
|
+
#
|
51
|
+
# Receive a generator of Log objects previously created in the Stark Bank API
|
52
|
+
#
|
53
|
+
# ## Parameters (optional):
|
54
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
55
|
+
# - after [Date, DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
56
|
+
# - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
57
|
+
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'canceled'
|
58
|
+
# - payment_ids [list of strings, default nil]: list of TaxPayment ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
59
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
|
+
#
|
61
|
+
# ## Return:
|
62
|
+
# - list of Log objects with updated attributes
|
63
|
+
def self.query(limit: nil, after: nil, before: nil, types: nil, payment_ids: nil, user: nil)
|
64
|
+
after = StarkBank::Utils::Checks.check_date(after)
|
65
|
+
before = StarkBank::Utils::Checks.check_date(before)
|
66
|
+
StarkBank::Utils::Rest.get_stream(
|
67
|
+
limit: limit,
|
68
|
+
after: after,
|
69
|
+
before: before,
|
70
|
+
types: types,
|
71
|
+
payment_ids: payment_ids,
|
72
|
+
user: user,
|
73
|
+
**resource
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
# # Retrieve paged Logs
|
78
|
+
#
|
79
|
+
# Receive a list of up to 100 Log objects previously created in the Stark Bank API and the cursor to the next page.
|
80
|
+
# Use this function instead of query if you want to manually page your requests.
|
81
|
+
#
|
82
|
+
# ## Parameters (optional):
|
83
|
+
# - cursor [string, default nil]: cursor returned on the previous page function call
|
84
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
85
|
+
# - after [Date, DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
86
|
+
# - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
87
|
+
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'canceled'
|
88
|
+
# - payment_ids [list of strings, default nil]: list of TaxPayment ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
89
|
+
# - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
90
|
+
#
|
91
|
+
# ## Return:
|
92
|
+
# - list of Log objects with updated attributes and cursor to retrieve the next page of Log objects
|
93
|
+
def self.page(cursor: nil, limit: nil, after: nil, before: nil, types: nil, payment_ids: nil, user: nil)
|
94
|
+
after = StarkBank::Utils::Checks.check_date(after)
|
95
|
+
before = StarkBank::Utils::Checks.check_date(before)
|
96
|
+
return StarkBank::Utils::Rest.get_page(
|
97
|
+
cursor: cursor,
|
98
|
+
limit: limit,
|
99
|
+
after: after,
|
100
|
+
before: before,
|
101
|
+
types: types,
|
102
|
+
payment_ids: payment_ids,
|
103
|
+
user: user,
|
104
|
+
**resource
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
def self.resource
|
109
|
+
tax_payment_maker = StarkBank::TaxPayment.resource[:resource_maker]
|
110
|
+
{
|
111
|
+
resource_name: 'TaxPaymentLog',
|
112
|
+
resource_maker: proc { |json|
|
113
|
+
Log.new(
|
114
|
+
id: json['id'],
|
115
|
+
created: json['created'],
|
116
|
+
type: json['type'],
|
117
|
+
errors: json['errors'],
|
118
|
+
payment: StarkBank::Utils::API.from_api_json(tax_payment_maker, json['payment'])
|
119
|
+
)
|
120
|
+
}
|
121
|
+
}
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -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
|
@@ -55,7 +55,7 @@ module StarkBank
|
|
55
55
|
# - transactions [list of Transaction objects]: list of Transaction objects to be created in the API
|
56
56
|
#
|
57
57
|
# ## Parameters (optional):
|
58
|
-
# - user [Project object]: 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 Transaction objects with updated attributes
|
@@ -71,7 +71,7 @@ module StarkBank
|
|
71
71
|
# - id [string]: object unique id. ex: '5656565656565656'
|
72
72
|
#
|
73
73
|
# ## Parameters (optional):
|
74
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
74
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
75
75
|
#
|
76
76
|
# ## Return:
|
77
77
|
# - Transaction object with updated attributes
|
@@ -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 [Project object
|
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.
|
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
@@ -37,7 +37,7 @@ module StarkBank
|
|
37
37
|
# - id [string]: object unique id. ex: '5656565656565656'
|
38
38
|
#
|
39
39
|
# ## Parameters (optional):
|
40
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
40
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
41
41
|
#
|
42
42
|
# ## Return:
|
43
43
|
# - Log object with updated attributes
|
@@ -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 [Project object
|
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.
|
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,
|