cobrato-client 0.23.0.beta1 → 0.23.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +66 -53
- data/lib/cobrato.rb +2 -0
- data/lib/cobrato/client.rb +4 -0
- data/lib/cobrato/entities/payment.rb +23 -0
- data/lib/cobrato/entities/remittance_cnab.rb +7 -1
- data/lib/cobrato/resources/base.rb +6 -0
- data/lib/cobrato/resources/payment.rb +7 -0
- data/lib/cobrato/resources/remittance_cnab.rb +13 -0
- data/lib/cobrato/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3332c2210e9647bbf533b15b7b70ac101fc7006f
|
4
|
+
data.tar.gz: 24e0355957b7f6c31d0a26f818a7b49ff1a633db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a71c48324a9a4f3e024e6fe29ade670f11ef905174d85eee6705c72f8a4458c9dc2915dc33b5dfc0d96a03904f5a8eb367f6dd5526aada18084b1d28af89a5d0
|
7
|
+
data.tar.gz: eb9b0d82304d0629ed7e22ffa4548f7ef6c1fdd1695931168c10812a214d53c438cb3fc172e90517dfe8157e6654542cb299bd76297894ee588c9f270657b4f1
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## Next version
|
4
4
|
|
5
|
+
## v0.23.0.beta2
|
6
|
+
|
7
|
+
- Add Payment API support.
|
8
|
+
- Add changes on RemittanceCnab API:
|
9
|
+
- `remittance_cnabs#charges` is now DEPRECATED. Use `remittance_cnabs#items` instead.
|
10
|
+
- The use of `charge_config_ids` and `charge_ids` for RemittanceCnab creation is now DEPRECATED. Use `config_ids` and `item_ids` instead.
|
11
|
+
- `RemittanceCnab#charge_config_id` is DEPRECATED. Use `RemittanceCnab#config_id` instead.
|
12
|
+
|
5
13
|
## v0.23.0.beta1
|
6
14
|
|
7
15
|
- Add PaymentConfig API suppport
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -50,38 +50,40 @@ client = Cobrato.client("YOUR_TOKEN_HERE")
|
|
50
50
|
|
51
51
|
Now you have acess to every API endpoint:
|
52
52
|
|
53
|
-
* [Payees API](http://docs.cobrato.com/#
|
54
|
-
* [Bank Accounts API](http://docs.cobrato.com/#conta-
|
53
|
+
* [Payees API](http://docs.cobrato.com/#benefici-rio)
|
54
|
+
* [Bank Accounts API](http://docs.cobrato.com/#conta-banc-ria)
|
55
55
|
* [Payers API](http://docs.cobrato.com/#pagador)
|
56
|
-
* [Charge Configs API](http://docs.cobrato.com/#
|
57
|
-
* [Charges API](http://docs.cobrato.com/#
|
56
|
+
* [Charge Configs API](http://docs.cobrato.com/#configura-o-de-cobran-a)
|
57
|
+
* [Charges API](http://docs.cobrato.com/#cobran-a)
|
58
58
|
* [Regress Cnab](http://docs.cobrato.com/#cnab-de-retorno)
|
59
59
|
* [Remittance Cnab](http://docs.cobrato.com/#cnab-de-remessa)
|
60
60
|
* [CreditCards API](http://docs.cobrato.com/#cart-o-de-cr-dito)
|
61
61
|
* [Webhooks API](http://docs.cobrato.com/#webhook)
|
62
|
+
* [Payment Config](http://docs.cobrato.com/#configura-o-de-pagamento) **(BETA)**
|
63
|
+
* [Payment](http://docs.cobrato.com/#pagamento) **(BETA)**
|
62
64
|
|
63
65
|
## Endpoints
|
64
66
|
|
65
|
-
#### [Payees](http://docs.cobrato.com/#
|
67
|
+
#### [Payees](http://docs.cobrato.com/#benefici-rio)
|
66
68
|
|
67
69
|
| HTTP method | Endpoint | Client method |
|
68
70
|
| ----------- | ------------------------------------------------------------------------- | --------------------- |
|
69
|
-
| POST | [api/v1/payees](http://docs.cobrato.com/#
|
70
|
-
| GET | [api/v1/payees](http://docs.cobrato.com/#lista-de-todos-os-
|
71
|
-
| GET | [api/v1/payees/:id](http://docs.cobrato.com/#
|
72
|
-
| PUT | [api/v1/payees/:id](http://docs.cobrato.com/#
|
73
|
-
| DELETE | [api/v1/payees/:id](http://docs.cobrato.com/#
|
71
|
+
| POST | [api/v1/payees](http://docs.cobrato.com/#cria-o-de-benefici-rio) | client.payees.create |
|
72
|
+
| GET | [api/v1/payees](http://docs.cobrato.com/#lista-de-todos-os-benefici-rios) | client.payees.list |
|
73
|
+
| GET | [api/v1/payees/:id](http://docs.cobrato.com/#informa-es-do-benefici-rio) | client.payees.show |
|
74
|
+
| PUT | [api/v1/payees/:id](http://docs.cobrato.com/#atualiza-o-de-benefici-rio) | client.payees.update |
|
75
|
+
| DELETE | [api/v1/payees/:id](http://docs.cobrato.com/#exclus-o-de-benefici-rio) | client.payees.destroy |
|
74
76
|
|
75
|
-
#### [Bank Accounts](http://docs.cobrato.com/#conta-
|
77
|
+
#### [Bank Accounts](http://docs.cobrato.com/#conta-banc-ria)
|
76
78
|
|
77
79
|
| HTTP method | Endpoint | Client method |
|
78
80
|
| ----------- | -------------------------------------------------------------------------------------- | ------------------------------------ |
|
79
|
-
| POST | [api/v1/bank_accounts](http://docs.cobrato.com/#
|
80
|
-
| GET | [api/v1/bank_accounts](http://docs.cobrato.com/#lista-de-todas-as-contas-
|
81
|
-
| GET | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#
|
82
|
-
| PUT | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#
|
83
|
-
| DELETE | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#
|
84
|
-
| GET | [api/v1/bank_accounts/portfolio_codes](http://docs.cobrato.com/#carteiras-
|
81
|
+
| POST | [api/v1/bank_accounts](http://docs.cobrato.com/#cria-o-de-conta-banc-ria) | client.bank_accounts.create |
|
82
|
+
| GET | [api/v1/bank_accounts](http://docs.cobrato.com/#lista-de-todas-as-contas-banc-rias) | client.bank_accounts.list |
|
83
|
+
| GET | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#informa-es-da-conta-banc-ria) | client.bank_accounts.show |
|
84
|
+
| PUT | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#atualiza-o-de-conta-banc-ria) | client.bank_accounts.update |
|
85
|
+
| DELETE | [api/v1/bank_accounts/:id](http://docs.cobrato.com/#exclus-o-de-conta-banc-ria) | client.bank_accounts.destroy |
|
86
|
+
| GET | [api/v1/bank_accounts/portfolio_codes](http://docs.cobrato.com/#carteiras-dispon-veis) | client.bank_accounts.portfolio_codes |
|
85
87
|
|
86
88
|
#### [Payers](http://docs.cobrato.com/#pagador)
|
87
89
|
|
@@ -92,51 +94,52 @@ Now you have acess to every API endpoint:
|
|
92
94
|
| GET | [api/v1/payers/:id](http://docs.cobrato.com/#informa-es-do-pagador) | client.payers.show |
|
93
95
|
| PUT | [api/v1/payers/:id](http://docs.cobrato.com/#atualiza-o-de-pagador) | client.payers.update |
|
94
96
|
|
95
|
-
#### [Charge Configs](http://docs.cobrato.com/#
|
97
|
+
#### [Charge Configs](http://docs.cobrato.com/#configura-o-de-cobran-a)
|
96
98
|
|
97
|
-
| HTTP method | Endpoint
|
98
|
-
| ----------- |
|
99
|
-
| POST | [api/v1/charge_configs](http://docs.cobrato.com/#
|
100
|
-
| GET | [api/v1/charge_configs](http://docs.cobrato.com/#lista-de-todas-as-
|
101
|
-
| GET | [api/v1/charge_configs/:id](http://docs.cobrato.com/#
|
102
|
-
| PUT | [api/v1/charge_configs/:id](http://docs.cobrato.com/#
|
103
|
-
| DELETE | [api/v1/charge_configs/:id](http://docs.cobrato.com/#
|
99
|
+
| HTTP method | Endpoint | Client method |
|
100
|
+
| ----------- | -------------------------------------------------------------------------------------------- | ------------------------------ |
|
101
|
+
| POST | [api/v1/charge_configs](http://docs.cobrato.com/#cria-o-de-configura-o-de-cobran-a) | client.charge_configs.create |
|
102
|
+
| GET | [api/v1/charge_configs](http://docs.cobrato.com/#lista-de-todas-as-configura-es-de-cobran-a) | client.charge_configs.list |
|
103
|
+
| GET | [api/v1/charge_configs/:id](http://docs.cobrato.com/#informa-es-de-configura-o-de-cobran-a) | client.charge_configs.show |
|
104
|
+
| PUT | [api/v1/charge_configs/:id](http://docs.cobrato.com/#atualiza-o-de-configura-o-de-cobran-a) | client.charge_configs.update |
|
105
|
+
| DELETE | [api/v1/charge_configs/:id](http://docs.cobrato.com/#exclus-o-de-configura-o-de-cobran-a) | client.charge_configs.destroy |
|
104
106
|
|
105
|
-
#### [Charges](http://docs.cobrato.com/#
|
107
|
+
#### [Charges](http://docs.cobrato.com/#cobran-a)
|
106
108
|
|
107
109
|
| HTTP method | Endpoint | Client method |
|
108
110
|
| ----------- | -------------------------------------------------------------------------------------------- | ----------------------------- |
|
109
|
-
| POST | [api/v1/charges](http://docs.cobrato.com/#
|
110
|
-
| GET | [api/v1/charges](http://docs.cobrato.com/#lista-de-todas-as-
|
111
|
-
| GET | [api/v1/charges/:id](http://docs.cobrato.com/#
|
112
|
-
| PUT | [api/v1/charges/:id](http://docs.cobrato.com/#
|
113
|
-
| DELETE | [api/v1/charges/:id](http://docs.cobrato.com/#
|
114
|
-
| POST | [api/v1/charges/:id/receive](http://docs.cobrato.com/#recebimento-de-
|
115
|
-
| POST | [api/v1/charges/:id/undo_receive](http://docs.cobrato.com/#desfazer-recebimento-de-
|
116
|
-
| POST | [api/v1/charges/:id/deliver_billet](http://docs.cobrato.com/#envio-de-boleto-da-
|
117
|
-
| GET | [api/v1/charges/:id/billet](http://docs.cobrato.com/#boleto-da-
|
118
|
-
| POST | [api/v1/charges/:id/cancel](http://docs.cobrato.com/#cancelar-
|
111
|
+
| POST | [api/v1/charges](http://docs.cobrato.com/#cria-o-de-cobran-a) | client.charges.create |
|
112
|
+
| GET | [api/v1/charges](http://docs.cobrato.com/#lista-de-todas-as-cobran-a) | client.charges.list |
|
113
|
+
| GET | [api/v1/charges/:id](http://docs.cobrato.com/#informa-es-da-cobran-a) | client.charges.show |
|
114
|
+
| PUT | [api/v1/charges/:id](http://docs.cobrato.com/#atualiza-o-de-cobran-a) | client.charges.update |
|
115
|
+
| DELETE | [api/v1/charges/:id](http://docs.cobrato.com/#exclus-o-de-cobran-a) | client.charges.destroy |
|
116
|
+
| POST | [api/v1/charges/:id/receive](http://docs.cobrato.com/#recebimento-de-cobran-a) | client.charges.receive |
|
117
|
+
| POST | [api/v1/charges/:id/undo_receive](http://docs.cobrato.com/#desfazer-recebimento-de-cobran-a) | client.charges.undo_receive |
|
118
|
+
| POST | [api/v1/charges/:id/deliver_billet](http://docs.cobrato.com/#envio-de-boleto-da-cobran-a) | client.charges.deliver_billet |
|
119
|
+
| GET | [api/v1/charges/:id/billet](http://docs.cobrato.com/#boleto-da-cobran-a) | client.charges.billet |
|
120
|
+
| POST | [api/v1/charges/:id/cancel](http://docs.cobrato.com/#cancelar-cobran-a) | client.charges.cancel |
|
119
121
|
|
120
122
|
#### [Regress Cnab](http://docs.cobrato.com/#cnab-de-retorno)
|
121
123
|
|
122
124
|
| HTTP method | Endpoint | Client method |
|
123
125
|
| ----------- | ------------------------------------------------------------------------------------ | ---------------------------- |
|
124
|
-
| POST | [api/v1/regress_cnabs](http://docs.cobrato.com/#
|
126
|
+
| POST | [api/v1/regress_cnabs](http://docs.cobrato.com/#cria-o-de-cnab-de-retorno) | client.regress_cnabs.create |
|
125
127
|
| GET | [api/v1/regress_cnabs](http://docs.cobrato.com/#lista-de-todas-as-cnabs-de-retorno) | client.regress_cnabs.list |
|
126
|
-
| GET | [api/v1/regress_cnabs/:id](http://docs.cobrato.com/#
|
127
|
-
| DELETE | [api/v1/regress_cnabs/:id](http://docs.cobrato.com/#
|
128
|
+
| GET | [api/v1/regress_cnabs/:id](http://docs.cobrato.com/#informa-es-do-cnab-de-retorno) | client.regress_cnabs.show |
|
129
|
+
| DELETE | [api/v1/regress_cnabs/:id](http://docs.cobrato.com/#exclus-o-de-cnab-de-retorno) | client.regress_cnabs.destroy |
|
128
130
|
| GET | [api/v1/regress_cnabs/:id/file](http://docs.cobrato.com/#arquivo-do-cnab-de-retorno) | client.regress_cnabs.file |
|
129
131
|
|
130
132
|
#### [Remittance Cnab](http://docs.cobrato.com/#cnab-de-remessa)
|
131
133
|
|
132
|
-
| HTTP method | Endpoint | Client method
|
133
|
-
| ----------- | ---------------------------------------------------------------------------------------------------------------- |
|
134
|
-
| POST | [api/v1/remittance_cnabs](http://docs.cobrato.com
|
135
|
-
| GET | [api/v1/remittance_cnabs](http://docs.cobrato.com/#lista-de-todas-as-cnabs-de-remessa) | client.remittance_cnabs.list
|
136
|
-
| GET | [api/v1/remittance_cnabs/:id](http://docs.cobrato.com/#
|
137
|
-
| DELETE | [api/v1/remittance_cnabs/:id](http://docs.cobrato.com/#
|
138
|
-
| GET | [api/v1/remittance_cnabs/:id/file](http://docs.cobrato.com/#arquivo-do-cnab-de-remessa) | client.remittance_cnabs.file
|
139
|
-
| GET | [api/v1/remittance_cnabs/:id/charges](http://docs.cobrato.com/#lista-de-todas-as-
|
134
|
+
| HTTP method | Endpoint | Client method |
|
135
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
136
|
+
| POST | [api/v1/remittance_cnabs](http://docs.cobrato.com/cria-o-de-arquivo-cnab-de-remessa) | client.remittance_cnabs.create |
|
137
|
+
| GET | [api/v1/remittance_cnabs](http://docs.cobrato.com/#lista-de-todas-as-cnabs-de-remessa) | client.remittance_cnabs.list |
|
138
|
+
| GET | [api/v1/remittance_cnabs/:id](http://docs.cobrato.com/#informa-es-do-cnab-de-remessa) | client.remittance_cnabs.show |
|
139
|
+
| DELETE | [api/v1/remittance_cnabs/:id](http://docs.cobrato.com/#exclus-o-de-cnab-de-remessa) | client.remittance_cnabs.destroy |
|
140
|
+
| GET | [api/v1/remittance_cnabs/:id/file](http://docs.cobrato.com/#arquivo-do-cnab-de-remessa) | client.remittance_cnabs.file |
|
141
|
+
| GET | [api/v1/remittance_cnabs/:id/charges](http://docs.cobrato.com/#lista-de-todas-as-cobran-a-do-arquivo-de-remessa) | client.remittance_cnabs.charges (DEPRECATED) |
|
142
|
+
| GET | [api/v1/remittance_cnabs/:id/items](http://docs.cobrato.com/#lista-de-todos-os-items-do-arquivo-de-remessa) | client.remittance_cnabs.items |
|
140
143
|
|
141
144
|
|
142
145
|
#### [Credit Card](http://docs.cobrato.com/#cart-o-de-cr-dito)
|
@@ -152,17 +155,17 @@ Now you have acess to every API endpoint:
|
|
152
155
|
|
153
156
|
| HTTP method | Endpoint | Client method |
|
154
157
|
| ----------- | ---------------------------------------------------------------------- | ----------------------- |
|
155
|
-
| POST | [api/v1/webhooks](http://docs.cobrato.com/#
|
158
|
+
| POST | [api/v1/webhooks](http://docs.cobrato.com/#cria-o-de-webhook) | client.webhooks.create |
|
156
159
|
| GET | [api/v1/webhooks](http://docs.cobrato.com/#lista-de-todos-os-webhooks) | client.webhooks.list |
|
157
|
-
| GET | [api/v1/webhooks/:id](http://docs.cobrato.com/#
|
158
|
-
| PUT | [api/v1/webhooks/:id](http://docs.cobrato.com/#
|
159
|
-
| DELETE | [api/v1/webhooks/:id](http://docs.cobrato.com/#
|
160
|
+
| GET | [api/v1/webhooks/:id](http://docs.cobrato.com/#informa-es-do-webhook) | client.webhooks.show |
|
161
|
+
| PUT | [api/v1/webhooks/:id](http://docs.cobrato.com/#atualiza-o-de-webhook) | client.webhooks.update |
|
162
|
+
| DELETE | [api/v1/webhooks/:id](http://docs.cobrato.com/#exclus-o-de-webhook) | client.webhooks.destroy |
|
160
163
|
|
161
|
-
#### [Charging types](http://docs.cobrato.com/#tipos-de-
|
164
|
+
#### [Charging types](http://docs.cobrato.com/#tipos-de-cobran-a)
|
162
165
|
|
163
166
|
| HTTP method | Endpoint | Client method |
|
164
167
|
| ----------- | ------------------------------------------------------------------------------------- | -------------------------- |
|
165
|
-
| GET | [api/v1/charging_types](http://docs.cobrato.com/#lista-de-todos-os-tipos-de-
|
168
|
+
| GET | [api/v1/charging_types](http://docs.cobrato.com/#lista-de-todos-os-tipos-de-cobran-a) | client.changing_types.list |
|
166
169
|
|
167
170
|
#### [Charge Template](http://docs.cobrato.com/#modelo-de-cobran-a)
|
168
171
|
|
@@ -184,6 +187,16 @@ Now you have acess to every API endpoint:
|
|
184
187
|
| PUT | [api/v1/payment_configs/:id](http://docs.cobrato.com/#atualiza-o-de-configura-o-de-pagamento) | client.payment_configs.update |
|
185
188
|
| DELETE | [api/v1/payment_configs/:id](http://docs.cobrato.com/#exclus-o-de-configura-o-de-pagamento) | client.payment_configs.destroy |
|
186
189
|
|
190
|
+
#### [Payment](http://docs.cobrato.com/#pagamento) **(BETA)**
|
191
|
+
|
192
|
+
| HTTP method | Endpoint | Client method |
|
193
|
+
| ----------- | ------------------------------------------------------------------------ | ----------------------- |
|
194
|
+
| POST | [api/v1/payments](http://docs.cobrato.com/#cria-o-de-pagamento) | client.payments.create |
|
195
|
+
| GET | [api/v1/payments](http://docs.cobrato.com/#lista-de-todos-os-pagamentos) | client.payments.list |
|
196
|
+
| GET | [api/v1/payments/:id](http://docs.cobrato.com/#informa-es-do-pagamento) | client.payments.show |
|
197
|
+
| PUT | [api/v1/payments/:id](http://docs.cobrato.com/#atualiza-o-de-pagamento) | client.payments.update |
|
198
|
+
| DELETE | [api/v1/payments/:id](http://docs.cobrato.com/#exclus-o-de-pagamento) | client.payments.destroy |
|
199
|
+
|
187
200
|
|
188
201
|
## Payload signature check
|
189
202
|
|
data/lib/cobrato.rb
CHANGED
@@ -14,6 +14,7 @@ require "cobrato/entities/payer"
|
|
14
14
|
require "cobrato/entities/bank_account"
|
15
15
|
require "cobrato/entities/charge_config"
|
16
16
|
require "cobrato/entities/payment_config"
|
17
|
+
require "cobrato/entities/payment"
|
17
18
|
require "cobrato/entities/charge"
|
18
19
|
require "cobrato/entities/webhook"
|
19
20
|
require "cobrato/entities/bank_billet"
|
@@ -28,6 +29,7 @@ require "cobrato/resources/payer"
|
|
28
29
|
require "cobrato/resources/bank_account"
|
29
30
|
require "cobrato/resources/charge_config"
|
30
31
|
require "cobrato/resources/payment_config"
|
32
|
+
require "cobrato/resources/payment"
|
31
33
|
require "cobrato/resources/charge"
|
32
34
|
require "cobrato/resources/webhook"
|
33
35
|
require "cobrato/resources/charging_type"
|
data/lib/cobrato/client.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Cobrato
|
2
|
+
module Entities
|
3
|
+
class Payment < Base
|
4
|
+
attribute :id, Integer
|
5
|
+
attribute :payment_config_id, Integer
|
6
|
+
attribute :amount, Decimal
|
7
|
+
attribute :date, Date
|
8
|
+
attribute :our_number, String
|
9
|
+
attribute :payment_method, String
|
10
|
+
attribute :payment_type, String
|
11
|
+
attribute :account, String
|
12
|
+
attribute :account_digit, String
|
13
|
+
attribute :agency, String
|
14
|
+
attribute :bank_code, String
|
15
|
+
attribute :payee_name, String
|
16
|
+
attribute :payee_document_type, String
|
17
|
+
attribute :payee_document, String
|
18
|
+
attribute :doc_goal, String
|
19
|
+
attribute :ted_goal, String
|
20
|
+
attribute :registration_status, String
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -2,8 +2,14 @@ module Cobrato
|
|
2
2
|
module Entities
|
3
3
|
class RemittanceCnab < Base
|
4
4
|
attribute :id, Integer
|
5
|
-
attribute :charge_config_id, Integer
|
5
|
+
attribute :charge_config_id, Integer # DEPRECATED
|
6
|
+
attribute :config_id, Integer
|
6
7
|
attribute :status, String
|
8
|
+
|
9
|
+
def charge_config_id
|
10
|
+
puts "Warning: 'charge_config_id' is deprecated. Use 'config_id' instead."
|
11
|
+
super
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
@@ -112,6 +112,12 @@ module Cobrato
|
|
112
112
|
def underscore_pluralized(str)
|
113
113
|
"#{str.gsub(/(.)([A-Z])/, '\1_\2').downcase}s"
|
114
114
|
end
|
115
|
+
|
116
|
+
def deprecate(params, deprecated)
|
117
|
+
(params.keys.map(&:to_s) & deprecated).each do |a|
|
118
|
+
puts "Warning: The '#{a}' param is deprecated. See Cobrato API docs for more info."
|
119
|
+
end
|
120
|
+
end
|
115
121
|
end
|
116
122
|
end
|
117
123
|
end
|
@@ -6,6 +6,7 @@ module Cobrato
|
|
6
6
|
crud :show, :list, :destroy
|
7
7
|
|
8
8
|
def create(params)
|
9
|
+
deprecate(params, %w[charge_ids charge_config_ids])
|
9
10
|
http.post(resource_base_path, { body: params }) do |response|
|
10
11
|
respond_with_collection(response)
|
11
12
|
end
|
@@ -18,11 +19,23 @@ module Cobrato
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def charges(id)
|
22
|
+
puts "Warning: The 'charges' endpoint is deprecated. Use 'items' endpoint instead."
|
21
23
|
http.get("#{resource_base_path}/#{id}/charges") do |response|
|
22
24
|
respond_with_collection(response, 'Charge')
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
28
|
+
def items(id)
|
29
|
+
http.get("#{resource_base_path}/#{id}/items") do |response|
|
30
|
+
hash = parsed_body(response)
|
31
|
+
collection_name = hash.keys.first
|
32
|
+
class_name = collection_name.gsub(/(.)(.*)s/) { "#{$1.upcase}#{$2}" }
|
33
|
+
naked_klass = entity_klass(class_name)
|
34
|
+
|
35
|
+
hash[collection_name].map { |item| naked_klass.new(item) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
26
39
|
end
|
27
40
|
end
|
28
41
|
end
|
data/lib/cobrato/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobrato-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.23.0.
|
4
|
+
version: 0.23.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcio Ricardo Santos
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: typhoeus
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- lib/cobrato/entities/credit_card.rb
|
204
204
|
- lib/cobrato/entities/payee.rb
|
205
205
|
- lib/cobrato/entities/payer.rb
|
206
|
+
- lib/cobrato/entities/payment.rb
|
206
207
|
- lib/cobrato/entities/payment_config.rb
|
207
208
|
- lib/cobrato/entities/regress_cnab.rb
|
208
209
|
- lib/cobrato/entities/remittance_cnab.rb
|
@@ -220,6 +221,7 @@ files:
|
|
220
221
|
- lib/cobrato/resources/hooks.rb
|
221
222
|
- lib/cobrato/resources/payee.rb
|
222
223
|
- lib/cobrato/resources/payer.rb
|
224
|
+
- lib/cobrato/resources/payment.rb
|
223
225
|
- lib/cobrato/resources/payment_config.rb
|
224
226
|
- lib/cobrato/resources/regress_cnab.rb
|
225
227
|
- lib/cobrato/resources/remittance_cnab.rb
|