balanced 0.7.5 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/.rbenv-version +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +1 -0
  6. data/balanced.gemspec +2 -2
  7. data/examples/bank_account_debits.rb +2 -1
  8. data/examples/customers.rb +8 -4
  9. data/examples/events_and_callbacks.rb +2 -1
  10. data/examples/examples.rb +6 -5
  11. data/examples/exception_handling.rb +2 -1
  12. data/lib/balanced/client.rb +3 -3
  13. data/lib/balanced/resources/account.rb +5 -3
  14. data/lib/balanced/resources/card.rb +3 -1
  15. data/lib/balanced/resources/credit.rb +12 -13
  16. data/lib/balanced/resources/customer.rb +1 -1
  17. data/lib/balanced/resources/debit.rb +1 -1
  18. data/lib/balanced/resources/resource.rb +83 -93
  19. data/lib/balanced/utils.rb +13 -4
  20. data/lib/balanced/version.rb +1 -1
  21. data/scenario.cache +299 -380
  22. data/scenarios/account_add_card/ruby.mako +3 -3
  23. data/scenarios/account_capture_hold/request.rb +1 -1
  24. data/scenarios/account_capture_hold/ruby.mako +1 -1
  25. data/scenarios/account_create/ruby.mako +1 -1
  26. data/scenarios/account_create_buyer/ruby.mako +2 -2
  27. data/scenarios/account_create_debit/request.rb +1 -1
  28. data/scenarios/account_create_debit/ruby.mako +1 -1
  29. data/scenarios/account_create_hold/request.rb +1 -1
  30. data/scenarios/account_create_hold/ruby.mako +1 -1
  31. data/scenarios/account_create_merchant/ruby.mako +3 -3
  32. data/scenarios/account_underwrite_business/ruby.mako +1 -1
  33. data/scenarios/account_underwrite_person/request.rb +1 -1
  34. data/scenarios/account_underwrite_person/ruby.mako +7 -7
  35. data/scenarios/bank_account_create/request.rb +1 -1
  36. data/scenarios/bank_account_create/ruby.mako +5 -5
  37. data/scenarios/bank_account_delete/ruby.mako +2 -2
  38. data/scenarios/bank_account_invalid_routing_number/ruby.mako +2 -8
  39. data/scenarios/bank_account_list/ruby.mako +1 -1
  40. data/scenarios/bank_account_show/ruby.mako +2 -2
  41. data/scenarios/bank_account_verification_create/ruby.mako +2 -2
  42. data/scenarios/bank_account_verification_show/ruby.mako +2 -2
  43. data/scenarios/bank_account_verification_update/ruby.mako +2 -2
  44. data/scenarios/callback_create/definition.rb +1 -1
  45. data/scenarios/callback_create/request.rb +1 -1
  46. data/scenarios/callback_create/ruby.mako +0 -11
  47. data/scenarios/callback_delete/definition.rb +1 -1
  48. data/scenarios/callback_delete/request.rb +1 -1
  49. data/scenarios/callback_delete/ruby.mako +0 -10
  50. data/scenarios/callback_list/definition.rb +1 -1
  51. data/scenarios/callback_list/ruby.mako +0 -10
  52. data/scenarios/callback_show/definition.rb +1 -1
  53. data/scenarios/callback_show/ruby.mako +0 -9
  54. data/scenarios/card_create/request.rb +2 -1
  55. data/scenarios/card_create/ruby.mako +6 -5
  56. data/scenarios/card_delete/ruby.mako +2 -2
  57. data/scenarios/card_invalidate/ruby.mako +2 -2
  58. data/scenarios/card_list/ruby.mako +1 -1
  59. data/scenarios/card_show/ruby.mako +2 -2
  60. data/scenarios/card_update/ruby.mako +2 -2
  61. data/scenarios/credit_bank_account_list/ruby.mako +2 -2
  62. data/scenarios/credit_create_existing_bank_account/ruby.mako +3 -3
  63. data/scenarios/credit_customer_list/ruby.mako +2 -2
  64. data/scenarios/credit_failed_state/request.rb +2 -2
  65. data/scenarios/credit_failed_state/ruby.mako +2 -5
  66. data/scenarios/credit_list/ruby.mako +1 -1
  67. data/scenarios/credit_paid_state/request.rb +2 -2
  68. data/scenarios/credit_paid_state/ruby.mako +2 -5
  69. data/scenarios/credit_pending_state/request.rb +2 -2
  70. data/scenarios/credit_pending_state/ruby.mako +2 -5
  71. data/scenarios/credit_show/ruby.mako +2 -2
  72. data/scenarios/customer_add_bank_account/ruby.mako +3 -3
  73. data/scenarios/customer_add_card/ruby.mako +3 -3
  74. data/scenarios/customer_capture_hold/request.rb +1 -1
  75. data/scenarios/customer_create/ruby.mako +1 -1
  76. data/scenarios/customer_create_debit/request.rb +1 -1
  77. data/scenarios/customer_create_debit/ruby.mako +3 -3
  78. data/scenarios/customer_create_hold/request.rb +1 -1
  79. data/scenarios/customer_create_hold/ruby.mako +1 -1
  80. data/scenarios/customer_credit/request.rb +1 -1
  81. data/scenarios/customer_credit/ruby.mako +2 -2
  82. data/scenarios/customer_delete/ruby.mako +1 -1
  83. data/scenarios/debit_create/ruby.mako +3 -3
  84. data/scenarios/debit_customer_list/ruby.mako +2 -2
  85. data/scenarios/debit_list/ruby.mako +1 -1
  86. data/scenarios/debit_refund/ruby.mako +2 -2
  87. data/scenarios/debit_show/ruby.mako +2 -2
  88. data/scenarios/debit_update/ruby.mako +2 -2
  89. data/scenarios/event_list/ruby.mako +1 -1
  90. data/scenarios/event_show/ruby.mako +2 -2
  91. data/scenarios/helpers.rb +1 -5
  92. data/scenarios/hold_capture/ruby.mako +4 -3
  93. data/scenarios/hold_create/request.rb +2 -2
  94. data/scenarios/hold_create/ruby.mako +6 -6
  95. data/scenarios/hold_customer_list/ruby.mako +2 -2
  96. data/scenarios/hold_list/ruby.mako +1 -1
  97. data/scenarios/hold_show/ruby.mako +2 -2
  98. data/scenarios/hold_update/ruby.mako +2 -2
  99. data/scenarios/hold_void/ruby.mako +2 -2
  100. data/scenarios/refund_create/ruby.mako +2 -2
  101. data/scenarios/refund_customer_list/ruby.mako +2 -2
  102. data/scenarios/refund_list/ruby.mako +1 -1
  103. data/scenarios/refund_show/ruby.mako +2 -2
  104. data/scenarios/refund_update/ruby.mako +2 -2
  105. data/scenarios/render.rb +1 -1
  106. data/scenarios/render_mako.rb +0 -1
  107. data/spec/balanced/error_spec.rb +4 -4
  108. data/spec/balanced/pager_spec.rb +7 -7
  109. data/spec/balanced/resources/account_spec.rb +51 -30
  110. data/spec/balanced/resources/bank_account_spec.rb +2 -2
  111. data/spec/balanced/resources/card_spec.rb +8 -8
  112. data/spec/balanced/resources/customer_spec.rb +11 -11
  113. data/spec/balanced/resources/hold_spec.rb +1 -1
  114. data/spec/balanced/resources/marketplace_spec.rb +12 -10
  115. data/spec/balanced/resources/resource_spec.rb +1 -1
  116. data/spec/scenarios_spec.rb +1 -1
  117. data/spec/spec_helper.rb +1 -1
  118. metadata +16 -15
  119. data/examples/customers-with-meta-example.rb +0 -141
@@ -3,9 +3,9 @@ Balanced::Hold.save()
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4K6K0PWGyPtXL4LZ42sQSb/holds/HL74dRg2HWc5vQwX0kQ9XQfM')
8
+ hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/holds/HLoRDe8mOJ3arKOC95Yd0k0')
9
9
  hold.description = 'update this description'
10
10
  hold.meta = {
11
11
  'holding.for' => 'user1',
@@ -3,8 +3,8 @@ Balanced::Hold.void()
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4K6K0PWGyPtXL4LZ42sQSb/holds/HL7kzlIJiVvhAmp8xFTMmMPB')
8
+ hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/holds/HL15SKbacqwCIDMvoCQx3GbB')
9
9
  hold.void
10
10
  % endif
@@ -3,9 +3,9 @@ Balanced::Debit.refund()
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4K6K0PWGyPtXL4LZ42sQSb/debits/WD7omMnm45N2JcPZ6fcaRRgY')
8
+ debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/debits/WD1aYGtAuoJxpGSUYr8jVlyy')
9
9
  debit.refund(
10
10
  :description => 'Refund for Order #1111',
11
11
  :meta => {
@@ -3,9 +3,9 @@ Balanced::Customer.refunds
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- customer = Balanced::Customer.find('/v1/customers/CU7gMTGKh2yGHYn1lUxH9STS')
8
+ customer = Balanced::Customer.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1')
9
9
  refunds = customer.refunds
10
10
 
11
11
  % endif
@@ -3,7 +3,7 @@ Balanced::Refund.all
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
8
  marketplace = Balanced::Marketplace.my_marketplace
9
9
 
@@ -3,8 +3,8 @@ Balanced::Refund.find()
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- refund = Balanced::Refund.find('/v1/customers/CU7gMTGKh2yGHYn1lUxH9STS/refunds/RF7qwuLxprQJuVGf7sTAdwKc')
8
+ refund = Balanced::Refund.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1/refunds/RF1cWzNKWwQnCCbeonFdLVkC')
9
9
 
10
10
  % endif
@@ -3,9 +3,9 @@ Balanced::Refund.save()
3
3
 
4
4
  % else:
5
5
  require 'balanced'
6
- Balanced.configure('ak-test-2KZfoLyijij3Y6OyhDAvFRF9tXzelBLpD')
6
+ Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
7
7
 
8
- refund = Balanced::Refund.find('/v1/customers/CU7gMTGKh2yGHYn1lUxH9STS/refunds/RF7qwuLxprQJuVGf7sTAdwKc')
8
+ refund = Balanced::Refund.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1/refunds/RF1cWzNKWwQnCCbeonFdLVkC')
9
9
  refund.description = 'update this description'
10
10
  refund.meta = {
11
11
  'refund.reason' => 'user not happy with product',
data/scenarios/render.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'erb'
2
2
  require 'json'
3
- require_relative 'helpers'
3
+ require File.expand_path('../helpers', __FILE__)
4
4
 
5
5
  parsed_data = JSON.parse(File.read('./scenario.cache'))
6
6
 
@@ -37,7 +37,6 @@ subdir_list.each do |scenario|
37
37
  f.write("\n")
38
38
  end
39
39
  rescue Exception => e
40
- puts e
41
40
  puts "Error rendering #{scenario}'s mako"
42
41
  end
43
42
  end
@@ -2,14 +2,14 @@ require 'spec_helper'
2
2
 
3
3
  describe Balanced::Error, '#response' do
4
4
  it "sets the response in the initializer" do
5
- response = {status: 200}
5
+ response = {:status => 200}
6
6
  Balanced::Error.new(response).response.should == response
7
7
  end
8
8
  end
9
9
 
10
10
  describe Balanced::Error, '#body' do
11
11
  it 'is constructed from the response[:body]' do
12
- response = {body: {}}
12
+ response = {:body => {}}
13
13
  error = Balanced::Error.new(response)
14
14
  error.body.should == response[:body]
15
15
  end
@@ -20,7 +20,7 @@ describe Balanced::Error, '#body' do
20
20
 
21
21
  describe "generating methods from response keys" do
22
22
  before do
23
- response = {body: {foo: 'bar'}}
23
+ response = {:body => {:foo => 'bar'}}
24
24
  @error = Balanced::Error.new(response)
25
25
  end
26
26
 
@@ -44,7 +44,7 @@ describe Balanced::StandardError do
44
44
  end
45
45
 
46
46
  describe Balanced::UnassociatedCardError do
47
- let(:card) { Balanced::Card.new(uri: '/v1/marketplaces/123/cards/235') }
47
+ let(:card) { Balanced::Card.new(:uri => '/v1/marketplaces/123/cards/235') }
48
48
 
49
49
  subject do
50
50
  Balanced::UnassociatedCardError.new(card)
@@ -5,37 +5,37 @@ describe Balanced::Pager do
5
5
  subject { Balanced::Pager.new 'a uri'}
6
6
 
7
7
  it "sets limit based on per" do
8
- params = subject.send(:adjust_pagination_params, per: 5)
8
+ params = subject.send(:adjust_pagination_params, :per => 5)
9
9
  params[:limit].should == 5
10
10
  end
11
11
 
12
12
  it "sets offset based on page and default limit" do
13
- params = subject.send(:adjust_pagination_params, page: 2)
13
+ params = subject.send(:adjust_pagination_params, :page => 2)
14
14
  params[:offset].should == 10
15
15
  end
16
16
 
17
17
  it "sets offset based on page and per" do
18
- params = subject.send(:adjust_pagination_params, page: 2, per: 4)
18
+ params = subject.send(:adjust_pagination_params, :page => 2, :per => 4)
19
19
  params[:offset].should == 4
20
20
  end
21
21
 
22
22
  it "prefers per to limit" do
23
- params = subject.send(:adjust_pagination_params, per: 5, limit: 10)
23
+ params = subject.send(:adjust_pagination_params, :per => 5, :limit => 10)
24
24
  params[:limit].should == 5
25
25
  end
26
26
 
27
27
  it "falls back to limit" do
28
- params = subject.send(:adjust_pagination_params, limit: 3)
28
+ params = subject.send(:adjust_pagination_params, :limit => 3)
29
29
  params[:limit].should == 3
30
30
  end
31
31
 
32
32
  it "prefers page to offset" do
33
- params = subject.send(:adjust_pagination_params, page: 2, offset: 0)
33
+ params = subject.send(:adjust_pagination_params, :page => 2, :offset => 0)
34
34
  params[:offset].should == 10
35
35
  end
36
36
 
37
37
  it "falls back to offset" do
38
- params = subject.send(:adjust_pagination_params, offset: 6)
38
+ params = subject.send(:adjust_pagination_params, :offset => 6)
39
39
  params[:offset].should == 6
40
40
  end
41
41
  end
@@ -51,7 +51,7 @@ describe Balanced::Account, :vcr do
51
51
  @card = Balanced::Card.new(
52
52
  :card_number => "4111111111111111",
53
53
  :expiration_month => "12",
54
- :expiration_year => "2015",
54
+ :expiration_year => "2015"
55
55
  ).save
56
56
 
57
57
  @buyer = Balanced::Account.new(
@@ -78,6 +78,27 @@ describe Balanced::Account, :vcr do
78
78
 
79
79
  end
80
80
 
81
+ describe "#hold", :vcr do
82
+ before do
83
+ @buyer.debit :amount => 1250
84
+ end
85
+
86
+ context "args passed by name via options hash" do
87
+ subject {
88
+ @buyer.hold(
89
+ amount: 1250,
90
+ description: "description",
91
+ meta: {},
92
+ destination_uri: @bank_account.uri
93
+ )
94
+ }
95
+
96
+ its(:amount) { should == 1250 }
97
+ its(:meta) { should == {} }
98
+ its(:description) { should == "description" }
99
+ end
100
+ end
101
+
81
102
  describe "#credit", :vcr do
82
103
  before do
83
104
  @buyer.debit :amount => 1250
@@ -97,10 +118,10 @@ describe Balanced::Account, :vcr do
97
118
  context "args passed by name via options hash" do
98
119
  subject {
99
120
  @merchant.credit(
100
- amount: 1250,
101
- description: "description",
102
- meta: {},
103
- destination_uri: @bank_account.uri
121
+ :amount => 1250,
122
+ :description => "description",
123
+ :meta => {},
124
+ :destination_uri => @bank_account.uri
104
125
  )
105
126
  }
106
127
 
@@ -181,7 +202,7 @@ describe Balanced::Account, :vcr do
181
202
  end
182
203
 
183
204
  describe "when executing" do
184
- it { -> { @merchant.add_bank_account(@new_bank_account.uri) }.should_not raise_error }
205
+ it { expect { @merchant.add_bank_account(@new_bank_account.uri) }.to_not raise_error }
185
206
  end
186
207
 
187
208
  describe "after executing", :vcr do
@@ -205,7 +226,7 @@ describe Balanced::Account, :vcr do
205
226
  end
206
227
 
207
228
  describe "when executing" do
208
- it { -> { @merchant.add_bank_account(@new_bank_account) }.should_not raise_error }
229
+ it { expect { @merchant.add_bank_account(@new_bank_account) }.to_not raise_error }
209
230
  end
210
231
 
211
232
  describe "after executing", :vcr do
@@ -227,7 +248,7 @@ describe Balanced::Account, :vcr do
227
248
  card = Balanced::Card.new(
228
249
  :card_number => "5105105105105100",
229
250
  :expiration_month => "12",
230
- :expiration_year => "2015",
251
+ :expiration_year => "2015"
231
252
  ).save
232
253
  @buyer = Balanced::Account.new(
233
254
  :uri => @marketplace.accounts_uri,
@@ -236,7 +257,7 @@ describe Balanced::Account, :vcr do
236
257
  :name => "Jack Q Buyer"
237
258
  )
238
259
  end
239
- it { -> { @buyer.save }.should_not raise_error }
260
+ it { expect { @buyer.save }.to_not raise_error }
240
261
  end
241
262
 
242
263
  describe "after #save" do
@@ -245,7 +266,7 @@ describe Balanced::Account, :vcr do
245
266
  card = Balanced::Card.new(
246
267
  :card_number => "4111111111111111",
247
268
  :expiration_month => "12",
248
- :expiration_year => "2015",
269
+ :expiration_year => "2015"
249
270
  ).save
250
271
  @buyer = Balanced::Account.new(
251
272
  :uri => @marketplace.accounts_uri,
@@ -331,12 +352,12 @@ describe Balanced::Account, :vcr do
331
352
  card = Balanced::Card.new(
332
353
  :card_number => "4111111111111111",
333
354
  :expiration_month => "12",
334
- :expiration_year => "2015",
355
+ :expiration_year => "2015"
335
356
  ).save
336
357
  @new_card = Balanced::Card.new(
337
358
  :card_number => "4111111111111111",
338
359
  :expiration_month => "1",
339
- :expiration_year => "2015",
360
+ :expiration_year => "2015"
340
361
  ).save
341
362
  @buyer = Balanced::Account.new(
342
363
  :uri => @marketplace.accounts_uri,
@@ -346,7 +367,7 @@ describe Balanced::Account, :vcr do
346
367
  ).save
347
368
  end
348
369
  it do
349
- -> { @buyer.add_card(@new_card.uri) }.should_not raise_error
370
+ expect { @buyer.add_card(@new_card.uri) }.to_not raise_error
350
371
  end
351
372
  end
352
373
  describe "after executing", :vcr do
@@ -354,12 +375,12 @@ describe Balanced::Account, :vcr do
354
375
  card = Balanced::Card.new(
355
376
  :card_number => "4111111111111111",
356
377
  :expiration_month => "12",
357
- :expiration_year => "2015",
378
+ :expiration_year => "2015"
358
379
  ).save
359
380
  @new_card = Balanced::Card.new(
360
381
  :card_number => "5105105105105100",
361
382
  :expiration_month => "1",
362
- :expiration_year => "2017",
383
+ :expiration_year => "2017"
363
384
  ).save
364
385
  @buyer = Balanced::Account.new(
365
386
  :uri => @marketplace.accounts_uri,
@@ -381,12 +402,12 @@ describe Balanced::Account, :vcr do
381
402
  card = Balanced::Card.new(
382
403
  :card_number => "4111111111111111",
383
404
  :expiration_month => "12",
384
- :expiration_year => "2015",
405
+ :expiration_year => "2015"
385
406
  ).save
386
407
  @new_card = Balanced::Card.new(
387
408
  :card_number => "4111111111111111",
388
409
  :expiration_month => "1",
389
- :expiration_year => "2015",
410
+ :expiration_year => "2015"
390
411
  ).save
391
412
  @buyer = Balanced::Account.new(
392
413
  :uri => @marketplace.accounts_uri,
@@ -396,7 +417,7 @@ describe Balanced::Account, :vcr do
396
417
  ).save
397
418
  end
398
419
  it do
399
- -> { @buyer.add_card(@new_card) }.should_not raise_error
420
+ expect { @buyer.add_card(@new_card) }.to_not raise_error
400
421
  end
401
422
  end
402
423
  describe "after executing", :vcr do
@@ -404,12 +425,12 @@ describe Balanced::Account, :vcr do
404
425
  card = Balanced::Card.new(
405
426
  :card_number => "4111111111111111",
406
427
  :expiration_month => "12",
407
- :expiration_year => "2015",
428
+ :expiration_year => "2015"
408
429
  ).save
409
430
  @new_card = Balanced::Card.new(
410
431
  :card_number => "5105105105105100",
411
432
  :expiration_month => "1",
412
- :expiration_year => "2017",
433
+ :expiration_year => "2017"
413
434
  ).save
414
435
  @buyer = Balanced::Account.new(
415
436
  :uri => @marketplace.accounts_uri,
@@ -435,12 +456,12 @@ describe Balanced::Account, :vcr do
435
456
  :postal_code => "94301",
436
457
  :country => "USA",
437
458
  :dob => "1842-01",
438
- :phone_number => "+16505551234",
459
+ :phone_number => "+16505551234"
439
460
  }
440
461
  card = Balanced::Card.new(
441
462
  :card_number => "4111111111111111",
442
463
  :expiration_month => "12",
443
- :expiration_year => "2015",
464
+ :expiration_year => "2015"
444
465
  ).save
445
466
  @buyer = Balanced::Account.new(
446
467
  :uri => @marketplace.accounts_uri,
@@ -451,7 +472,7 @@ describe Balanced::Account, :vcr do
451
472
  end
452
473
 
453
474
  it do
454
- -> { @buyer.promote_to_merchant @merchant_attributes}.should_not raise_error
475
+ expect { @buyer.promote_to_merchant @merchant_attributes}.to_not raise_error
455
476
  end
456
477
  end
457
478
  describe "after executing", :vcr do
@@ -463,12 +484,12 @@ describe Balanced::Account, :vcr do
463
484
  :postal_code => "94301",
464
485
  :country => "USA",
465
486
  :dob => "1842-01",
466
- :phone_number => "+16505551234",
487
+ :phone_number => "+16505551234"
467
488
  }
468
489
  card = Balanced::Card.new(
469
490
  :card_number => "4111111111111111",
470
491
  :expiration_month => "12",
471
- :expiration_year => "2015",
492
+ :expiration_year => "2015"
472
493
  ).save
473
494
  @buyer = Balanced::Account.new(
474
495
  :uri => @marketplace.accounts_uri,
@@ -489,7 +510,7 @@ describe Balanced::Account, :vcr do
489
510
  card = Balanced::Card.new(
490
511
  :card_number => "4111111111111111",
491
512
  :expiration_month => "12",
492
- :expiration_year => "2015",
513
+ :expiration_year => "2015"
493
514
  ).save
494
515
  begin
495
516
  @buyer = Balanced::Account.new(
@@ -560,11 +581,11 @@ describe Balanced::Account, :vcr do
560
581
  card = Balanced::Card.new(
561
582
  :card_number => "5105105105105100",
562
583
  :expiration_month => "12",
563
- :expiration_year => "2015",
584
+ :expiration_year => "2015"
564
585
  ).save
565
586
  Balanced::Marketplace.my_marketplace.create_buyer(
566
587
  :email_address => "john.doe@example.com",
567
- :card_uri => card.uri,
588
+ :card_uri => card.uri
568
589
  )
569
590
  end
570
591
 
@@ -592,11 +613,11 @@ describe Balanced::Account, :vcr do
592
613
  card = Balanced::Card.new(
593
614
  :card_number => "5105105105105100",
594
615
  :expiration_month => "12",
595
- :expiration_year => "2015",
616
+ :expiration_year => "2015"
596
617
  ).save
597
618
  @buyer = Balanced::Marketplace.my_marketplace.create_buyer(
598
619
  :email_address => "john.doe@example.com",
599
- :card_uri => card.uri,
620
+ :card_uri => card.uri
600
621
  )
601
622
  end
602
623
 
@@ -132,7 +132,7 @@ describe Balanced::BankAccount, :vcr do
132
132
 
133
133
  describe 'with appears_on_statement_as', :vcr do
134
134
  before do
135
- @credit = @bank_account.credit(amount: 1000, description: "Testing", appears_on_statement_as: "Test Company")
135
+ @credit = @bank_account.credit(:amount => 1000, :description => "Testing", :appears_on_statement_as => "Test Company")
136
136
  end
137
137
 
138
138
  subject { @credit }
@@ -172,7 +172,7 @@ describe Balanced::BankAccount, :vcr do
172
172
  before do
173
173
  @credit = @bank_account.credit(
174
174
  :amount => 1000,
175
- :description => "Testing",
175
+ :description => "Testing"
176
176
  )
177
177
  end
178
178
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Balanced::Card, '#debit', vcr: true, marketplace: true do
3
+ describe Balanced::Card, '#debit', :vcr => true, :marketplace => true do
4
4
  it 'raises an exception with an unassociated card' do
5
5
  card = Balanced::Card.new
6
6
  expect {
@@ -9,7 +9,7 @@ describe Balanced::Card, '#debit', vcr: true, marketplace: true do
9
9
  end
10
10
  end
11
11
 
12
- describe Balanced::Card, '#hold', vcr: true, marketplace: true do
12
+ describe Balanced::Card, '#hold', :vcr => true, :marketplace => true do
13
13
  it 'raises an exception with an unassociated card' do
14
14
  card = Balanced::Card.new
15
15
  expect {
@@ -18,19 +18,19 @@ describe Balanced::Card, '#hold', vcr: true, marketplace: true do
18
18
  end
19
19
  end
20
20
 
21
- describe Balanced::Card, '#debit', vcr: true, marketplace: true do
21
+ describe Balanced::Card, '#debit', :vcr => true, :marketplace => true do
22
22
  it 'debits the card if an account is set' do
23
23
  # tokenize card
24
24
  card = Balanced::Card.new(
25
- card_number: '4111111111111111',
26
- expiration_year: '2016',
27
- expiration_month: '12')
25
+ :card_number => '4111111111111111',
26
+ :expiration_year => '2016',
27
+ :expiration_month => '12')
28
28
  card.save
29
29
 
30
30
  # associate card to account
31
- Balanced::Account.new(email_address: 'user@example.com', name: 'John Doe', card_uri: card.uri).save
31
+ Balanced::Account.new(:email_address => 'user@example.com', :name => 'John Doe', :card_uri => card.uri).save
32
32
 
33
33
  card = Balanced::Card.find(card.uri)
34
- card.debit(amount: 10000).should be_instance_of Balanced::Debit
34
+ card.debit(:amount => 10000).should be_instance_of Balanced::Debit
35
35
  end
36
36
  end