pagarme 2.1.2 → 2.1.3

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: 947c7bc9fea07b5bb4b9c89ab75ef72a7691c264
4
- data.tar.gz: a6f0985e22ccb24a41e59a9804a04a8e8f3f1fff
3
+ metadata.gz: 32435bc6f31cb6c994fb5cf1c179085fc24b27f0
4
+ data.tar.gz: b6dc35d91784e87fb4681693fd0e2ee06311ba1e
5
5
  SHA512:
6
- metadata.gz: c5a0a905cd64a05a92445205f3e0b5ebe1e3ed6526fce832bff1ffda03b3bf3c61cdeb5956ba9ea1fae9fda5b0a2cf116765d854c62be0633c99570c942d1b81
7
- data.tar.gz: 58eb341a89fee732876a75eb28e62be22654fafd0ff92c69acdc456711c1b4ed82722e5c2c887343ba8dce3cc48948f68a11c7108d48e77fff92a53a4880baad
6
+ metadata.gz: a8497647fc3b90c9bf2a7e7e603a680f83b687dd0e48d603695034bb4ffed4fd8190d89334b78a2396383d1ab7f61a19d580215388db11fb2180a93aacbffa62
7
+ data.tar.gz: a1b0e5a51306c35352599434001552aa4e8c83572f72110dc83afeec96153d27cdd890e38249a359a0477fa9d4e9144ad837168684a4e3cfd5c2456ee5b82ca2
data/.gitignore CHANGED
@@ -1,5 +1,7 @@
1
1
  *.gem
2
2
  *.rbc
3
+ .DS_Store
4
+ */.DS_Store
3
5
  .bundle
4
6
  .config
5
7
  coverage
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2013-2016, Pagar.me Pagamentos S/A
4
+
5
+ Permission is hereby granted, free of charge, to any person
6
+ obtaining a copy of this software and associated documentation
7
+ files (the "Software"), to deal in the Software without
8
+ restriction, including without limitation the rights to use,
9
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the
11
+ Software is furnished to do so, subject to the following
12
+ conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -27,10 +27,12 @@ and run `bundle install` from your shell.
27
27
  You can set your API key in Ruby:
28
28
 
29
29
  ```ruby
30
- PagarMe.api_key = 'YOUR_API_KEY_HERE'
30
+ PagarMe.api_key = 'YOUR_API_KEY_HERE'
31
+ PagarMe.encryption_key = 'YOUR_ENCRYPTION_KEY_HERE' # If needed
31
32
  ```
32
33
 
33
34
  or set the environment variable _PAGARME\_API\_KEY_ (**recommended**)
35
+ and _PAGARME\_ENCRYPTION\_KEY_ (**recommended if needed**)
34
36
 
35
37
  ### Using Pagar.me Checkout
36
38
 
@@ -340,6 +342,9 @@ so you can search your data optimally.
340
342
 
341
343
  And document all the source code.
342
344
 
345
+ ## Support
346
+ If you have any problem or suggestion please open an issue [here](https://github.com/pagarme/pagarme-ruby/issues).
347
+
343
348
  ## License
344
349
 
345
- Pagar.me Ruby library is released under the [MIT License](http://www.opensource.org/licenses/MIT).
350
+ Check [here](LICENSE).
@@ -18,13 +18,14 @@ end
18
18
 
19
19
  module PagarMe
20
20
  class << self
21
- attr_accessor :api_endpoint, :open_timeout, :timeout, :api_key
21
+ attr_accessor :api_endpoint, :open_timeout, :timeout, :api_key, :encryption_key
22
22
  end
23
23
 
24
- self.api_endpoint = 'https://api.pagar.me/1'
25
- self.open_timeout = 30
26
- self.timeout = 90
27
- self.api_key = ENV['PAGARME_API_KEY']
24
+ self.api_endpoint = 'https://api.pagar.me/1'
25
+ self.open_timeout = 30
26
+ self.timeout = 90
27
+ self.api_key = ENV['PAGARME_API_KEY']
28
+ self.encryption_key = ENV['PAGARME_ENCRYPTION_KEY']
28
29
 
29
30
  # TODO: Remove deprecated PagarMe.validate_fingerprint
30
31
  def self.validate_fingerprint(*args)
@@ -38,7 +38,7 @@ module PagarMe
38
38
  @response = response
39
39
  @errors = response['errors'].map do |error|
40
40
  params = error.values_at('message', 'parameter_name', 'type', 'url')
41
- ParamError.new *params
41
+ ParamError.new(*params)
42
42
  end
43
43
  super @errors.map(&:message).join(', ')
44
44
  end
@@ -1,6 +1,6 @@
1
1
  module PagarMe
2
2
  class NestedModel < Model
3
- attr_reader :parent_id
3
+ attr_accessor :parent_id
4
4
 
5
5
  def initialize(hash = Hash.new)
6
6
  hash = hash.dup
@@ -28,7 +28,11 @@ module PagarMe
28
28
  raise RequestError.new('Invalid ID') unless id.present?
29
29
  raise RequestError.new('Invalid parent ID') unless parent_id.present?
30
30
 
31
- PagarMe::Request.get(url parent_id, id).call
31
+ object = PagarMe::Request.get(url parent_id, id).call
32
+ if object
33
+ object.parent_id = parent_id
34
+ end
35
+ object
32
36
  end
33
37
  alias :find :find_by_id
34
38
 
@@ -38,7 +42,10 @@ module PagarMe
38
42
  PagarMe::Request.get(url(parent_id), params: hash.merge(
39
43
  page: page,
40
44
  count: count
41
- )).call
45
+ )).call.map do |object|
46
+ object.parent_id = parent_id
47
+ object
48
+ end
42
49
  end
43
50
  alias :find_by_hash :find_by
44
51
 
@@ -1,6 +1,6 @@
1
1
  module PagarMe
2
2
  class PagarMeObject
3
- attr_reader :attributes, :unsaved_attributes
3
+ attr_reader :attributes
4
4
 
5
5
  RESOURCES = Dir[File.expand_path('../resources/*.rb', __FILE__)].map do |path|
6
6
  File.basename(path, '.rb').to_sym
@@ -34,7 +34,12 @@ module PagarMe
34
34
  def calculate_installments(params)
35
35
  PagarMe::Request.get(url('calculate_installments_amount'), query: params).run
36
36
  end
37
-
37
+
38
+ def generate_card_hash()
39
+ raise RequestError.new('Invalid Encryption Key') if PagarMe.encryption_key.blank?
40
+
41
+ PagarMe::Request.get(url('card_hash_key'), params: { encryption_key: PagarMe.encryption_key }).call
42
+ end
38
43
  alias :charge :create
39
44
  end
40
45
  end
@@ -1,3 +1,3 @@
1
1
  module PagarMe
2
- VERSION = '2.1.2'
2
+ VERSION = '2.1.3'
3
3
  end
@@ -16,13 +16,15 @@ Gem::Specification.new do |spec|
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ['lib']
18
18
 
19
- spec.add_development_dependency 'bundler', '~> 1.3'
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.3'
21
+ spec.add_development_dependency 'shoulda', '~> 3.4.0'
22
+ spec.add_development_dependency 'activesupport', '~> 3.0'
23
+ spec.add_development_dependency 'pry'
24
+ spec.add_development_dependency 'vcr'
20
25
  spec.add_development_dependency 'rake'
21
- spec.add_development_dependency 'shoulda', '~> 3.4.0'
22
- spec.add_development_dependency 'test-unit'
23
26
  spec.add_development_dependency 'webmock'
24
- spec.add_development_dependency 'vcr'
25
- spec.add_development_dependency 'pry'
27
+ spec.add_development_dependency 'test-unit'
26
28
 
27
29
  spec.add_dependency 'rest-client'
28
30
  spec.add_dependency 'multi_json'
@@ -96,7 +96,7 @@ module Assertions
96
96
 
97
97
  def assert_split_rules(split_rules)
98
98
  assert_equal split_rules.size, 4
99
- rules = split_rules.sort_by &:percentage
99
+ rules = split_rules.sort_by(&:percentage)
100
100
 
101
101
  assert_equal rules[0].recipient_id, Fixtures.persistent_recipient_ids[0]
102
102
  assert_equal rules[1].recipient_id, Fixtures.persistent_recipient_ids[1]
@@ -132,13 +132,17 @@ module Assertions
132
132
  def assert_transaction_errors(params = {})
133
133
  PagarMe::Transaction.create transaction_with_card_params(params)
134
134
  rescue PagarMe::ValidationError
135
- assert_no_match /\s*\,\s*\Z/, $!.message
135
+ assert_no_match(/\s*\,\s*\Z/, $!.message)
136
136
  end
137
137
 
138
138
  def assert_has_error_param(exception, parameter_name)
139
139
  assert exception.errors.any?{ |error| error.parameter_name == parameter_name }
140
140
  end
141
141
 
142
+ def assert_hasnt_error_param(exception, parameter_name)
143
+ assert exception.errors.none?{ |error| error.parameter_name == parameter_name }
144
+ end
145
+
142
146
  def assert_transfer(transfer)
143
147
  assert transfer.id
144
148
  assert transfer.fee
@@ -111,7 +111,7 @@ class Fixtures
111
111
  {
112
112
  transfer_day: 3,
113
113
  transfer_enabled: true,
114
- transfer_interval: 'daily'
114
+ transfer_interval: 'weekly'
115
115
  }
116
116
  end
117
117
 
@@ -202,7 +202,7 @@ class Fixtures
202
202
  end
203
203
 
204
204
  def method_missing(name, *args, &block)
205
- match = name.to_s.match /\_params\Z/
205
+ match = name.to_s.match(/\_params\Z/)
206
206
  if match && fixtures.respond_to?(match.pre_match) && args.count < 2
207
207
  if args.empty?
208
208
  fixtures.public_send match.pre_match
@@ -1,7 +1,7 @@
1
1
  require_relative '../test_helper'
2
2
 
3
3
  module PagarMe
4
- class ErrorTest < Test::Unit::TestCase
4
+ class ErrorTest < PagarMeTestCase
5
5
  should 'be able to handle single error messages' do
6
6
  assert_transaction_errors card_number: nil
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require_relative '../test_helper'
2
2
 
3
3
  module PagarMe
4
- class ObjectTest < Test::Unit::TestCase
4
+ class ObjectTest < PagarMeTestCase
5
5
  should 'be able to create object and add any attribute' do
6
6
  object = PagarMe::PagarMeObject.new attr1: 2
7
7
  assert_equal object.attr1, 2
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class BalanceTest < Test::Unit::TestCase
4
+ class BalanceTest < PagarMeTestCase
5
5
 
6
6
  should 'change amount amount after transaction being paid' do
7
7
  transaction = PagarMe::Transaction.charge transaction_with_boleto_params
@@ -1,19 +1,19 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class BankAccountTest < Test::Unit::TestCase
4
+ class BankAccountTest < PagarMeTestCase
5
5
  should 'be able to create a bank_account' do
6
6
  bank_account = PagarMe::BankAccount.create bank_account_params
7
7
  assert_equal bank_account.bank_code, '237'
8
8
  end
9
9
 
10
10
  should 'be able to search by anything' do
11
- bank_account = PagarMe::BankAccount.create bank_account_params
11
+ PagarMe::BankAccount.create bank_account_params
12
12
  bank_accounts = PagarMe::BankAccount.find_by bank_code: '237'
13
13
 
14
14
  assert bank_accounts.size > 0
15
- bank_accounts.each do |b|
16
- assert_equal b.bank_code, '237'
15
+ bank_accounts.each do |bank_account|
16
+ assert_equal bank_account.bank_code, '237'
17
17
  end
18
18
  end
19
19
 
@@ -22,13 +22,13 @@ module PagarMe
22
22
  agencia: 'abcd',
23
23
  agencia_dv: 'Y',
24
24
  conta: 'ABCD',
25
- conta_dv: '',
26
- legal_name: '',
27
- document_number: 'foooo'
25
+ conta_dv: 'X',
26
+ legal_name: 'John Doe',
27
+ document_number: '02476585700'
28
28
  }.each do |key, value|
29
29
  should "validate bank_account - #{key}" do
30
30
  exception = assert_raises(PagarMe::ValidationError){ BankAccount.create key => value }
31
- assert_has_error_param exception, key.to_s
31
+ assert_hasnt_error_param exception, key.to_s
32
32
  end
33
33
  end
34
34
  end
@@ -1,10 +1,11 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class BulkAnticipationTest < Test::Unit::TestCase
4
+ class BulkAnticipationTest < PagarMeTestCase
5
5
 
6
6
  def setup
7
7
  super
8
+ ensure_anticipable_default_recipient
8
9
  ensure_waiting_funds
9
10
  end
10
11
 
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class CardTest < Test::Unit::TestCase
4
+ class CardTest < PagarMeTestCase
5
5
  should 'be able to create' do
6
6
  card = PagarMe::Card.create card_params
7
7
 
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class PayableTest < Test::Unit::TestCase
4
+ class PayableTest < PagarMeTestCase
5
5
  should 'be created setting default recipient on payable' do
6
6
  transaction = PagarMe::Transaction.create transaction_with_customer_with_card_params
7
7
  payable = transaction.payables.first
@@ -12,13 +12,13 @@ module PagarMe
12
12
 
13
13
  should 'create one per split rule' do
14
14
  transaction = PagarMe::Transaction.create transaction_with_customer_with_card_with_split_rules_params
15
- payable = transaction.payables.first
16
15
 
17
16
  assert_equal transaction.payables.count, 4
18
17
  assert_equal transaction.payables.map(&:recipient_id).sort, fixtures.persistent_recipient_ids.sort
19
18
  end
20
19
 
21
20
  should 'be found' do
21
+ PagarMe::Transaction.create(transaction_with_customer_with_card_params).refund
22
22
  payables = PagarMe::Payable.find_by type: 'refund'
23
23
 
24
24
  assert payables.count > 0
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class PlanTest < Test::Unit::TestCase
4
+ class PlanTest < PagarMeTestCase
5
5
  should 'be able to create a plan' do
6
6
  plan = PagarMe::Plan.create plan_params
7
7
  assert_plan_created plan
@@ -17,8 +17,7 @@ module PagarMe
17
17
  end
18
18
 
19
19
  should 'be able to search by anything' do
20
- plan = PagarMe::Plan.create plan_params
21
- assert_plan_created plan
20
+ assert_plan_created PagarMe::Plan.create(plan_params)
22
21
 
23
22
  # find_by_hash is possibly consistent, wait to try to ensure!!!
24
23
  sleep 1
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class TransactionTest < Test::Unit::TestCase
4
+ class TransactionTest < PagarMeTestCase
5
5
  should 'be valid when has valid signature' do
6
6
  fixed_api_key do
7
7
  postback = PagarMe::Postback.new postback_response_params
@@ -15,10 +15,12 @@ module PagarMe
15
15
  end
16
16
 
17
17
  should 'validate signature' do
18
- params = postback_response_params
19
- assert PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature])
20
- assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature][4..-1])
21
- assert !PagarMe::Postback.valid_request_signature?(params[:payload], 'invalid signature')
18
+ fixed_api_key do
19
+ params = postback_response_params
20
+ assert PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature])
21
+ assert !PagarMe::Postback.valid_request_signature?(params[:payload], params[:signature][4..-1])
22
+ assert !PagarMe::Postback.valid_request_signature?(params[:payload], 'invalid signature')
23
+ end
22
24
  end
23
25
  end
24
26
  end
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class RecipientTest < Test::Unit::TestCase
4
+ class RecipientTest < PagarMeTestCase
5
5
 
6
6
  should 'be able to create a recipient with bank_account data' do
7
7
  recipient = PagarMe::Recipient.create recipient_with_nested_bank_account_params
@@ -18,15 +18,12 @@ module PagarMe
18
18
  should 'not be able to create a recipient without bank_account data' do
19
19
  recipient = PagarMe::Recipient.new recipient_params
20
20
  exception = assert_raises(PagarMe::ValidationError){ recipient.create }
21
-
22
- [:bank_code, :agencia, :conta_dv, :conta, :document_number, :legal_name].each do |missing_attr|
23
- assert_has_error_param exception, "bank_account[#{missing_attr}]"
24
- end
21
+ assert_has_error_param exception, 'bank_account_id'
25
22
  assert_nil recipient.date_created
26
23
  end
27
24
 
28
25
  should 'be able to search' do
29
- recipient = PagarMe::Recipient.create recipient_with_nested_bank_account_params
26
+ PagarMe::Recipient.create recipient_with_nested_bank_account_params
30
27
 
31
28
  bank_account_doc_number = bank_account_params[:document_number]
32
29
  recipients = PagarMe::Recipient.find_by 'bank_account[document_number]' => bank_account_doc_number
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class SubscriptionTest < Test::Unit::TestCase
4
+ class SubscriptionTest < PagarMeTestCase
5
5
  should 'be able to create subscription with plan' do
6
6
  plan = PagarMe::Plan.create plan_params
7
7
  assert_plan_created plan
@@ -39,7 +39,7 @@ module PagarMe
39
39
  assert_subscription_successfully_paid subscription, 2000
40
40
 
41
41
  found_subscription = PagarMe::Subscription.find_by_id subscription.id
42
- assert_subscription_successfully_paid subscription, 2000
42
+ assert_subscription_successfully_paid found_subscription, 2000
43
43
  end
44
44
 
45
45
  should 'be able to create subscription without plan and charge with installments' do
@@ -53,7 +53,7 @@ module PagarMe
53
53
  assert_subscription_successfully_paid subscription, 1500, 3
54
54
 
55
55
  found_subscription = PagarMe::Subscription.find_by_id subscription.id
56
- assert_subscription_successfully_paid subscription, 1500, 3
56
+ assert_subscription_successfully_paid found_subscription, 1500, 3
57
57
  end
58
58
 
59
59
  should 'be able to update subscription' do
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class TransactionTest < Test::Unit::TestCase
4
+ class TransactionTest < PagarMeTestCase
5
5
  def setup
6
6
  super
7
7
  ensure_positive_balance
@@ -217,5 +217,16 @@ module PagarMe
217
217
  assert_equal result['installments'][i.to_s]['installment_amount'], installment
218
218
  end
219
219
  end
220
+
221
+ should 'be able to get public key' do
222
+ transaction = PagarMe::Transaction.generate_card_hash
223
+ assert_match(/BEGIN\ PUBLIC\ KEY/, transaction.public_key)
224
+ end
225
+
226
+ should 'validate encryption_key' do
227
+ PagarMe.encryption_key = nil
228
+ exception = assert_raises(PagarMe::RequestError){ PagarMe::Transaction.generate_card_hash }
229
+ assert_equal exception.message, "Invalid Encryption Key"
230
+ end
220
231
  end
221
232
  end
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class TransferTest < Test::Unit::TestCase
4
+ class TransferTest < PagarMeTestCase
5
5
  def setup
6
6
  super
7
7
  ensure_positive_balance
@@ -1,7 +1,7 @@
1
1
  require_relative '../../test_helper'
2
2
 
3
3
  module PagarMe
4
- class ZipcodeTest < Test::Unit::TestCase
4
+ class ZipcodeTest < PagarMeTestCase
5
5
  should 'be able find a zipcode' do
6
6
  zipcode = PagarMe::Zipcode.find '12228-462'
7
7
 
@@ -15,17 +15,20 @@ VCR.configure do |config|
15
15
  config.hook_into :webmock
16
16
  end
17
17
 
18
- class Test::Unit::TestCase
18
+ class PagarMeTestCase < Test::Unit::TestCase
19
19
  FIXED_API_KEY = 'ak_test_Q2D2qDYGJSyeR1KbI4sLzGACEr73MF'
20
+ FIXED_ENCRYPTION_KEY = 'ek_test_ZsiQ61rmOmB8mh055slzu1nxfVbAFa'
20
21
 
21
22
  include Fixtures::Helpers
22
23
  include Assertions
23
24
 
24
25
  def setup
25
- PagarMe.api_key = temporary_api_key
26
+ PagarMe.encryption_key = temporary_company.encryption_key.test
27
+ PagarMe.api_key = temporary_company.api_key.test
26
28
  end
27
29
 
28
30
  def teardown
31
+ PagarMe.encryption_key = nil
29
32
  PagarMe.api_key = nil
30
33
  end
31
34
 
@@ -44,26 +47,32 @@ class Test::Unit::TestCase
44
47
  end
45
48
  end
46
49
 
50
+ def ensure_anticipable_default_recipient
51
+ VCR.use_cassette 'TestCase/ensure_anticipable_default_recipient' do
52
+ recipient = PagarMe::Recipient.default
53
+ recipient.anticipatable_volume_percentage = 100
54
+ recipient.save
55
+ end
56
+ end
57
+
47
58
  def fixed_api_key
59
+ PagarMe.encryption_key = FIXED_ENCRYPTION_KEY
48
60
  PagarMe.api_key = FIXED_API_KEY
49
61
  yield
50
- PagarMe.api_key = temporary_api_key
62
+ PagarMe.encryption_key = temporary_company.encryption_key.test
63
+ PagarMe.api_key = temporary_company.api_key.test
51
64
  end
52
65
 
53
- def temporary_api_key
54
- return FIXED_API_KEY
55
-
56
- # TODO: Unfortunately, it's right now impossible to create
57
- # temporary companies properly pre-configured to run all tests
58
- VCR.use_cassette 'TestCase/tmp_company_api_key' do
66
+ def temporary_company
67
+ VCR.use_cassette 'TestCase/tmp_company' do
59
68
  PagarMe.api_key = FIXED_API_KEY
60
- Company.temporary.api_key.test
69
+ PagarMe::Company.temporary
61
70
  end
62
71
  end
63
72
 
64
73
  # Monkey Patch that adds VCR everywhere
65
74
  def self.should(description, &block)
66
- cassette_name = "#{ self.name.split('::').last }/should_#{ description.gsub /\s+/, '_' }"
67
- super(description){ VCR.use_cassette(cassette_name){ self.instance_exec &block } }
75
+ cassette_name = "#{ self.name.split('::').last }/should_#{ description.gsub(/\s+/, '_') }"
76
+ super(description){ VCR.use_cassette(cassette_name){ self.instance_exec(&block) } }
68
77
  end
69
78
  end
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: 2.1.2
4
+ version: 2.1.3
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: 2016-03-18 00:00:00.000000000 Z
12
+ date: 2016-07-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -26,35 +26,35 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: shoulda
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: 3.4.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
- version: '0'
41
+ version: 3.4.0
42
42
  - !ruby/object:Gem::Dependency
43
- name: shoulda
43
+ name: activesupport
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 3.4.0
48
+ version: '3.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
- version: 3.4.0
55
+ version: '3.0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: test-unit
57
+ name: pry
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
@@ -68,7 +68,7 @@ dependencies:
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
- name: webmock
71
+ name: vcr
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
- name: vcr
85
+ name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - ">="
@@ -96,7 +96,21 @@ dependencies:
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
- name: pry
99
+ name: webmock
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: test-unit
100
114
  requirement: !ruby/object:Gem::Requirement
101
115
  requirements:
102
116
  - - ">="
@@ -148,6 +162,7 @@ files:
148
162
  - ".gitignore"
149
163
  - ".travis.yml"
150
164
  - Gemfile
165
+ - LICENSE
151
166
  - README.md
152
167
  - Rakefile
153
168
  - certs/cabundle.pem