pagarme 1.9.3 → 1.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8641743ec32b982257e8fdd31df4acedcaf111a5
4
- data.tar.gz: dad121632d7f8073b6ba047788154cbf965aa775
3
+ metadata.gz: b76b03abe5cdc463af38c4885cb4986b794a17a1
4
+ data.tar.gz: 3c3a7dce4fabb033c9737b451043abe2b1d7524c
5
5
  SHA512:
6
- metadata.gz: 8e5dce369112fdd3d218700340bd65f912c9b2c9a27fc5763f544e95aebf8f22910a78a5445854e2f49007c2d33df29c82dd4f4a293df8773ade39c5ea938199
7
- data.tar.gz: 2446887bd86e88057529c3ef18169bdbb36f47c21de44d17f1aa6aa4331a7e84431440d51daa92adbdbe8f6c9e0457d15a2990a866afeaef522158d7d3ed3b94
6
+ metadata.gz: 8dfc8b1fc0a6d0f46126dfe5a424abc67dc051e0d348f699ddf868bb07b826f02e2d922fa356fcfe8aff0d4fb6c555e086160a613dfc0128ca4680a282aee561
7
+ data.tar.gz: c5b547b7fc14e56e529a92308dac533c793da8e634861e435fc611737891b7ce32235a715ec134007389361fc89da96208a631b9ea47ac87e51bfb0f456aa1b4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pagarme (1.9.3)
4
+ pagarme (1.8)
5
5
  multi_json
6
6
  rest-client
7
7
 
@@ -29,10 +29,11 @@ module PagarMe
29
29
  update(response)
30
30
  end
31
31
 
32
- def charge(amount)
32
+ def charge(amount, installments = 1)
33
33
  request = PagarMe::Request.new(self.url + '/transactions', 'POST')
34
34
  request.parameters = {
35
35
  :amount => amount,
36
+ :installments => installments
36
37
  }
37
38
  response = request.run
38
39
 
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.9.3'
7
+ spec.version = "1.9.4"
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}
@@ -22,6 +22,16 @@ module PagarMe
22
22
  test_subscription_transaction_response(subscription.current_transaction)
23
23
  end
24
24
 
25
+ should 'be able to create subscription without plan and charge with installments' do
26
+ subscription = test_subscription({:amount => 2000, :installments => 6})
27
+ subscription.create
28
+ assert subscription.current_transaction.amount == 2000
29
+ assert subscription.current_transaction.installments == 6
30
+ subscription.charge(1500, 3)
31
+ assert subscription.current_transaction.kind_of?(PagarMe::Transaction)
32
+ test_subscription_transaction_response(subscription.current_transaction, 1500, 3)
33
+ end
34
+
25
35
  should 'be able to search by anything' do
26
36
  subscription = test_subscription_with_customer
27
37
  subscription.create
data/test/test_helper.rb CHANGED
@@ -118,12 +118,14 @@ def test_customer_response(customer)
118
118
  assert customer.id
119
119
  end
120
120
 
121
- def test_subscription_transaction_response(transaction)
121
+ def test_subscription_transaction_response(transaction, amount = nil, installments = nil)
122
+ amount ||= 2000
123
+ installments ||= 1
122
124
  assert transaction.id
123
125
  assert !transaction.refuse_reason
124
126
  assert transaction.date_created
125
- assert transaction.amount == 2000
126
- assert transaction.installments.to_i == 1
127
+ assert transaction.amount == amount
128
+ assert transaction.installments.to_i == installments
127
129
  # assert transaction.card_brand == 'visa'
128
130
  assert transaction.payment_method == 'credit_card'
129
131
  assert transaction.status == 'paid'
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.9.3
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Franceschi
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-12 00:00:00.000000000 Z
12
+ date: 2014-08-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: shoulda
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: 3.4.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: 3.4.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: test-unit
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - '>='
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ">="
74
+ - - '>='
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ">="
81
+ - - '>='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: multi_json
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - '>='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - '>='
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  description: Pagar.me's ruby gem
@@ -103,8 +103,8 @@ executables: []
103
103
  extensions: []
104
104
  extra_rdoc_files: []
105
105
  files:
106
- - ".gitignore"
107
- - ".travis.yml"
106
+ - .gitignore
107
+ - .travis.yml
108
108
  - Gemfile
109
109
  - Gemfile.lock
110
110
  - README.md
@@ -140,12 +140,12 @@ require_paths:
140
140
  - lib
141
141
  required_ruby_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ">="
148
+ - - '>='
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []