gerencianet 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -45
- data/{docs/examples → examples}/.gitignore +0 -0
- data/{docs/examples → examples}/all_in_one.rb +0 -0
- data/{docs/examples → examples}/cancel_carnet.rb +0 -0
- data/{docs/examples → examples}/cancel_charge.rb +0 -0
- data/{docs/examples → examples}/cancel_parcel.rb +0 -0
- data/{docs/examples → examples}/cancel_subscription.rb +0 -0
- data/{docs/examples → examples}/create_billet_payment.rb +0 -0
- data/{docs/examples → examples}/create_card_payment.rb +0 -0
- data/{docs/examples → examples}/create_carnet.rb +0 -0
- data/{docs/examples → examples}/create_carnet_history.rb +0 -0
- data/{docs/examples → examples}/create_charge.rb +0 -0
- data/{docs/examples → examples}/create_charge_history.rb +0 -0
- data/{docs/examples → examples}/create_plan.rb +0 -0
- data/{docs/examples → examples}/create_subscription.rb +0 -0
- data/{docs/examples → examples}/create_subscription_payment.rb +0 -0
- data/{docs/examples → examples}/credentials.rb +0 -0
- data/{docs/examples → examples}/delete_plan.rb +0 -0
- data/{docs/examples → examples}/detail_carnet.rb +0 -0
- data/{docs/examples → examples}/detail_charge.rb +0 -0
- data/{docs/examples → examples}/detail_subscription.rb +0 -0
- data/{docs/examples → examples}/get_installments.rb +0 -0
- data/{docs/examples → examples}/get_notification.rb +0 -0
- data/{docs/examples → examples}/get_plans.rb +0 -0
- data/examples/link_charge.rb +27 -0
- data/{docs/examples → examples}/resend_billet.rb +0 -0
- data/{docs/examples → examples}/resend_carnet.rb +0 -0
- data/{docs/examples → examples}/resend_parcel.rb +0 -0
- data/{docs/examples → examples}/update_billet.rb +0 -0
- data/{docs/examples → examples}/update_carnet_metadata.rb +0 -0
- data/{docs/examples → examples}/update_charge_metadata.rb +0 -0
- data/{docs/examples → examples}/update_parcel.rb +0 -0
- data/{docs/examples → examples}/update_subscription_metadata.rb +0 -0
- data/gerencianet.gemspec +1 -0
- data/lib/gerencianet/constants.rb +4 -0
- data/lib/gerencianet/version.rb +1 -1
- metadata +54 -55
- data/docs/all-in-one.md +0 -92
- data/docs/carnet-cancel-parcel.md +0 -21
- data/docs/carnet-cancel.md +0 -20
- data/docs/carnet-create-history.md +0 -27
- data/docs/carnet-detailing.md +0 -61
- data/docs/carnet-resend-parcel.md +0 -27
- data/docs/carnet-resend.md +0 -26
- data/docs/carnet-update.md +0 -55
- data/docs/carnets.md +0 -165
- data/docs/charge-create-history.md +0 -27
- data/docs/charge-detailing.md +0 -42
- data/docs/charge-payment.md +0 -190
- data/docs/charge-resend-billet.md +0 -26
- data/docs/charge-update.md +0 -52
- data/docs/charge-with-marketplace.md +0 -54
- data/docs/charges.md +0 -75
- data/docs/installments.md +0 -108
- data/docs/notifications.md +0 -105
- data/docs/subscription-detailing.md +0 -56
- data/docs/subscription-payment.md +0 -100
- data/docs/subscription-update.md +0 -29
- data/docs/subscriptions.md +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e09d300fc85e895479d91b407f1f0313e6f1aafa
|
4
|
+
data.tar.gz: 34ed9fe85a8f64f8ec06eeb5c75738794f08481b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e03b06f78233119c0ec0c02d808323d8475906e5fcecbc6fb1dcff4700bb74501c1a57ebbe0a72795a40f9806a2cfee5552eb4f9734cd9fa914534f62456d1b3
|
7
|
+
data.tar.gz: 7b0fa67379dea22a69fdee051193ab3e6a2f26e5169be6240a0642955477c73f0fff54c9ebdb6c630abc4afcdef5e4b6cb7e76b9ab58f6e746518d7e7667351c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,13 +54,13 @@ response = gerencianet.create_charge(body: charge)
|
|
54
54
|
|
55
55
|
## Examples
|
56
56
|
|
57
|
-
You can run the examples inside `
|
57
|
+
You can run the examples inside `examples` with `$ ruby examples/example.rb`:
|
58
58
|
|
59
59
|
```bash
|
60
|
-
$ ruby
|
60
|
+
$ ruby examples/create_charge.rb
|
61
61
|
```
|
62
62
|
|
63
|
-
Just remember to set the correct credentials inside `
|
63
|
+
Just remember to set the correct credentials inside `examples/credentials.rb` before running.
|
64
64
|
|
65
65
|
## Tests
|
66
66
|
|
@@ -78,48 +78,7 @@ $ guard -n false -c
|
|
78
78
|
|
79
79
|
## Additional documentation
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
- [Creating charges](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charges.md)
|
84
|
-
- [Paying a charge](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-payment.md)
|
85
|
-
- [Detailing charges](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-detailing.md)
|
86
|
-
- [Updating informations](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-update.md)
|
87
|
-
- [Resending billet](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-resend-billet.md)
|
88
|
-
- [Adding information to charge's history](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-create-history.md)
|
89
|
-
|
90
|
-
### Carnets
|
91
|
-
|
92
|
-
- [Creating carnets](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnets.md)
|
93
|
-
- [Detailing carnets](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-detailing.md)
|
94
|
-
- [Updating informations](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-update.md)
|
95
|
-
- [Resending the carnet](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-resend.md)
|
96
|
-
- [Resending carnet parcel](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-resend-parcel.md)
|
97
|
-
- [Adding information to carnet's history](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-create-history.md)
|
98
|
-
- [Canceling the carnet](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-cancel.md)
|
99
|
-
- [Canceling carnet parcel](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-cancel-parcel.md)
|
100
|
-
|
101
|
-
### Subscriptions
|
102
|
-
|
103
|
-
- [Creating subscriptions](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/subscriptions.md)
|
104
|
-
- [Paying a subscription](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/subscription-payment.md)
|
105
|
-
- [Detailing subscriptions](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/subscription-detailing.md)
|
106
|
-
- [Updating informations](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/subscription-update.md)
|
107
|
-
|
108
|
-
### Marketplace
|
109
|
-
|
110
|
-
- [Creating a marketplace](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-with-marketplace.md)
|
111
|
-
|
112
|
-
### Notifications
|
113
|
-
|
114
|
-
- [Getting notifications](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/notifications.md)
|
115
|
-
|
116
|
-
### Payments
|
117
|
-
|
118
|
-
- [Getting installments](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/installments.md)
|
119
|
-
|
120
|
-
### All in one
|
121
|
-
|
122
|
-
- [Usage](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/all-in-one.md)
|
81
|
+
The full documentation with all available endpoints is in https://dev.gerencianet.com.br/.
|
123
82
|
|
124
83
|
## Changelog
|
125
84
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "gerencianet"
|
2
|
+
require "date"
|
3
|
+
require_relative "./credentials"
|
4
|
+
|
5
|
+
options = {
|
6
|
+
client_id: CREDENTIALS::CLIENT_ID,
|
7
|
+
client_secret: CREDENTIALS::CLIENT_SECRET,
|
8
|
+
sandbox: true
|
9
|
+
}
|
10
|
+
|
11
|
+
expireAt = Date.today + 3
|
12
|
+
|
13
|
+
params = {
|
14
|
+
id: 1000
|
15
|
+
}
|
16
|
+
|
17
|
+
body = {
|
18
|
+
billet_discount: 0,
|
19
|
+
card_discount: 0,
|
20
|
+
message: "",
|
21
|
+
expire_at: expireAt.strftime,
|
22
|
+
request_delivery_address: false,
|
23
|
+
payment_method: "all"
|
24
|
+
}
|
25
|
+
|
26
|
+
gerencianet = Gerencianet.new(options)
|
27
|
+
puts gerencianet.link_charge(params: params, body: body)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/gerencianet.gemspec
CHANGED
@@ -31,6 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "guard-rspec", "~> 4.6.4", ">= 4.6.4"
|
32
32
|
spec.add_development_dependency "webmock", "~> 1.22.3", ">= 1.22.3"
|
33
33
|
spec.add_development_dependency "rubocop", "~> 0.35.1", ">= 0.35.1"
|
34
|
+
spec.add_development_dependency "listen", "~> 3.0.4", ">= 3.0.4"
|
34
35
|
|
35
36
|
spec.add_runtime_dependency "http", "~> 0.9", ">= 0.9.8"
|
36
37
|
end
|
data/lib/gerencianet/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gerencianet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Carvalho
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,6 +130,26 @@ dependencies:
|
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 0.35.1
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: listen
|
135
|
+
requirement: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: 3.0.4
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 3.0.4
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 3.0.4
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 3.0.4
|
133
153
|
- !ruby/object:Gem::Dependency
|
134
154
|
name: http
|
135
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,59 +191,38 @@ files:
|
|
171
191
|
- Rakefile
|
172
192
|
- bin/console
|
173
193
|
- bin/setup
|
174
|
-
-
|
175
|
-
-
|
176
|
-
-
|
177
|
-
-
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
-
|
186
|
-
-
|
187
|
-
-
|
188
|
-
-
|
189
|
-
-
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
193
|
-
-
|
194
|
-
-
|
195
|
-
-
|
196
|
-
-
|
197
|
-
-
|
198
|
-
-
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
202
|
-
-
|
203
|
-
-
|
204
|
-
-
|
205
|
-
-
|
206
|
-
- docs/examples/delete_plan.rb
|
207
|
-
- docs/examples/detail_carnet.rb
|
208
|
-
- docs/examples/detail_charge.rb
|
209
|
-
- docs/examples/detail_subscription.rb
|
210
|
-
- docs/examples/get_installments.rb
|
211
|
-
- docs/examples/get_notification.rb
|
212
|
-
- docs/examples/get_plans.rb
|
213
|
-
- docs/examples/resend_billet.rb
|
214
|
-
- docs/examples/resend_carnet.rb
|
215
|
-
- docs/examples/resend_parcel.rb
|
216
|
-
- docs/examples/update_billet.rb
|
217
|
-
- docs/examples/update_carnet_metadata.rb
|
218
|
-
- docs/examples/update_charge_metadata.rb
|
219
|
-
- docs/examples/update_parcel.rb
|
220
|
-
- docs/examples/update_subscription_metadata.rb
|
221
|
-
- docs/installments.md
|
222
|
-
- docs/notifications.md
|
223
|
-
- docs/subscription-detailing.md
|
224
|
-
- docs/subscription-payment.md
|
225
|
-
- docs/subscription-update.md
|
226
|
-
- docs/subscriptions.md
|
194
|
+
- examples/.gitignore
|
195
|
+
- examples/all_in_one.rb
|
196
|
+
- examples/cancel_carnet.rb
|
197
|
+
- examples/cancel_charge.rb
|
198
|
+
- examples/cancel_parcel.rb
|
199
|
+
- examples/cancel_subscription.rb
|
200
|
+
- examples/create_billet_payment.rb
|
201
|
+
- examples/create_card_payment.rb
|
202
|
+
- examples/create_carnet.rb
|
203
|
+
- examples/create_carnet_history.rb
|
204
|
+
- examples/create_charge.rb
|
205
|
+
- examples/create_charge_history.rb
|
206
|
+
- examples/create_plan.rb
|
207
|
+
- examples/create_subscription.rb
|
208
|
+
- examples/create_subscription_payment.rb
|
209
|
+
- examples/credentials.rb
|
210
|
+
- examples/delete_plan.rb
|
211
|
+
- examples/detail_carnet.rb
|
212
|
+
- examples/detail_charge.rb
|
213
|
+
- examples/detail_subscription.rb
|
214
|
+
- examples/get_installments.rb
|
215
|
+
- examples/get_notification.rb
|
216
|
+
- examples/get_plans.rb
|
217
|
+
- examples/link_charge.rb
|
218
|
+
- examples/resend_billet.rb
|
219
|
+
- examples/resend_carnet.rb
|
220
|
+
- examples/resend_parcel.rb
|
221
|
+
- examples/update_billet.rb
|
222
|
+
- examples/update_carnet_metadata.rb
|
223
|
+
- examples/update_charge_metadata.rb
|
224
|
+
- examples/update_parcel.rb
|
225
|
+
- examples/update_subscription_metadata.rb
|
227
226
|
- gerencianet.gemspec
|
228
227
|
- lib/gerencianet.rb
|
229
228
|
- lib/gerencianet/constants.rb
|
data/docs/all-in-one.md
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
## Create charge and payment
|
2
|
-
|
3
|
-
The most common case scenarios consist of the two steps mentioned in the title. The other examples show each part separately. Here goes the most used endpoints grouped in one example.
|
4
|
-
|
5
|
-
Create the inputs for the three endpoints:
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
charge = {
|
9
|
-
items: [{
|
10
|
-
name: "Product 1",
|
11
|
-
value: 1000,
|
12
|
-
amount: 2
|
13
|
-
}],
|
14
|
-
shippings: [{
|
15
|
-
name: "Default Shipping Cost",
|
16
|
-
value: 100
|
17
|
-
}, {
|
18
|
-
name: "Adicional Shipping Cost",
|
19
|
-
value: 150
|
20
|
-
}]
|
21
|
-
}
|
22
|
-
|
23
|
-
payment = {
|
24
|
-
payment: {
|
25
|
-
credit_card: {
|
26
|
-
installments: 1,
|
27
|
-
payment_token: "88faabaa35f9d9ff29c315e03255c5644554a771",
|
28
|
-
billing_address: {
|
29
|
-
street: "Av. JK",
|
30
|
-
number: 909,
|
31
|
-
neighborhood: "Bauxita",
|
32
|
-
zipcode: "35400000",
|
33
|
-
city: "Ouro Preto",
|
34
|
-
state: "MG"
|
35
|
-
},
|
36
|
-
customer: {
|
37
|
-
name: "Gorbadoc Oldbuck",
|
38
|
-
email: "oldbuck@gerencianet.com.br",
|
39
|
-
cpf: "04267484171",
|
40
|
-
birth: "1977-01-15",
|
41
|
-
phone_number: "5144916523"
|
42
|
-
}
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
```
|
47
|
-
|
48
|
-
Call the endpoints:
|
49
|
-
|
50
|
-
```ruby
|
51
|
-
require "gerencianet"
|
52
|
-
|
53
|
-
options = {
|
54
|
-
client_id: "client_id",
|
55
|
-
client_secret: "client_secret",
|
56
|
-
sandbox: true
|
57
|
-
}
|
58
|
-
|
59
|
-
gerencianet = Gerencianet.new(options)
|
60
|
-
|
61
|
-
charge = gerencianet.create_charge(body: charge)
|
62
|
-
|
63
|
-
params = {
|
64
|
-
id: charge["data"]["charge_id"]
|
65
|
-
}
|
66
|
-
|
67
|
-
puts gerencianet.pay_charge(params: params, body: payment)
|
68
|
-
```
|
69
|
-
|
70
|
-
Response:
|
71
|
-
|
72
|
-
```ruby
|
73
|
-
{ "code": 200,
|
74
|
-
"data": {
|
75
|
-
"charge_id": 260,
|
76
|
-
"total": 2250,
|
77
|
-
"status": 'new',
|
78
|
-
"custom_id": null,
|
79
|
-
"created_at": "2015-05-18"
|
80
|
-
}
|
81
|
-
} #charge created
|
82
|
-
|
83
|
-
{ "code": 200,
|
84
|
-
"data": {
|
85
|
-
"charge_id": 260,
|
86
|
-
"total": 2400,
|
87
|
-
"payment": "credit_card",
|
88
|
-
"installments": 1,
|
89
|
-
"installment_value": 2400
|
90
|
-
}
|
91
|
-
} #payment created
|
92
|
-
```
|
@@ -1,21 +0,0 @@
|
|
1
|
-
### Canceling a carnet parcel
|
2
|
-
|
3
|
-
To cancel a carnet parcel, it must have status `waiting` or `unpaid`.
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
params = {
|
7
|
-
id: 1000,
|
8
|
-
parcel: 1
|
9
|
-
}
|
10
|
-
|
11
|
-
gerencianet = Gerencianet.new(options)
|
12
|
-
puts gerencianet.cancel_parcel(params: params)
|
13
|
-
```
|
14
|
-
|
15
|
-
If everything goes well, the return will be:
|
16
|
-
|
17
|
-
```ruby
|
18
|
-
{
|
19
|
-
"code": 200
|
20
|
-
}
|
21
|
-
```
|