pagarme 1.7 → 1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzEzZDFmNmExMjU0YjhjYTg1ZDU5NzA1M2IzMmIxMjJiNWNjYmU3MQ==
4
+ OTk0NDU1NWJhOGI3MjlmZjQ3MjQ3OWRiMWMyMDNhY2JhOGQ1YzFlZQ==
5
5
  data.tar.gz: !binary |-
6
- OGExNzBmMDM2ZDIyNGJmNTljYzUwZDEzMzI1NzdhODAzYWNiZDdmZA==
6
+ OWE2NDkzMDFhNDc4NGQ3NDhjMzE3OGFkMTFjZDgzYTY1NGUyY2M5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MmMyMWExMjVmZTk5MzJmN2E1Y2ViMGY0OTY5MGZiYWI4YzI1OTNhZDcwN2Mz
10
- YzBmOWQ5M2E0N2ZkMDk3OWEwNjQ1MzBhMDgyMWZlNGFkOTlhY2Y3NjU0YThi
11
- YzM4ODc2YzdkNGM3MjQzNTk4MTdjYzc4Mjk3NzVjNjNkNDM1OTM=
9
+ ZmRlMDFhZWE3ZTg1NGNhMGQ1YTFjMjBhODhiNDY3OTMwNjEyN2I4OTRlNGU0
10
+ YzAzNWM0M2QzNTBjZjEwMWE5NjljNzBmZmM4ZTVhNjBlYTZlNDNkNTUzNDlj
11
+ M2QyOTQ4MjI3YmMyOTQ4MzYwY2RjOTZkOWRiMWQ2YjUzYzNmZTE=
12
12
  data.tar.gz: !binary |-
13
- Zjk3Njk5NGE2NWI5OTVmYTZjOTFhNmNmZGE2MDcyMThlOGUxZDRhYzNiMTIz
14
- NmU3YmY3MDAxZDI4ZmI4YjliYWZiZWUwMGVmZmFjYTRjNjM4Y2FmNGQ5ODIz
15
- ZDM0ZjU1NGFhZjBmZjc1YzNjOTM2MTI0OGI4N2RhYTljYmIxYzY=
13
+ NzAyNzgxMDM1N2Y3NjZlNDk0MTFkOTc2YjI1MjE4ZTQxYzViODJjMGVlMjYz
14
+ ODNlODQzNDg2NzY3ZGE3NGU2NDlhM2JkYzczM2ZlODYzM2FmZDEzYWQwMGE2
15
+ ZmJiNmM0OGRjN2RkMjY4ZDViMWVkMDEzYmM2NmM2ZTcwYjBkNzE=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagarme (1.4)
4
+ pagarme (1.8)
5
5
  multi_json
6
6
  rest-client
7
7
 
@@ -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
- update(response)
38
+
39
+ request = PagarMe::Request.new(self.url, 'GET')
40
+ update(request.run)
39
41
  end
40
42
 
41
43
  end
@@ -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
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.transactions.length == 1
19
+ assert subscription.current_transaction.amount == 2000
20
20
  subscription.charge(2000)
21
- assert subscription.transactions.length == 2
22
- assert subscription.transactions.first.kind_of?(PagarMe::Transaction)
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
@@ -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
@@ -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 => 2941,
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.7'
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-01-28 00:00:00.000000000 Z
12
+ date: 2014-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler