gerencianet 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +4 -45
  4. data/{docs/examples → examples}/.gitignore +0 -0
  5. data/{docs/examples → examples}/all_in_one.rb +0 -0
  6. data/{docs/examples → examples}/cancel_carnet.rb +0 -0
  7. data/{docs/examples → examples}/cancel_charge.rb +0 -0
  8. data/{docs/examples → examples}/cancel_parcel.rb +0 -0
  9. data/{docs/examples → examples}/cancel_subscription.rb +0 -0
  10. data/{docs/examples → examples}/create_billet_payment.rb +0 -0
  11. data/{docs/examples → examples}/create_card_payment.rb +0 -0
  12. data/{docs/examples → examples}/create_carnet.rb +0 -0
  13. data/{docs/examples → examples}/create_carnet_history.rb +0 -0
  14. data/{docs/examples → examples}/create_charge.rb +0 -0
  15. data/{docs/examples → examples}/create_charge_history.rb +0 -0
  16. data/{docs/examples → examples}/create_plan.rb +0 -0
  17. data/{docs/examples → examples}/create_subscription.rb +0 -0
  18. data/{docs/examples → examples}/create_subscription_payment.rb +0 -0
  19. data/{docs/examples → examples}/credentials.rb +0 -0
  20. data/{docs/examples → examples}/delete_plan.rb +0 -0
  21. data/{docs/examples → examples}/detail_carnet.rb +0 -0
  22. data/{docs/examples → examples}/detail_charge.rb +0 -0
  23. data/{docs/examples → examples}/detail_subscription.rb +0 -0
  24. data/{docs/examples → examples}/get_installments.rb +0 -0
  25. data/{docs/examples → examples}/get_notification.rb +0 -0
  26. data/{docs/examples → examples}/get_plans.rb +0 -0
  27. data/examples/link_charge.rb +27 -0
  28. data/{docs/examples → examples}/resend_billet.rb +0 -0
  29. data/{docs/examples → examples}/resend_carnet.rb +0 -0
  30. data/{docs/examples → examples}/resend_parcel.rb +0 -0
  31. data/{docs/examples → examples}/update_billet.rb +0 -0
  32. data/{docs/examples → examples}/update_carnet_metadata.rb +0 -0
  33. data/{docs/examples → examples}/update_charge_metadata.rb +0 -0
  34. data/{docs/examples → examples}/update_parcel.rb +0 -0
  35. data/{docs/examples → examples}/update_subscription_metadata.rb +0 -0
  36. data/gerencianet.gemspec +1 -0
  37. data/lib/gerencianet/constants.rb +4 -0
  38. data/lib/gerencianet/version.rb +1 -1
  39. metadata +54 -55
  40. data/docs/all-in-one.md +0 -92
  41. data/docs/carnet-cancel-parcel.md +0 -21
  42. data/docs/carnet-cancel.md +0 -20
  43. data/docs/carnet-create-history.md +0 -27
  44. data/docs/carnet-detailing.md +0 -61
  45. data/docs/carnet-resend-parcel.md +0 -27
  46. data/docs/carnet-resend.md +0 -26
  47. data/docs/carnet-update.md +0 -55
  48. data/docs/carnets.md +0 -165
  49. data/docs/charge-create-history.md +0 -27
  50. data/docs/charge-detailing.md +0 -42
  51. data/docs/charge-payment.md +0 -190
  52. data/docs/charge-resend-billet.md +0 -26
  53. data/docs/charge-update.md +0 -52
  54. data/docs/charge-with-marketplace.md +0 -54
  55. data/docs/charges.md +0 -75
  56. data/docs/installments.md +0 -108
  57. data/docs/notifications.md +0 -105
  58. data/docs/subscription-detailing.md +0 -56
  59. data/docs/subscription-payment.md +0 -100
  60. data/docs/subscription-update.md +0 -29
  61. data/docs/subscriptions.md +0 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63b2e15386a551a9a84b98b26d700cb13e181af3
4
- data.tar.gz: 529d122d79349c92dd7a889fa5b76c6583698f00
3
+ metadata.gz: e09d300fc85e895479d91b407f1f0313e6f1aafa
4
+ data.tar.gz: 34ed9fe85a8f64f8ec06eeb5c75738794f08481b
5
5
  SHA512:
6
- metadata.gz: eb9f5875041bf748e2fdf18534da75658199c213a5aaac97434a5d65adf55f902144051343394c764d90706678149682abd6282421b02133ca97c925b6da0c29
7
- data.tar.gz: 4a8f54c3f9f8b791790f45b221b63ef5328d27b542ac2cce8330be46692312cf1be4a6955be40b9f31b3608db8a3b7c903c05773e2140b9a3ff2661cf1a69ca2
6
+ metadata.gz: e03b06f78233119c0ec0c02d808323d8475906e5fcecbc6fb1dcff4700bb74501c1a57ebbe0a72795a40f9806a2cfee5552eb4f9734cd9fa914534f62456d1b3
7
+ data.tar.gz: 7b0fa67379dea22a69fdee051193ab3e6a2f26e5169be6240a0642955477c73f0fff54c9ebdb6c630abc4afcdef5e4b6cb7e76b9ab58f6e746518d7e7667351c
@@ -1,3 +1,8 @@
1
+ # 0.0.8
2
+
3
+ - Added: Charge link endpoint mapping
4
+ - Updated: Docs and examples
5
+
1
6
  # 0.0.7
2
7
 
3
8
  - Added: Cancel carnet endpoint mapping
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 `docs/examples` with `$ ruby docs/examples/example.rb`:
57
+ You can run the examples inside `examples` with `$ ruby examples/example.rb`:
58
58
 
59
59
  ```bash
60
- $ ruby docs/examples/create_charge.rb
60
+ $ ruby examples/create_charge.rb
61
61
  ```
62
62
 
63
- Just remember to set the correct credentials inside `docs/examples/credentials.rb` before running.
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
- ### Charges
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
@@ -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)
@@ -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
@@ -118,6 +118,10 @@ module Gerencianet
118
118
  cancel_parcel: {
119
119
  route: "/carnet/:id/parcel/:parcel/cancel",
120
120
  method: "put"
121
+ },
122
+ link_charge: {
123
+ route: "/charge/:id/link",
124
+ method: "post"
121
125
  }
122
126
  }
123
127
  end
@@ -1,4 +1,4 @@
1
1
  # :nodoc:
2
2
  module Gerencianet
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
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.7
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-06-15 00:00:00.000000000 Z
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
- - docs/all-in-one.md
175
- - docs/carnet-cancel-parcel.md
176
- - docs/carnet-cancel.md
177
- - docs/carnet-create-history.md
178
- - docs/carnet-detailing.md
179
- - docs/carnet-resend-parcel.md
180
- - docs/carnet-resend.md
181
- - docs/carnet-update.md
182
- - docs/carnets.md
183
- - docs/charge-create-history.md
184
- - docs/charge-detailing.md
185
- - docs/charge-payment.md
186
- - docs/charge-resend-billet.md
187
- - docs/charge-update.md
188
- - docs/charge-with-marketplace.md
189
- - docs/charges.md
190
- - docs/examples/.gitignore
191
- - docs/examples/all_in_one.rb
192
- - docs/examples/cancel_carnet.rb
193
- - docs/examples/cancel_charge.rb
194
- - docs/examples/cancel_parcel.rb
195
- - docs/examples/cancel_subscription.rb
196
- - docs/examples/create_billet_payment.rb
197
- - docs/examples/create_card_payment.rb
198
- - docs/examples/create_carnet.rb
199
- - docs/examples/create_carnet_history.rb
200
- - docs/examples/create_charge.rb
201
- - docs/examples/create_charge_history.rb
202
- - docs/examples/create_plan.rb
203
- - docs/examples/create_subscription.rb
204
- - docs/examples/create_subscription_payment.rb
205
- - docs/examples/credentials.rb
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
@@ -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
- ```