gerencianet 0.0.6 → 0.0.7
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/.codeclimate.yml +3 -0
- data/CHANGELOG.md +6 -0
- data/README.md +2 -3
- data/docs/carnet-cancel-parcel.md +21 -0
- data/docs/carnet-cancel.md +20 -0
- data/docs/carnets.md +0 -31
- data/docs/charge-payment.md +1 -1
- data/docs/charges.md +0 -19
- data/docs/examples/cancel_carnet.rb +15 -0
- data/docs/examples/cancel_parcel.rb +16 -0
- data/lib/gerencianet/constants.rb +8 -0
- data/lib/gerencianet/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63b2e15386a551a9a84b98b26d700cb13e181af3
|
4
|
+
data.tar.gz: 529d122d79349c92dd7a889fa5b76c6583698f00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb9f5875041bf748e2fdf18534da75658199c213a5aaac97434a5d65adf55f902144051343394c764d90706678149682abd6282421b02133ca97c925b6da0c29
|
7
|
+
data.tar.gz: 4a8f54c3f9f8b791790f45b221b63ef5328d27b542ac2cce8330be46692312cf1be4a6955be40b9f31b3608db8a3b7c903c05773e2140b9a3ff2661cf1a69ca2
|
data/.codeclimate.yml
ADDED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -8,9 +8,6 @@ provided by [Gerencianet](http://gerencianet.com.br).
|
|
8
8
|
[](https://codeclimate.com/github/gerencianet/gn-api-sdk-ruby)
|
9
9
|
[](https://badge.fury.io/rb/gerencianet)
|
10
10
|
|
11
|
-
:warning: **Gerencianet API is under BETA version, meaning that it's not available for all users right now. If you're interested, you can always send an email to
|
12
|
-
desenvolvedores@gerencianet.com.br and we'll enable it for your account**
|
13
|
-
|
14
11
|
## Installation
|
15
12
|
|
16
13
|
Add this line to your application's Gemfile:
|
@@ -98,6 +95,8 @@ $ guard -n false -c
|
|
98
95
|
- [Resending the carnet](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-resend.md)
|
99
96
|
- [Resending carnet parcel](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-resend-parcel.md)
|
100
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)
|
101
100
|
|
102
101
|
### Subscriptions
|
103
102
|
|
@@ -0,0 +1,21 @@
|
|
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
|
+
```
|
@@ -0,0 +1,20 @@
|
|
1
|
+
### Canceling the carnet
|
2
|
+
|
3
|
+
Only `active` carnets can be canceled:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
params = {
|
7
|
+
id: 1000
|
8
|
+
}
|
9
|
+
|
10
|
+
gerencianet = Gerencianet.new(options)
|
11
|
+
puts gerencianet.cancel_carnet(params: params)
|
12
|
+
```
|
13
|
+
|
14
|
+
If everything goes well, the return will be:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
{
|
18
|
+
"code": 200
|
19
|
+
}
|
20
|
+
```
|
data/docs/carnets.md
CHANGED
@@ -8,7 +8,6 @@ The carnets can also be generated with the `metadata` attribute, just like in th
|
|
8
8
|
|
9
9
|
There are other optional params:
|
10
10
|
|
11
|
-
- `post_office_service`, which tells if the carnet must be sent via post office service (to you or to your clients)
|
12
11
|
- `split_items`, identifying if the total value must be splitted among the charges (defaults to `false`)
|
13
12
|
- The carnet `instructions`
|
14
13
|
|
@@ -60,36 +59,6 @@ body = {
|
|
60
59
|
|
61
60
|
The `notification_url` property will be used for sending notifications once things happen with charges statuses, as when it's payment was approved, for example. More about notifications [here](https://github.com/gerencianet/gn-api-sdk-node/tree/master/docs/notifications.md). The `custom_id` property can be used to set your own reference to the carnet.
|
62
61
|
|
63
|
-
|
64
|
-
### Required properties plus post office service information **(optional)**:
|
65
|
-
|
66
|
-
If you want the carnet to arrive at your house or at your client's house, you can count on Gerencianet's post office service. Just send an extra attribute:
|
67
|
-
|
68
|
-
```ruby
|
69
|
-
body = {
|
70
|
-
items: [{
|
71
|
-
name: "Carnet Item 1",
|
72
|
-
value: 1000,
|
73
|
-
amount: 2
|
74
|
-
}],
|
75
|
-
customer: {
|
76
|
-
name: "Gorbadoc Oldbuck",
|
77
|
-
email: "oldbuck@gerencianet.com.br",
|
78
|
-
cpf: "04267484171",
|
79
|
-
birth: "1977-01-15",
|
80
|
-
phone_number: "5144916523"
|
81
|
-
},
|
82
|
-
repeats: 4,
|
83
|
-
expire_at: "2020-12-12",
|
84
|
-
post_office_service: {
|
85
|
-
send_to: "customer"
|
86
|
-
}
|
87
|
-
}
|
88
|
-
```
|
89
|
-
|
90
|
-
If `send_to` is set to *customer*, the carnet arrives at you customer's. If it is set to *seller*, just wait for it to arrive at your place!
|
91
|
-
|
92
|
-
|
93
62
|
### split_items attribute **(optional)**
|
94
63
|
|
95
64
|
By default, each parcel has the total value of the carnet. If you want to divide the total value among the parcels, change `split_items` property to *true*.
|
data/docs/charge-payment.md
CHANGED
@@ -138,7 +138,7 @@ For testing purposes, you can go to your application playground in your Gerencia
|
|
138
138
|
|
139
139
|
When in production, it will depend if your project is a web app or a mobile app.
|
140
140
|
|
141
|
-
For web apps you should follow this [guide](https://
|
141
|
+
For web apps you should follow this [guide](https://docs.gerencianet.com.br/#!/charges/checkout/card). It basically consists of copying/pasting a script tag in your checkout page.
|
142
142
|
|
143
143
|
For mobile apps you should use this [SDK for Android](https://github.com/gerencianet/gn-api-sdk-android) or this [SDK for iOS](https://github.com/gerencianet/gn-api-sdk-ios).
|
144
144
|
|
data/docs/charges.md
CHANGED
@@ -53,25 +53,6 @@ body = {
|
|
53
53
|
|
54
54
|
The `notification_url` property will be used for sending notifications once things happen with charges statuses, as when it's payment was approved, for example. More about notifications [here](https://github.com/gerencianet/gn-api-sdk-node/tree/master/docs/notifications.md). The `custom_id` property can be used to set your own reference to the charge.
|
55
55
|
|
56
|
-
## Post office service:
|
57
|
-
|
58
|
-
If you want the charge to arrive at your house or at your client's house, you can count on Gerencianet's post office service. Just send an extra attribute:
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
body = {
|
62
|
-
items: [{
|
63
|
-
name: "Product A",
|
64
|
-
value: 1000,
|
65
|
-
amount: 2
|
66
|
-
}],
|
67
|
-
post_office_service: {
|
68
|
-
send_to: "customer"
|
69
|
-
}
|
70
|
-
}
|
71
|
-
```
|
72
|
-
|
73
|
-
If `send_to` is set to *customer*, the charge arrives at you customer's. If it is set to *seller*, just wait for it to arrive at your place. It's awesome!
|
74
|
-
|
75
56
|
### Finally, create the charge:
|
76
57
|
|
77
58
|
```ruby
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "gerencianet"
|
2
|
+
require_relative "./credentials"
|
3
|
+
|
4
|
+
options = {
|
5
|
+
client_id: CREDENTIALS::CLIENT_ID,
|
6
|
+
client_secret: CREDENTIALS::CLIENT_SECRET,
|
7
|
+
sandbox: true
|
8
|
+
}
|
9
|
+
|
10
|
+
params = {
|
11
|
+
id: 2363
|
12
|
+
}
|
13
|
+
|
14
|
+
gerencianet = Gerencianet.new(options)
|
15
|
+
puts gerencianet.cancel_carnet(params: params)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "gerencianet"
|
2
|
+
require_relative "./credentials"
|
3
|
+
|
4
|
+
options = {
|
5
|
+
client_id: CREDENTIALS::CLIENT_ID,
|
6
|
+
client_secret: CREDENTIALS::CLIENT_SECRET,
|
7
|
+
sandbox: true
|
8
|
+
}
|
9
|
+
|
10
|
+
params = {
|
11
|
+
id: 2363,
|
12
|
+
parcel: 1
|
13
|
+
}
|
14
|
+
|
15
|
+
gerencianet = Gerencianet.new(options)
|
16
|
+
puts gerencianet.cancel_parcel(params: params)
|
@@ -110,6 +110,14 @@ module Gerencianet
|
|
110
110
|
create_carnet_history: {
|
111
111
|
route: "/carnet/:id/history",
|
112
112
|
method: "post"
|
113
|
+
},
|
114
|
+
cancel_carnet: {
|
115
|
+
route: "/carnet/:id/cancel",
|
116
|
+
method: "put"
|
117
|
+
},
|
118
|
+
cancel_parcel: {
|
119
|
+
route: "/carnet/:id/parcel/:parcel/cancel",
|
120
|
+
method: "put"
|
113
121
|
}
|
114
122
|
}
|
115
123
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Carvalho
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -159,6 +159,7 @@ executables: []
|
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
+
- ".codeclimate.yml"
|
162
163
|
- ".gitignore"
|
163
164
|
- ".rubocop.yml"
|
164
165
|
- ".travis.yml"
|
@@ -171,6 +172,8 @@ files:
|
|
171
172
|
- bin/console
|
172
173
|
- bin/setup
|
173
174
|
- docs/all-in-one.md
|
175
|
+
- docs/carnet-cancel-parcel.md
|
176
|
+
- docs/carnet-cancel.md
|
174
177
|
- docs/carnet-create-history.md
|
175
178
|
- docs/carnet-detailing.md
|
176
179
|
- docs/carnet-resend-parcel.md
|
@@ -186,7 +189,9 @@ files:
|
|
186
189
|
- docs/charges.md
|
187
190
|
- docs/examples/.gitignore
|
188
191
|
- docs/examples/all_in_one.rb
|
192
|
+
- docs/examples/cancel_carnet.rb
|
189
193
|
- docs/examples/cancel_charge.rb
|
194
|
+
- docs/examples/cancel_parcel.rb
|
190
195
|
- docs/examples/cancel_subscription.rb
|
191
196
|
- docs/examples/create_billet_payment.rb
|
192
197
|
- docs/examples/create_card_payment.rb
|