starkbank 2.2.1 → 2.3.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 +1 -1
- data/lib/boleto/boleto.rb +5 -5
- data/lib/boleto/log.rb +2 -2
- data/lib/boleto_holmes/boleto_holmes.rb +3 -3
- data/lib/boleto_holmes/log.rb +2 -2
- data/lib/boleto_payment/boleto_payment.rb +5 -5
- data/lib/boleto_payment/log.rb +2 -2
- data/lib/brcode_payment/brcode_payment.rb +5 -5
- data/lib/brcode_payment/log.rb +2 -2
- data/lib/brcode_preview/brcode_preview.rb +1 -1
- data/lib/deposit/deposit.rb +2 -2
- data/lib/deposit/log.rb +2 -2
- data/lib/dict_key/dict_key.rb +2 -2
- data/lib/event/event.rb +5 -5
- data/lib/invoice/invoice.rb +5 -5
- data/lib/invoice/log.rb +2 -2
- data/lib/payment_request/payment_request.rb +9 -7
- data/lib/starkbank.rb +2 -0
- data/lib/transaction/transaction.rb +3 -3
- data/lib/transfer/log.rb +2 -2
- data/lib/transfer/transfer.rb +5 -5
- data/lib/user/organization.rb +54 -0
- data/lib/user/project.rb +10 -5
- data/lib/user/user.rb +0 -4
- data/lib/utility_payment/log.rb +2 -2
- data/lib/utility_payment/utility_payment.rb +5 -5
- data/lib/utils/request.rb +1 -1
- data/lib/utils/rest.rb +1 -2
- data/lib/webhook/webhook.rb +8 -8
- data/lib/workspace/workspace.rb +92 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbed048429aad2e04ad3226ed8cd597d988bc14763c3e226e577772bd27818cf
|
4
|
+
data.tar.gz: 2045245ba00583edbf1db41f3b2714f1a8d82ccc1e71db8832e45d2265f092ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5bc2d1a572a759437fae2afb50b6a257212d1b8e65134ea431ee3fbc5a1fcac69871c26bf6e53e5beab2b8770ee93a153a790a76c08726242211c81aa4e48e8
|
7
|
+
data.tar.gz: dd18ce715eb83485f5dfadd56f03ad9f08b24d0c2ec27aa21416cfae3e924304cf8a2d7c52b3f40f6e55f0b7b14fab9ff53b91ec5f9083b5d50a43aa15e06285
|
data/lib/balance/balance.rb
CHANGED
@@ -31,7 +31,7 @@ module StarkBank
|
|
31
31
|
# Receive the Balance object linked to your workspace in the Stark Bank API
|
32
32
|
#
|
33
33
|
# ## Parameters (optional):
|
34
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
34
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
35
35
|
#
|
36
36
|
# ## Return:
|
37
37
|
# - Balance object with updated attributes
|
data/lib/boleto/boleto.rb
CHANGED
@@ -82,7 +82,7 @@ module StarkBank
|
|
82
82
|
# - boletos [list of Boleto objects]: list of Boleto objects to be created in the API
|
83
83
|
#
|
84
84
|
# ## Parameters (optional):
|
85
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
85
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
86
86
|
#
|
87
87
|
# ## Return:
|
88
88
|
# - list of Boleto objects with updated attributes
|
@@ -98,7 +98,7 @@ module StarkBank
|
|
98
98
|
# - id [string]: object unique id. ex: '5656565656565656'
|
99
99
|
#
|
100
100
|
# ## Parameters (optional):
|
101
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
101
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
102
102
|
#
|
103
103
|
# ## Return:
|
104
104
|
# - Boleto object with updated attributes
|
@@ -116,7 +116,7 @@ module StarkBank
|
|
116
116
|
# ## Parameters (optional):
|
117
117
|
# - layout [string]: Layout specification. Available options are "default" and "booklet"
|
118
118
|
# - hidden_fields [list of strings, default nil]: List of string fields to be hidden in Boleto pdf. ex: ["customerAddress"]
|
119
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
119
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
120
120
|
#
|
121
121
|
# ## Return:
|
122
122
|
# - Boleto pdf file
|
@@ -135,7 +135,7 @@ module StarkBank
|
|
135
135
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
|
136
136
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
137
137
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
138
|
-
# - user [Project object
|
138
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
139
139
|
#
|
140
140
|
# ## Return:
|
141
141
|
# - generator of Boleto objects with updated attributes
|
@@ -162,7 +162,7 @@ module StarkBank
|
|
162
162
|
# - id [string]: Boleto unique id. ex: '5656565656565656'
|
163
163
|
#
|
164
164
|
# ## Parameters (optional):
|
165
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
165
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
166
166
|
#
|
167
167
|
# ## Return:
|
168
168
|
# - deleted Boleto object
|
data/lib/boleto/log.rb
CHANGED
@@ -38,7 +38,7 @@ module StarkBank
|
|
38
38
|
# - id [string]: object unique id. ex: '5656565656565656'
|
39
39
|
#
|
40
40
|
# ## Parameters (optional):
|
41
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
41
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
42
|
#
|
43
43
|
# ## Return:
|
44
44
|
# - Log object with updated attributes
|
@@ -56,7 +56,7 @@ module StarkBank
|
|
56
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
57
|
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'registered'
|
58
58
|
# - boleto_ids [list of strings, default nil]: list of Boleto ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
59
|
-
# - user [Project object
|
59
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
62
|
# - list of Log objects with updated attributes
|
@@ -45,7 +45,7 @@ module StarkBank
|
|
45
45
|
# - holmes [list of BoletoHolmes objects]: list of BoletoHolmes objects to be created in the API
|
46
46
|
#
|
47
47
|
# ## Parameters (optional):
|
48
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
48
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
49
49
|
#
|
50
50
|
# ## Return:
|
51
51
|
# - list of BoletoHolmes objects with updated attributes
|
@@ -61,7 +61,7 @@ module StarkBank
|
|
61
61
|
# - id [string]: object unique id. ex: '5656565656565656'
|
62
62
|
#
|
63
63
|
# ## Parameters (optional):
|
64
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
64
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
65
65
|
#
|
66
66
|
# ## Return:
|
67
67
|
# - BoletoHolmes object with updated attributes
|
@@ -81,7 +81,7 @@ module StarkBank
|
|
81
81
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
82
82
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
83
83
|
# - boleto_id [string, default nil]: filter for holmes that investigate a specific boleto by its ID. ex: '5656565656565656'
|
84
|
-
# - user [Project object
|
84
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
85
85
|
#
|
86
86
|
# ## Return:
|
87
87
|
# - generator of BoletoHolmes objects with updated attributes
|
data/lib/boleto_holmes/log.rb
CHANGED
@@ -36,7 +36,7 @@ module StarkBank
|
|
36
36
|
# - id [string]: object unique id. ex: '5656565656565656'
|
37
37
|
#
|
38
38
|
# ## Parameters (optional):
|
39
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
39
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
40
40
|
#
|
41
41
|
# ## Return:
|
42
42
|
# - Log object with updated attributes
|
@@ -54,7 +54,7 @@ module StarkBank
|
|
54
54
|
# - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
55
55
|
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'registered'
|
56
56
|
# - holmes_ids [list of strings, default nil]: list of BoletoHolmes ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
57
|
-
# - user [Project object
|
57
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
58
58
|
#
|
59
59
|
# ## Return:
|
60
60
|
# - list of Log objects with updated attributes
|
@@ -53,7 +53,7 @@ module StarkBank
|
|
53
53
|
# - payments [list of BoletoPayment objects]: list of BoletoPayment objects to be created in the API
|
54
54
|
#
|
55
55
|
# ## Parameters (optional):
|
56
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
56
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
57
57
|
#
|
58
58
|
# ## Return:
|
59
59
|
# - list of BoletoPayment objects with updated attributes
|
@@ -69,7 +69,7 @@ module StarkBank
|
|
69
69
|
# - id [string]: object unique id. ex: '5656565656565656'
|
70
70
|
#
|
71
71
|
# ## Parameters (optional):
|
72
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
72
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
73
73
|
#
|
74
74
|
# ## Return:
|
75
75
|
# - BoletoPayment object with updated attributes
|
@@ -86,7 +86,7 @@ module StarkBank
|
|
86
86
|
# - id [string]: object unique id. ex: '5656565656565656'
|
87
87
|
#
|
88
88
|
# ## Parameters (optional):
|
89
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
89
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
90
90
|
#
|
91
91
|
# ## Return:
|
92
92
|
# - BoletoPayment pdf file
|
@@ -105,7 +105,7 @@ module StarkBank
|
|
105
105
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
106
106
|
# - ids [list of strings, default nil]: list of strings to get specific entities by ids. ex: ['12376517623', '1928367198236']
|
107
107
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'paid'
|
108
|
-
# - user [Project object
|
108
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
109
109
|
#
|
110
110
|
# ## Return:
|
111
111
|
# - generator of BoletoPayment objects with updated attributes
|
@@ -131,7 +131,7 @@ module StarkBank
|
|
131
131
|
# Parameters (required):
|
132
132
|
# - id [string]: BoletoPayment unique id. ex: '5656565656565656'
|
133
133
|
# Parameters (optional):
|
134
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
134
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
135
135
|
# Return:
|
136
136
|
# - deleted BoletoPayment object
|
137
137
|
def self.delete(id, user: nil)
|
data/lib/boleto_payment/log.rb
CHANGED
@@ -38,7 +38,7 @@ module StarkBank
|
|
38
38
|
# - id [string]: object unique id. ex: '5656565656565656'
|
39
39
|
#
|
40
40
|
# ## Parameters (optional):
|
41
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
41
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
42
|
#
|
43
43
|
# ## Return:
|
44
44
|
# - Log object with updated attributes
|
@@ -56,7 +56,7 @@ module StarkBank
|
|
56
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
57
|
# - types [list of strings, default nil]: filter retrieved objects by event types. ex: 'success' or 'failed'
|
58
58
|
# - payment_ids [list of strings, default nil]: list of BoletoPayment ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
59
|
-
# - user [Project object
|
59
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
62
|
# - list of Log objects with updated attributes
|
@@ -55,7 +55,7 @@ module StarkBank
|
|
55
55
|
# - payments [list of BrcodePayment objects]: list of BrcodePayment 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 BrcodePayment 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
|
# - BrcodePayment object with updated attributes
|
@@ -87,7 +87,7 @@ module StarkBank
|
|
87
87
|
# - id [string]: object unique id. ex: '5656565656565656'
|
88
88
|
#
|
89
89
|
# ## Parameters (optional):
|
90
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
90
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
91
91
|
#
|
92
92
|
# ## Return:
|
93
93
|
# - BrcodePayment pdf file
|
@@ -104,7 +104,7 @@ module StarkBank
|
|
104
104
|
# - status [string, nil]: You may cancel the payment by passing 'canceled' in the status
|
105
105
|
#
|
106
106
|
# ## Parameters (optional):
|
107
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
107
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
108
108
|
#
|
109
109
|
# ## Return:
|
110
110
|
# - updated BrcodePayment object
|
@@ -123,7 +123,7 @@ module StarkBank
|
|
123
123
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
124
124
|
# - ids [list of strings, default nil]: list of strings to get specific entities by ids. ex: ['12376517623', '1928367198236']
|
125
125
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'paid'
|
126
|
-
# - user [Project object
|
126
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
127
127
|
#
|
128
128
|
# ## Return:
|
129
129
|
# - generator of BrcodePayment objects with updated attributes
|
data/lib/brcode_payment/log.rb
CHANGED
@@ -38,7 +38,7 @@ module StarkBank
|
|
38
38
|
# - id [string]: object unique id. ex: '5656565656565656'
|
39
39
|
#
|
40
40
|
# ## Parameters (optional):
|
41
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
41
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
42
|
#
|
43
43
|
# ## Return:
|
44
44
|
# - Log object with updated attributes
|
@@ -56,7 +56,7 @@ module StarkBank
|
|
56
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
57
|
# - types [list of strings, default nil]: filter retrieved objects by event types. ex: 'success' or 'failed'
|
58
58
|
# - payment_ids [list of strings, default nil]: list of BrcodePayment ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
59
|
-
# - user [Project object
|
59
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
62
|
# - list of Log objects with updated attributes
|
@@ -41,7 +41,7 @@ module StarkBank
|
|
41
41
|
#
|
42
42
|
# ## Parameters (optional):
|
43
43
|
# - brcodes [list of strings]: List of brcodes to preview. ex: %w[00020126580014br.gov.bcb.pix0136a629532e-7693-4846-852d-1bbff817b5a8520400005303986540510.005802BR5908T'Challa6009Sao Paulo62090505123456304B14A]
|
44
|
-
# - user [Project object
|
44
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
45
45
|
#
|
46
46
|
# ## Return:
|
47
47
|
# - generator of BrcodePreview objects with updated attributes
|
data/lib/deposit/deposit.rb
CHANGED
@@ -54,7 +54,7 @@ module StarkBank
|
|
54
54
|
# - id [string]: object unique id. ex: '5656565656565656'
|
55
55
|
#
|
56
56
|
# ## Parameters (optional):
|
57
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
57
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
58
58
|
#
|
59
59
|
# ## Return:
|
60
60
|
# - Deposit object with updated attributes
|
@@ -74,7 +74,7 @@ module StarkBank
|
|
74
74
|
# - sort [string, default '-created']: sort order considered in response. Valid options are 'created' or '-created'.
|
75
75
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
76
76
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
77
|
-
# - user [Project object
|
77
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
78
78
|
#
|
79
79
|
# ## Return:
|
80
80
|
# - generator of Deposit objects with updated attributes
|
data/lib/deposit/log.rb
CHANGED
@@ -38,7 +38,7 @@ module StarkBank
|
|
38
38
|
# - id [string]: object unique id. ex: '5656565656565656'
|
39
39
|
#
|
40
40
|
# ## Parameters (optional):
|
41
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
41
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
42
|
#
|
43
43
|
# ## Return:
|
44
44
|
# - Log object with updated attributes
|
@@ -56,7 +56,7 @@ module StarkBank
|
|
56
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
57
|
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'canceled'
|
58
58
|
# - deposit_ids [list of strings, default nil]: list of Deposit ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
59
|
-
# - user [Project object
|
59
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
62
|
# - list of Log objects with updated attributes
|
data/lib/dict_key/dict_key.rb
CHANGED
@@ -54,7 +54,7 @@ module StarkBank
|
|
54
54
|
# - id [string]: DictKey object unique id and PIX key itself. ex: 'tony@starkbank.com', '722.461.430-04', '20.018.183/0001-80', '+5511988887777', 'b6295ee1-f054-47d1-9e90-ee57b74f60d9'
|
55
55
|
#
|
56
56
|
# ## Parameters (optional):
|
57
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
57
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
58
58
|
#
|
59
59
|
# ## Return:
|
60
60
|
# - DictKey object with updated attributes
|
@@ -73,7 +73,7 @@ module StarkBank
|
|
73
73
|
# - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
74
74
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
75
75
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'canceled', 'registered'
|
76
|
-
# - user [Project object
|
76
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
77
77
|
#
|
78
78
|
# ## Return:
|
79
79
|
# - generator of DitcKey objects with updated attributes
|
data/lib/event/event.rb
CHANGED
@@ -60,7 +60,7 @@ module StarkBank
|
|
60
60
|
# - id [string]: object unique id. ex: '5656565656565656'
|
61
61
|
#
|
62
62
|
# ## Parameters (optional):
|
63
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
63
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
64
64
|
#
|
65
65
|
# ## Return:
|
66
66
|
# - Event object with updated attributes
|
@@ -77,7 +77,7 @@ module StarkBank
|
|
77
77
|
# - after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
78
78
|
# - before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
79
79
|
# - is_delivered [bool, default nil]: bool to filter successfully delivered events. ex: True or False
|
80
|
-
# - user [Project object
|
80
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
81
81
|
#
|
82
82
|
# ## Return:
|
83
83
|
# - generator of Event objects with updated attributes
|
@@ -102,7 +102,7 @@ module StarkBank
|
|
102
102
|
# - id [string]: Event unique id. ex: '5656565656565656'
|
103
103
|
#
|
104
104
|
# ## Parameters (optional):
|
105
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
105
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
106
106
|
#
|
107
107
|
# ## Return:
|
108
108
|
# - deleted Event object
|
@@ -120,7 +120,7 @@ module StarkBank
|
|
120
120
|
# - is_delivered [bool]: If True and event hasn't been delivered already, event will be set as delivered. ex: True
|
121
121
|
#
|
122
122
|
# ## Parameters (optional):
|
123
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
123
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
124
124
|
#
|
125
125
|
# ## Return:
|
126
126
|
# - target Event with updated attributes
|
@@ -139,7 +139,7 @@ module StarkBank
|
|
139
139
|
# - signature [string]: base-64 digital signature received at response header 'Digital-Signature'
|
140
140
|
#
|
141
141
|
# ## Parameters (optional):
|
142
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
142
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
143
143
|
#
|
144
144
|
# ## Return:
|
145
145
|
# - Parsed Event object
|
data/lib/invoice/invoice.rb
CHANGED
@@ -73,7 +73,7 @@ module StarkBank
|
|
73
73
|
# - invoices [list of Invoice objects]: list of Invoice objects to be created in the API
|
74
74
|
#
|
75
75
|
# ## Parameters (optional):
|
76
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
76
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
77
77
|
#
|
78
78
|
# ## Return:
|
79
79
|
# - list of Invoice objects with updated attributes
|
@@ -89,7 +89,7 @@ module StarkBank
|
|
89
89
|
# - id [string]: object unique id. ex: '5656565656565656'
|
90
90
|
#
|
91
91
|
# ## Parameters (optional):
|
92
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
92
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
93
93
|
#
|
94
94
|
# ## Return:
|
95
95
|
# - Invoice object with updated attributes
|
@@ -105,7 +105,7 @@ module StarkBank
|
|
105
105
|
# - id [string]: object unique id. ex: '5656565656565656'
|
106
106
|
#
|
107
107
|
# ## Parameters (optional):
|
108
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
108
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
109
109
|
#
|
110
110
|
# ## Return:
|
111
111
|
# - Invoice pdf file
|
@@ -121,7 +121,7 @@ module StarkBank
|
|
121
121
|
# - id [string]: object unique id. ex: '5656565656565656'
|
122
122
|
#
|
123
123
|
# ## Parameters (optional):
|
124
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
124
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
125
125
|
#
|
126
126
|
# ## Return:
|
127
127
|
# - Invoice QR Code png blob
|
@@ -140,7 +140,7 @@ module StarkBank
|
|
140
140
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'
|
141
141
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
142
142
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
143
|
-
# - user [Project object
|
143
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
144
144
|
#
|
145
145
|
# ## Return:
|
146
146
|
# - generator of Invoice objects with updated attributes
|
data/lib/invoice/log.rb
CHANGED
@@ -38,7 +38,7 @@ module StarkBank
|
|
38
38
|
# - id [string]: object unique id. ex: '5656565656565656'
|
39
39
|
#
|
40
40
|
# ## Parameters (optional):
|
41
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
41
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
42
42
|
#
|
43
43
|
# ## Return:
|
44
44
|
# - Log object with updated attributes
|
@@ -56,7 +56,7 @@ module StarkBank
|
|
56
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
57
|
# - types [list of strings, default nil]: filter for log event types. ex: 'paid' or 'canceled'
|
58
58
|
# - invoice_ids [list of strings, default nil]: list of Invoice ids to filter logs. ex: ['5656565656565656', '4545454545454545']
|
59
|
-
# - user [Project object
|
59
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
60
60
|
#
|
61
61
|
# ## Return:
|
62
62
|
# - list of Log objects with updated attributes
|
@@ -7,17 +7,17 @@ require_relative('../utils/checks')
|
|
7
7
|
module StarkBank
|
8
8
|
# # PaymentRequest object
|
9
9
|
# A PaymentRequest is an indirect request to access a specific cash-out service
|
10
|
-
# (such as Transfer,
|
10
|
+
# (such as Transfer, BrcodePayments, etc.) which goes through the cost center
|
11
11
|
# approval flow on our website. To emit a PaymentRequest, you must direct it to
|
12
12
|
# a specific cost center by its ID, which can be retrieved on our website at the
|
13
13
|
# cost center page.
|
14
14
|
#
|
15
15
|
# ## Parameters (required):
|
16
16
|
# - center_id [String]: target cost center ID. ex: '5656565656565656'
|
17
|
-
# - payment [Transfer, BoletoPayment, UtilityPayment, Transaction or dictionary]: payment entity that should be approved and executed.
|
17
|
+
# - payment [Transfer, BrcodePayment, BoletoPayment, UtilityPayment, Transaction or dictionary]: payment entity that should be approved and executed.
|
18
18
|
#
|
19
19
|
# ## Parameters (optional):
|
20
|
-
# - type [String]: payment type, inferred from the payment parameter if it is not a dictionary. ex: 'transfer', '
|
20
|
+
# - type [String]: payment type, inferred from the payment parameter if it is not a dictionary. ex: 'transfer', 'brcode-payment'
|
21
21
|
# - due [Date, DateTime, Time or string]: Payment target date in ISO format. ex: 2020-12-31
|
22
22
|
# - tags [list of strings]: list of strings for tagging
|
23
23
|
#
|
@@ -53,7 +53,7 @@ module StarkBank
|
|
53
53
|
#
|
54
54
|
# ## Parameters
|
55
55
|
# - payment_requests [list of PaymentRequest objects]: list of PaymentRequest objects to be created in the API
|
56
|
-
# - user [Project object]: Project object. Not necessary if
|
56
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
57
57
|
#
|
58
58
|
# ## Return
|
59
59
|
# - list of PaymentRequest objects with updated attributes
|
@@ -73,11 +73,11 @@ module StarkBank
|
|
73
73
|
# - after [Date , DateTime, Time or string, default nil] date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
|
74
74
|
# - before [Date, DateTime, Time or string, default nil] date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)
|
75
75
|
# - status [string, default '-created']: sort order considered in response. Valid options are '-created' or '-due'.
|
76
|
-
# - type [string, default nil]: payment type, inferred from the payment parameter if it is not a dictionary. ex: 'transfer', '
|
76
|
+
# - type [string, default nil]: payment type, inferred from the payment parameter if it is not a dictionary. ex: 'transfer', 'brcode-payment'
|
77
77
|
# - sort [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
78
78
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
79
79
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
80
|
-
# - user [Project object
|
80
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
81
81
|
#
|
82
82
|
# ## Return:
|
83
83
|
# - generator of PaymentRequest objects with updated attributes
|
@@ -102,14 +102,16 @@ module StarkBank
|
|
102
102
|
def parse_payment(payment:, type:)
|
103
103
|
return [payment, 'transfer'] if payment.is_a?(StarkBank::Transfer)
|
104
104
|
return [payment, 'transaction'] if payment.is_a?(StarkBank::Transaction)
|
105
|
+
return [payment, 'brcode-payment'] if payment.is_a?(StarkBank::BrcodePayment)
|
105
106
|
return [payment, 'boleto-payment'] if payment.is_a?(StarkBank::BoletoPayment)
|
106
107
|
return [payment, 'utility-payment'] if payment.is_a?(StarkBank::UtilityPayment)
|
107
108
|
|
108
|
-
raise(Exception('Payment must either be a Transfer, a Transaction, a BoletoPayment, a UtilityPayment or a hash.')) unless payment.is_a?(Hash)
|
109
|
+
raise(Exception('Payment must either be a Transfer, a Transaction, a BrcodePayment, BoletoPayment, a UtilityPayment or a hash.')) unless payment.is_a?(Hash)
|
109
110
|
|
110
111
|
resource = {
|
111
112
|
'transfer': StarkBank::Transfer.resource,
|
112
113
|
'transaction': StarkBank::Transaction.resource,
|
114
|
+
'brcode-payment': StarkBank::BrcodePayment.resource,
|
113
115
|
'boleto-payment': StarkBank::BoletoPayment.resource,
|
114
116
|
'utility-payment': StarkBank::UtilityPayment.resource
|
115
117
|
}[type.to_sym]
|
data/lib/starkbank.rb
CHANGED
@@ -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
|
@@ -90,7 +90,7 @@ module StarkBank
|
|
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
|
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
|
@@ -55,7 +55,7 @@ module StarkBank
|
|
55
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
|
data/lib/transfer/transfer.rb
CHANGED
@@ -57,7 +57,7 @@ module StarkBank
|
|
57
57
|
# - transfers [list of Transfer objects]: list of Transfer objects to be created in the API
|
58
58
|
#
|
59
59
|
# ## Parameters (optional):
|
60
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
60
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
61
61
|
#
|
62
62
|
# ## Return:
|
63
63
|
# - list of Transfer objects with updated attributes
|
@@ -73,7 +73,7 @@ module StarkBank
|
|
73
73
|
# - id [string]: object unique id. ex: '5656565656565656'
|
74
74
|
#
|
75
75
|
# ## Parameters (optional):
|
76
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
76
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
77
77
|
#
|
78
78
|
# ## Return:
|
79
79
|
# - Transfer object with updated attributes
|
@@ -89,7 +89,7 @@ module StarkBank
|
|
89
89
|
# - id [string]: Transfer unique id. ex: '5656565656565656'
|
90
90
|
#
|
91
91
|
# ## Parameters (optional):
|
92
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
92
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
93
93
|
#
|
94
94
|
# ## Return:
|
95
95
|
# - deleted Transfer object
|
@@ -106,7 +106,7 @@ module StarkBank
|
|
106
106
|
# - id [string]: object unique id. ex: '5656565656565656'
|
107
107
|
#
|
108
108
|
# ## Parameters (optional):
|
109
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
109
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
110
110
|
#
|
111
111
|
# ## Return:
|
112
112
|
# - Transfer pdf file
|
@@ -127,7 +127,7 @@ module StarkBank
|
|
127
127
|
# - tax_id [string, default nil]: filter for transfers sent to the specified tax ID. ex: "012.345.678-90"
|
128
128
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
129
129
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
130
|
-
# - user [Project object
|
130
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
131
131
|
#
|
132
132
|
# ## Return:
|
133
133
|
# - generator of Transfer objects with updated attributes
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative('user')
|
4
|
+
|
5
|
+
module StarkBank
|
6
|
+
# # Organization object
|
7
|
+
# The Organization object is an authentication entity for the SDK that
|
8
|
+
# represents your entire Organization, being able to access any Workspace
|
9
|
+
# underneath it and even create new Workspaces. Only a legal representative
|
10
|
+
# of your organization can register or change the Organization credentials.
|
11
|
+
# All requests to the Stark Bank API must be authenticated via an SDK user,
|
12
|
+
# which must have been previously created at the Stark Bank website
|
13
|
+
# [https://sandbox.web.starkbank.com] or [https://web.starkbank.com]
|
14
|
+
# before you can use it in this SDK. Organizations may be passed as the user parameter on
|
15
|
+
# each request or may be defined as the default user at the start (See README).
|
16
|
+
# If you are accessing a specific Workspace using Organization credentials, you should
|
17
|
+
# specify the workspace ID when building the Organization object or by request, using
|
18
|
+
# the Organization.replace(organization, workspace_id) method, which creates a copy of the organization
|
19
|
+
# object with the altered workspace ID. If you are listing or creating new Workspaces, the
|
20
|
+
# workspace_id should be nil.
|
21
|
+
#
|
22
|
+
# ## Parameters (required):
|
23
|
+
# - environment [string]: environment where the organization is being used. ex: 'sandbox' or 'production'
|
24
|
+
# - id [string]: unique id required to identify organization. ex: '5656565656565656'
|
25
|
+
# - private_key [string]: PEM string of the private key linked to the organization. ex: '-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----'
|
26
|
+
# - workspace_id [string]: unique id of the accessed Workspace, if any. ex: nil or '4848484848484848'
|
27
|
+
#
|
28
|
+
# ## Attributes (return-only):
|
29
|
+
# - pem [string]: private key in pem format. ex: '-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----'
|
30
|
+
class Organization < StarkBank::User
|
31
|
+
attr_reader :workspace_id
|
32
|
+
def initialize(id:, environment:, private_key:, workspace_id: nil)
|
33
|
+
super(environment, id, private_key)
|
34
|
+
@workspace_id = workspace_id
|
35
|
+
end
|
36
|
+
|
37
|
+
def access_id
|
38
|
+
if @workspace_id
|
39
|
+
"organization/#{@id}/workspace/#{@workspace_id}"
|
40
|
+
else
|
41
|
+
"organization/#{@id}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.replace(organization, workspace_id)
|
46
|
+
Organization.new(
|
47
|
+
environment: organization.environment,
|
48
|
+
id: organization.id,
|
49
|
+
private_key: organization.pem,
|
50
|
+
workspace_id: workspace_id
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/user/project.rb
CHANGED
@@ -5,20 +5,21 @@ require_relative('user')
|
|
5
5
|
module StarkBank
|
6
6
|
# # Project object
|
7
7
|
#
|
8
|
-
# The Project object is
|
9
|
-
#
|
8
|
+
# The Project object is an authentication entity for the SDK that is permanently
|
9
|
+
# linked to a specific Workspace.
|
10
|
+
# All requests to the Stark Bank API must be authenticated via an SDK user,
|
10
11
|
# which must have been previously created at the Stark Bank website
|
11
12
|
# [https://sandbox.web.starkbank.com] or [https://web.starkbank.com]
|
12
|
-
# before you can use it in this SDK. Projects may be passed as
|
13
|
+
# before you can use it in this SDK. Projects may be passed as the user parameter on
|
13
14
|
# each request or may be defined as the default user at the start (See README).
|
14
15
|
#
|
15
16
|
# ## Parameters (required):
|
16
17
|
# - id [string]: unique id required to identify project. ex: '5656565656565656'
|
17
|
-
# - private_key [
|
18
|
+
# - private_key [string]: PEM string of the private key linked to the project. ex: '-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----'
|
18
19
|
# - environment [string]: environment where the project is being used. ex: 'sandbox' or 'production'
|
19
20
|
#
|
20
21
|
# ## Attributes (return-only):
|
21
|
-
# - name [string, default ']: project name. ex: 'MyProject'
|
22
|
+
# - name [string, default '']: project name. ex: 'MyProject'
|
22
23
|
# - allowed_ips [list of strings]: list containing the strings of the ips allowed to make requests on behalf of this project. ex: ['190.190.0.50']
|
23
24
|
# - pem [string]: private key in pem format. ex: '-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEyTIHK6jYuik6ktM9FIF3yCEYzpLjO5X/\ntqDioGM+R2RyW0QEo+1DG8BrUf4UXHSvCjtQ0yLppygz23z0yPZYfw==\n-----END PUBLIC KEY-----'
|
24
25
|
class Project < StarkBank::User
|
@@ -28,5 +29,9 @@ module StarkBank
|
|
28
29
|
@name = name
|
29
30
|
@allowed_ips = allowed_ips
|
30
31
|
end
|
32
|
+
|
33
|
+
def access_id
|
34
|
+
"project/#{@id}"
|
35
|
+
end
|
31
36
|
end
|
32
37
|
end
|
data/lib/user/user.rb
CHANGED
data/lib/utility_payment/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
|
@@ -55,7 +55,7 @@ module StarkBank
|
|
55
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 [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
|
@@ -51,7 +51,7 @@ module StarkBank
|
|
51
51
|
# - payments [list of UtilityPayment objects]: list of UtilityPayment objects to be created in the API
|
52
52
|
#
|
53
53
|
# ## Parameters (optional):
|
54
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
54
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
55
55
|
#
|
56
56
|
# ## Return:
|
57
57
|
# - list of UtilityPayment objects with updated attributes
|
@@ -67,7 +67,7 @@ module StarkBank
|
|
67
67
|
# - id [string]: object unique id. ex: '5656565656565656'
|
68
68
|
#
|
69
69
|
# ## Parameters (optional):
|
70
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
70
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
71
71
|
#
|
72
72
|
# ## Return:
|
73
73
|
# - UtilityPayment object with updated attributes
|
@@ -84,7 +84,7 @@ module StarkBank
|
|
84
84
|
# - id [string]: object unique id. ex: '5656565656565656'
|
85
85
|
#
|
86
86
|
# ## Parameters (optional):
|
87
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
87
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
88
88
|
#
|
89
89
|
# ## Return:
|
90
90
|
# - UtilityPayment pdf file
|
@@ -103,7 +103,7 @@ module StarkBank
|
|
103
103
|
# - tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']
|
104
104
|
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
105
105
|
# - status [string, default nil]: filter for status of retrieved objects. ex: 'paid'
|
106
|
-
# - user [Project object
|
106
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
107
107
|
#
|
108
108
|
# ## Return:
|
109
109
|
# - generator of UtilityPayment objects with updated attributes
|
@@ -130,7 +130,7 @@ module StarkBank
|
|
130
130
|
# - id [string]: UtilityPayment unique id. ex:'5656565656565656'
|
131
131
|
#
|
132
132
|
# ## Parameters (optional):
|
133
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
133
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
134
134
|
#
|
135
135
|
# ## Return:
|
136
136
|
# - deleted UtilityPayment object
|
data/lib/utils/request.rb
CHANGED
@@ -61,7 +61,7 @@ module StarkBank
|
|
61
61
|
req['Access-Time'] = access_time
|
62
62
|
req['Access-Signature'] = signature
|
63
63
|
req['Content-Type'] = 'application/json'
|
64
|
-
req['User-Agent'] = "Ruby-#{RUBY_VERSION}-SDK-2.
|
64
|
+
req['User-Agent'] = "Ruby-#{RUBY_VERSION}-SDK-2.3.0"
|
65
65
|
req['Accept-Language'] = language
|
66
66
|
|
67
67
|
request = Net::HTTP.start(uri.hostname, use_ssl: true) { |http| http.request(req) }
|
data/lib/utils/rest.rb
CHANGED
data/lib/webhook/webhook.rb
CHANGED
@@ -8,12 +8,12 @@ module StarkBank
|
|
8
8
|
# # Webhook subscription object
|
9
9
|
#
|
10
10
|
# A Webhook is used to subscribe to notification events on a user-selected endpoint.
|
11
|
-
# Currently available services for subscription are transfer,
|
12
|
-
# and utility-payment
|
11
|
+
# Currently available services for subscription are transfer, invoice, deposit, brcode-payment,
|
12
|
+
# boleto, boleto-payment and utility-payment
|
13
13
|
#
|
14
14
|
# ## Parameters (required):
|
15
15
|
# - url [string]: Url that will be notified when an event occurs.
|
16
|
-
# - subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ['transfer', '
|
16
|
+
# - subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ['transfer', 'deposit']
|
17
17
|
#
|
18
18
|
# ## Attributes:
|
19
19
|
# - id [string, default nil]: unique id returned when the webhook is created. ex: '5656565656565656'
|
@@ -31,10 +31,10 @@ module StarkBank
|
|
31
31
|
#
|
32
32
|
# ## Parameters (required):
|
33
33
|
# - url [string]: url to which notification events will be sent to. ex: 'https://webhook.site/60e9c18e-4b5c-4369-bda1-ab5fcd8e1b29'
|
34
|
-
# - subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ['transfer', '
|
34
|
+
# - subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ['transfer', 'invoice']
|
35
35
|
#
|
36
36
|
# ## Parameters (optional):
|
37
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
37
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
38
38
|
#
|
39
39
|
# ## Return:
|
40
40
|
# - Webhook object with updated attributes
|
@@ -50,7 +50,7 @@ module StarkBank
|
|
50
50
|
# - id [string]: object unique id. ex: '5656565656565656'
|
51
51
|
#
|
52
52
|
# ## Parameters (optional):
|
53
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
53
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
54
54
|
#
|
55
55
|
# ## Return:
|
56
56
|
# - Webhook object with updated attributes
|
@@ -64,7 +64,7 @@ module StarkBank
|
|
64
64
|
#
|
65
65
|
# ## Parameters (optional):
|
66
66
|
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
67
|
-
# - user [Project object
|
67
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
68
68
|
#
|
69
69
|
# ## Return:
|
70
70
|
# - generator of Webhook objects with updated attributes
|
@@ -80,7 +80,7 @@ module StarkBank
|
|
80
80
|
# - id [string]: Webhook unique id. ex: '5656565656565656'
|
81
81
|
#
|
82
82
|
# ## Parameters (optional):
|
83
|
-
# - user [Project object]: Project object. Not necessary if StarkBank.user was set before function call
|
83
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call
|
84
84
|
#
|
85
85
|
# ## Return:
|
86
86
|
# - deleted Webhook object
|
@@ -0,0 +1,92 @@
|
|
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
|
+
# # Workspace object
|
9
|
+
#
|
10
|
+
# Workspaces are bank accounts. They have independent balances, statements, operations and permissions.
|
11
|
+
# The only property that is shared between your workspaces is that they are linked to your organization,
|
12
|
+
# which carries your basic informations, such as tax ID, name, etc..
|
13
|
+
#
|
14
|
+
# ## Parameters (required):
|
15
|
+
# - username [string]: Simplified name to define the workspace URL. This name must be unique across all Stark Bank Workspaces. Ex: 'starkbankworkspace'
|
16
|
+
# - name [string]: Full name that identifies the Workspace. This name will appear when people access the Workspace on our platform, for example. Ex: 'Stark Bank Workspace'
|
17
|
+
#
|
18
|
+
# ## Attributes:
|
19
|
+
# - id [string, default nil]: unique id returned when the workspace is created. ex: '5656565656565656'
|
20
|
+
class Workspace < StarkBank::Utils::Resource
|
21
|
+
attr_reader :username, :name, :id
|
22
|
+
def initialize(username:, name:, id: nil)
|
23
|
+
super(id)
|
24
|
+
@username = username
|
25
|
+
@name = name
|
26
|
+
end
|
27
|
+
|
28
|
+
# # Create Workspace
|
29
|
+
#
|
30
|
+
# Send a Workspace for creation in the Stark Bank API
|
31
|
+
#
|
32
|
+
# ## Parameters (required):
|
33
|
+
# - username [string]: Simplified name to define the workspace URL. This name must be unique across all Stark Bank Workspaces. Ex: 'starkbankworkspace'
|
34
|
+
# - name [string]: Full name that identifies the Workspace. This name will appear when people access the Workspace on our platform, for example. Ex: 'Stark Bank Workspace'
|
35
|
+
#
|
36
|
+
# ## Parameters (optional):
|
37
|
+
# - user [Organization object]: Organization object. Not necessary if StarkBank.user was set before function call
|
38
|
+
#
|
39
|
+
# ## Return:
|
40
|
+
# - Workspace object with updated attributes
|
41
|
+
def self.create(username:, name:, user: nil)
|
42
|
+
StarkBank::Utils::Rest.post_single(entity: Workspace.new(username: username, name: name), user: user, **resource)
|
43
|
+
end
|
44
|
+
|
45
|
+
# # Retrieve a specific Workspace
|
46
|
+
#
|
47
|
+
# Receive a single Workspace object previously created in the Stark Bank API by passing its id
|
48
|
+
#
|
49
|
+
# ## Parameters (required):
|
50
|
+
# - id [string]: object unique id. ex: '5656565656565656'
|
51
|
+
#
|
52
|
+
# ## Parameters (optional):
|
53
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
54
|
+
#
|
55
|
+
# ## Return:
|
56
|
+
# - Workspace object with updated attributes
|
57
|
+
def self.get(id, user: nil)
|
58
|
+
StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
|
59
|
+
end
|
60
|
+
|
61
|
+
# # Retrieve Workspaces
|
62
|
+
#
|
63
|
+
# Receive a generator of Workspace objects previously created in the Stark Bank API.
|
64
|
+
# If no filters are passed and the user is an Organization, all of the Organization Workspaces
|
65
|
+
# will be retrieved.
|
66
|
+
#
|
67
|
+
# ## Parameters (optional):
|
68
|
+
# - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
|
69
|
+
# - username [string]: query by the simplified name that defines the workspace URL. This name is always unique across all Stark Bank Workspaces. Ex: 'starkbankworkspace'
|
70
|
+
# - ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']
|
71
|
+
# - user [Organization/Project object]: Organization or Project object. Not necessary if Starkbank.user was set before function call
|
72
|
+
#
|
73
|
+
# ## Return:
|
74
|
+
# - generator of Workspace objects with updated attributes
|
75
|
+
def self.query(limit: nil, username: nil, ids: nil, user: nil)
|
76
|
+
StarkBank::Utils::Rest.get_list(limit: limit, username: username, ids: ids, user: user, **resource)
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.resource
|
80
|
+
{
|
81
|
+
resource_name: 'Workspace',
|
82
|
+
resource_maker: proc { |json|
|
83
|
+
Workspace.new(
|
84
|
+
id: json['id'],
|
85
|
+
username: json['username'],
|
86
|
+
name: json['name']
|
87
|
+
)
|
88
|
+
}
|
89
|
+
}
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: starkbank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- starkbank
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/transaction/transaction.rb
|
96
96
|
- lib/transfer/log.rb
|
97
97
|
- lib/transfer/transfer.rb
|
98
|
+
- lib/user/organization.rb
|
98
99
|
- lib/user/project.rb
|
99
100
|
- lib/user/user.rb
|
100
101
|
- lib/utility_payment/log.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- lib/utils/rest.rb
|
110
111
|
- lib/utils/url.rb
|
111
112
|
- lib/webhook/webhook.rb
|
113
|
+
- lib/workspace/workspace.rb
|
112
114
|
homepage: https://github.com/starkbank/sdk-ruby
|
113
115
|
licenses:
|
114
116
|
- MIT
|