pagarme 1.7 → 1.8
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 +8 -8
- data/Gemfile.lock +1 -1
- data/lib/pagarme/subscription.rb +4 -2
- data/pagarme.gemspec +1 -1
- data/test/pagarme/subscription.rb +3 -6
- data/test/pagarme/transaction.rb +2 -0
- data/test/test_helper.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTk0NDU1NWJhOGI3MjlmZjQ3MjQ3OWRiMWMyMDNhY2JhOGQ1YzFlZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWE2NDkzMDFhNDc4NGQ3NDhjMzE3OGFkMTFjZDgzYTY1NGUyY2M5OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmRlMDFhZWE3ZTg1NGNhMGQ1YTFjMjBhODhiNDY3OTMwNjEyN2I4OTRlNGU0
|
10
|
+
YzAzNWM0M2QzNTBjZjEwMWE5NjljNzBmZmM4ZTVhNjBlYTZlNDNkNTUzNDlj
|
11
|
+
M2QyOTQ4MjI3YmMyOTQ4MzYwY2RjOTZkOWRiMWQ2YjUzYzNmZTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzAyNzgxMDM1N2Y3NjZlNDk0MTFkOTc2YjI1MjE4ZTQxYzViODJjMGVlMjYz
|
14
|
+
ODNlODQzNDg2NzY3ZGE3NGU2NDlhM2JkYzczM2ZlODYzM2FmZDEzYWQwMGE2
|
15
|
+
ZmJiNmM0OGRjN2RkMjY4ZDViMWVkMDEzYmM2NmM2ZTcwYjBkNzE=
|
data/Gemfile.lock
CHANGED
data/lib/pagarme/subscription.rb
CHANGED
@@ -30,12 +30,14 @@ module PagarMe
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def charge(amount)
|
33
|
-
request = PagarMe::Request.new(self.url, 'POST')
|
33
|
+
request = PagarMe::Request.new(self.url + '/transactions', 'POST')
|
34
34
|
request.parameters = {
|
35
35
|
:amount => amount,
|
36
36
|
}
|
37
37
|
response = request.run
|
38
|
-
|
38
|
+
|
39
|
+
request = PagarMe::Request.new(self.url, 'GET')
|
40
|
+
update(request.run)
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|
data/pagarme.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "pagarme"
|
7
|
-
spec.version = 1.
|
7
|
+
spec.version = 1.8
|
8
8
|
spec.authors = ["Pedro Franceschi", "Henrique Dubugras"]
|
9
9
|
spec.email = ["pedrohfranceschi@gmail.com", "henrique@pagar.me"]
|
10
10
|
spec.description = %q{Pagar.me's ruby gem}
|
@@ -16,13 +16,10 @@ module PagarMe
|
|
16
16
|
should 'be able to create subscription without plan' do
|
17
17
|
subscription = test_subscription({:amount => 2000})
|
18
18
|
subscription.create
|
19
|
-
assert subscription.
|
19
|
+
assert subscription.current_transaction.amount == 2000
|
20
20
|
subscription.charge(2000)
|
21
|
-
assert subscription.
|
22
|
-
|
23
|
-
subscription.transactions.each do |t|
|
24
|
-
test_subscription_transaction_response(t)
|
25
|
-
end
|
21
|
+
assert subscription.current_transaction.kind_of?(PagarMe::Transaction)
|
22
|
+
test_subscription_transaction_response(subscription.current_transaction)
|
26
23
|
end
|
27
24
|
|
28
25
|
should 'be able to change plans' do
|
data/test/pagarme/transaction.rb
CHANGED
@@ -55,6 +55,8 @@ module PagarMe
|
|
55
55
|
transaction = test_transaction_with_customer
|
56
56
|
transaction.charge
|
57
57
|
test_transaction_response(transaction)
|
58
|
+
assert transaction.address.class == Address
|
59
|
+
assert transaction.address.street== 'Av. Brigadeiro Faria Lima'
|
58
60
|
assert transaction.customer.class == Customer
|
59
61
|
test_customer_response(transaction.customer)
|
60
62
|
end
|
data/test/test_helper.rb
CHANGED
@@ -97,7 +97,7 @@ def test_subscription_with_customer(params = {})
|
|
97
97
|
:street => 'Av. Brigadeiro Faria Lima',
|
98
98
|
:neighborhood => 'Itaim bibi',
|
99
99
|
:zipcode => '01452000',
|
100
|
-
:street_number =>
|
100
|
+
:street_number => 1000,
|
101
101
|
} ,
|
102
102
|
:phone => {
|
103
103
|
:ddd => 12,
|
@@ -112,14 +112,10 @@ end
|
|
112
112
|
|
113
113
|
def test_customer_response(customer)
|
114
114
|
assert customer.id
|
115
|
-
assert customer.addresses.class == Array
|
116
|
-
assert customer.phones.class == Array
|
117
115
|
assert customer.document_type == 'cpf'
|
118
116
|
assert customer.name == 'Jose da Silva'
|
119
117
|
assert customer.born_at
|
120
118
|
assert customer.id
|
121
|
-
assert customer.addresses[0].class == PagarMe::Address
|
122
|
-
assert customer.phones[0].class == PagarMe::Phone
|
123
119
|
end
|
124
120
|
|
125
121
|
def test_subscription_transaction_response(transaction)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagarme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Franceschi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|