balanced 0.7.5 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.rbenv-version +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -0
- data/balanced.gemspec +2 -2
- data/examples/bank_account_debits.rb +2 -1
- data/examples/customers.rb +8 -4
- data/examples/events_and_callbacks.rb +2 -1
- data/examples/examples.rb +6 -5
- data/examples/exception_handling.rb +2 -1
- data/lib/balanced/client.rb +3 -3
- data/lib/balanced/resources/account.rb +5 -3
- data/lib/balanced/resources/card.rb +3 -1
- data/lib/balanced/resources/credit.rb +12 -13
- data/lib/balanced/resources/customer.rb +1 -1
- data/lib/balanced/resources/debit.rb +1 -1
- data/lib/balanced/resources/resource.rb +83 -93
- data/lib/balanced/utils.rb +13 -4
- data/lib/balanced/version.rb +1 -1
- data/scenario.cache +299 -380
- data/scenarios/account_add_card/ruby.mako +3 -3
- data/scenarios/account_capture_hold/request.rb +1 -1
- data/scenarios/account_capture_hold/ruby.mako +1 -1
- data/scenarios/account_create/ruby.mako +1 -1
- data/scenarios/account_create_buyer/ruby.mako +2 -2
- data/scenarios/account_create_debit/request.rb +1 -1
- data/scenarios/account_create_debit/ruby.mako +1 -1
- data/scenarios/account_create_hold/request.rb +1 -1
- data/scenarios/account_create_hold/ruby.mako +1 -1
- data/scenarios/account_create_merchant/ruby.mako +3 -3
- data/scenarios/account_underwrite_business/ruby.mako +1 -1
- data/scenarios/account_underwrite_person/request.rb +1 -1
- data/scenarios/account_underwrite_person/ruby.mako +7 -7
- data/scenarios/bank_account_create/request.rb +1 -1
- data/scenarios/bank_account_create/ruby.mako +5 -5
- data/scenarios/bank_account_delete/ruby.mako +2 -2
- data/scenarios/bank_account_invalid_routing_number/ruby.mako +2 -8
- data/scenarios/bank_account_list/ruby.mako +1 -1
- data/scenarios/bank_account_show/ruby.mako +2 -2
- data/scenarios/bank_account_verification_create/ruby.mako +2 -2
- data/scenarios/bank_account_verification_show/ruby.mako +2 -2
- data/scenarios/bank_account_verification_update/ruby.mako +2 -2
- data/scenarios/callback_create/definition.rb +1 -1
- data/scenarios/callback_create/request.rb +1 -1
- data/scenarios/callback_create/ruby.mako +0 -11
- data/scenarios/callback_delete/definition.rb +1 -1
- data/scenarios/callback_delete/request.rb +1 -1
- data/scenarios/callback_delete/ruby.mako +0 -10
- data/scenarios/callback_list/definition.rb +1 -1
- data/scenarios/callback_list/ruby.mako +0 -10
- data/scenarios/callback_show/definition.rb +1 -1
- data/scenarios/callback_show/ruby.mako +0 -9
- data/scenarios/card_create/request.rb +2 -1
- data/scenarios/card_create/ruby.mako +6 -5
- data/scenarios/card_delete/ruby.mako +2 -2
- data/scenarios/card_invalidate/ruby.mako +2 -2
- data/scenarios/card_list/ruby.mako +1 -1
- data/scenarios/card_show/ruby.mako +2 -2
- data/scenarios/card_update/ruby.mako +2 -2
- data/scenarios/credit_bank_account_list/ruby.mako +2 -2
- data/scenarios/credit_create_existing_bank_account/ruby.mako +3 -3
- data/scenarios/credit_customer_list/ruby.mako +2 -2
- data/scenarios/credit_failed_state/request.rb +2 -2
- data/scenarios/credit_failed_state/ruby.mako +2 -5
- data/scenarios/credit_list/ruby.mako +1 -1
- data/scenarios/credit_paid_state/request.rb +2 -2
- data/scenarios/credit_paid_state/ruby.mako +2 -5
- data/scenarios/credit_pending_state/request.rb +2 -2
- data/scenarios/credit_pending_state/ruby.mako +2 -5
- data/scenarios/credit_show/ruby.mako +2 -2
- data/scenarios/customer_add_bank_account/ruby.mako +3 -3
- data/scenarios/customer_add_card/ruby.mako +3 -3
- data/scenarios/customer_capture_hold/request.rb +1 -1
- data/scenarios/customer_create/ruby.mako +1 -1
- data/scenarios/customer_create_debit/request.rb +1 -1
- data/scenarios/customer_create_debit/ruby.mako +3 -3
- data/scenarios/customer_create_hold/request.rb +1 -1
- data/scenarios/customer_create_hold/ruby.mako +1 -1
- data/scenarios/customer_credit/request.rb +1 -1
- data/scenarios/customer_credit/ruby.mako +2 -2
- data/scenarios/customer_delete/ruby.mako +1 -1
- data/scenarios/debit_create/ruby.mako +3 -3
- data/scenarios/debit_customer_list/ruby.mako +2 -2
- data/scenarios/debit_list/ruby.mako +1 -1
- data/scenarios/debit_refund/ruby.mako +2 -2
- data/scenarios/debit_show/ruby.mako +2 -2
- data/scenarios/debit_update/ruby.mako +2 -2
- data/scenarios/event_list/ruby.mako +1 -1
- data/scenarios/event_show/ruby.mako +2 -2
- data/scenarios/helpers.rb +1 -5
- data/scenarios/hold_capture/ruby.mako +4 -3
- data/scenarios/hold_create/request.rb +2 -2
- data/scenarios/hold_create/ruby.mako +6 -6
- data/scenarios/hold_customer_list/ruby.mako +2 -2
- data/scenarios/hold_list/ruby.mako +1 -1
- data/scenarios/hold_show/ruby.mako +2 -2
- data/scenarios/hold_update/ruby.mako +2 -2
- data/scenarios/hold_void/ruby.mako +2 -2
- data/scenarios/refund_create/ruby.mako +2 -2
- data/scenarios/refund_customer_list/ruby.mako +2 -2
- data/scenarios/refund_list/ruby.mako +1 -1
- data/scenarios/refund_show/ruby.mako +2 -2
- data/scenarios/refund_update/ruby.mako +2 -2
- data/scenarios/render.rb +1 -1
- data/scenarios/render_mako.rb +0 -1
- data/spec/balanced/error_spec.rb +4 -4
- data/spec/balanced/pager_spec.rb +7 -7
- data/spec/balanced/resources/account_spec.rb +51 -30
- data/spec/balanced/resources/bank_account_spec.rb +2 -2
- data/spec/balanced/resources/card_spec.rb +8 -8
- data/spec/balanced/resources/customer_spec.rb +11 -11
- data/spec/balanced/resources/hold_spec.rb +1 -1
- data/spec/balanced/resources/marketplace_spec.rb +12 -10
- data/spec/balanced/resources/resource_spec.rb +1 -1
- data/spec/scenarios_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +16 -15
- data/examples/customers-with-meta-example.rb +0 -141
@@ -3,10 +3,10 @@ Balanced::BankAccount.credit
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
8
|
marketplace = Balanced::Marketplace.my_marketplace
|
9
9
|
|
10
|
-
bank_account = Balanced::BankAccount.find('/v1/bank_accounts/
|
11
|
-
bank_account.credit(:amount => 10000)
|
10
|
+
bank_account = Balanced::BankAccount.find('/v1/bank_accounts/BA5S3reJdyJBbAYKepbneBe2')
|
11
|
+
bank_account.credit(:amount => '10000')
|
12
12
|
% endif
|
@@ -3,10 +3,10 @@ Balanced::Customer.credits
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
8
|
|
9
|
-
customer = Balanced::Customer.find('
|
9
|
+
customer = Balanced::Customer.find('')
|
10
10
|
credits = customer.credits
|
11
11
|
|
12
12
|
% endif
|
@@ -2,9 +2,9 @@
|
|
2
2
|
marketplace = Balanced::Marketplace.my_marketplace
|
3
3
|
|
4
4
|
bank_account_info = {
|
5
|
-
<%= params_to_hash.call(request['
|
5
|
+
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
6
6
|
}
|
7
7
|
credit = Balanced::Credit.new(
|
8
|
-
:amount => <%= request['
|
8
|
+
:amount => <%= request['amount'] %>,
|
9
9
|
:bank_account => bank_account_info
|
10
10
|
).save
|
@@ -3,15 +3,12 @@ Balanced::Credit.save
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
7
|
|
8
8
|
marketplace = Balanced::Marketplace.my_marketplace
|
9
9
|
|
10
10
|
bank_account_info = {
|
11
|
-
|
12
|
-
:name => 'Johann Bernoulli',
|
13
|
-
:routing_number => '121000358',
|
14
|
-
:type => 'checking'
|
11
|
+
:account_number => '9900000004',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
|
15
12
|
}
|
16
13
|
credit = Balanced::Credit.new(
|
17
14
|
:amount => 10000,
|
@@ -2,10 +2,10 @@
|
|
2
2
|
marketplace = Balanced::Marketplace.my_marketplace
|
3
3
|
|
4
4
|
bank_account_info = {
|
5
|
-
<%= params_to_hash.call(request['
|
5
|
+
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
6
6
|
}
|
7
7
|
|
8
8
|
credit = Balanced::Credit.new(
|
9
|
-
:amount => <%= request['
|
9
|
+
:amount => <%= request['amount'] %>,
|
10
10
|
:bank_account => bank_account_info
|
11
11
|
).save
|
@@ -3,15 +3,12 @@ Balanced::Credit.save
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
7
|
|
8
8
|
marketplace = Balanced::Marketplace.my_marketplace
|
9
9
|
|
10
10
|
bank_account_info = {
|
11
|
-
|
12
|
-
:name => 'Johann Bernoulli',
|
13
|
-
:routing_number => '121000358',
|
14
|
-
:type => 'checking'
|
11
|
+
:account_number => '9900000003',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
|
15
12
|
}
|
16
13
|
|
17
14
|
credit = Balanced::Credit.new(
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<%= boiler_plate %>
|
2
2
|
bank_account_info = {
|
3
|
-
<%= params_to_hash.call(request['
|
3
|
+
<%= params_to_hash.call(request['bank_account']).indent(2) %>
|
4
4
|
}
|
5
5
|
|
6
6
|
credit = Balanced::Credit.new(
|
7
|
-
:amount => <%= request['
|
7
|
+
:amount => <%= request['amount'] %>,
|
8
8
|
:bank_account => bank_account_info
|
9
9
|
).save
|
@@ -3,13 +3,10 @@ Balanced::Credit.save
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
|
7
7
|
|
8
8
|
bank_account_info = {
|
9
|
-
|
10
|
-
:name => 'Johann Bernoulli',
|
11
|
-
:routing_number => '121000358',
|
12
|
-
:type => 'checking'
|
9
|
+
:account_number => '9900000001',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
|
13
10
|
}
|
14
11
|
|
15
12
|
credit = Balanced::Credit.new(
|
@@ -3,9 +3,9 @@ Balanced::Credit.find
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
8
|
marketplace = Balanced::Marketplace.my_marketplace
|
9
9
|
|
10
|
-
credit = Balanced::Credit.find('/v1/
|
10
|
+
credit = Balanced::Credit.find('/v1/credits/CR6lEmXFHCW9aNOoLQk9XjfG')
|
11
11
|
% endif
|
@@ -3,9 +3,9 @@ Balanced::Customer.add_bank_account
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
customer = Balanced::Customer.find('/v1/customers/
|
9
|
-
customer.add_bank_account("/v1/bank_accounts/
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/AC6TepGAIZ5HUdhfTZKOoUhh')
|
9
|
+
customer.add_bank_account("/v1/bank_accounts/BA6V90Tau7B5YTGPFjC0PlzA")
|
10
10
|
|
11
11
|
% endif
|
@@ -3,9 +3,9 @@ Balanced::Customer.add_card
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
customer = Balanced::Customer.find('/v1/customers/
|
9
|
-
response = customer.add_card('/v1/marketplaces/TEST-
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1')
|
9
|
+
response = customer.add_card('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/cards/CCQv8XnGsBHF9afrEdc0um3')
|
10
10
|
|
11
11
|
% endif
|
@@ -3,9 +3,9 @@ Balanced::Customer.debit
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
customer = Balanced::Customer.find('/v1/customers/
|
9
|
-
customer.debit(:amount => 5000)
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/AC73sGhakFEQQFbLDX6WSq9y')
|
9
|
+
customer.debit(:amount => '5000')
|
10
10
|
|
11
11
|
% endif
|
@@ -1,2 +1,2 @@
|
|
1
1
|
customer = Balanced::Customer.find('<%=request['customer_uri']%>')
|
2
|
-
customer.credit(:amount => <%=payload['amount']%>)
|
2
|
+
customer.credit(:amount => '<%=payload['amount']%>')
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Balanced::Customer.credit
|
3
3
|
|
4
4
|
% else:
|
5
|
-
customer = Balanced::Customer.find('/v1/customers/
|
6
|
-
customer.credit(:amount => 100)
|
5
|
+
customer = Balanced::Customer.find('/v1/customers/AC6xddA9naLGxrOBkAig9b4a')
|
6
|
+
customer.credit(:amount => '100')
|
7
7
|
|
8
8
|
% endif
|
@@ -3,11 +3,11 @@ Balanced::Customer.debit()
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
customer = Balanced::Customer.find('/v1/customers/
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1')
|
9
9
|
customer.debit(
|
10
|
-
:amount => 5000,
|
10
|
+
:amount => '5000',
|
11
11
|
:appears_on_statement_as => 'Statement text',
|
12
12
|
:description => 'Some descriptive text for the debit in the dashboard'
|
13
13
|
)
|
@@ -3,10 +3,10 @@ Balanced::Customer.debits
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
8
|
|
9
|
-
customer = Balanced::Customer.find('/v1/customers/
|
9
|
+
customer = Balanced::Customer.find('/v1/customers/AC73sGhakFEQQFbLDX6WSq9y')
|
10
10
|
debits = customer.debits
|
11
11
|
|
12
12
|
% endif
|
@@ -3,8 +3,8 @@ Balanced::Debit.refund()
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
debit = Balanced::Debit.find('/v1/marketplaces/TEST-
|
8
|
+
debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/debits/WD7HfOnPU0KhbO9WUEGw0qJq')
|
9
9
|
debit.refund
|
10
10
|
% endif
|
@@ -3,8 +3,8 @@ Balanced::Debit.find()
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
debit = Balanced::Debit.find('/v1/marketplaces/TEST-
|
8
|
+
debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/debits/WD7vMDuOPWwViP0L8mniBOJF')
|
9
9
|
|
10
10
|
% endif
|
@@ -3,9 +3,9 @@ Balanced::Debit.save()
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
debit = Balanced::Debit.find('/v1/marketplaces/TEST-
|
8
|
+
debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/debits/WD7vMDuOPWwViP0L8mniBOJF')
|
9
9
|
debit.description = 'New description for debit'
|
10
10
|
debit.meta = {
|
11
11
|
'anykey' => 'valuegoeshere',
|
@@ -3,8 +3,8 @@
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
event = Balanced::Event.find('/v1/events/
|
8
|
+
event = Balanced::Event.find('/v1/events/EV8c8e419e0e9e11e39281026ba7d31e6f')
|
9
9
|
|
10
10
|
% endif
|
data/scenarios/helpers.rb
CHANGED
@@ -7,11 +7,7 @@ params_to_hash = lambda { |params|
|
|
7
7
|
s << "#{params_to_hash.call(v)}".indent(2)
|
8
8
|
s << "\n}"
|
9
9
|
else
|
10
|
-
|
11
|
-
s << ":#{k} => '#{v}'"
|
12
|
-
else
|
13
|
-
s << ":#{k} => #{v}"
|
14
|
-
end
|
10
|
+
s << ":#{k} => '#{v}'"
|
15
11
|
end
|
16
12
|
if i != params.length - 1
|
17
13
|
s << ",\n"
|
@@ -3,12 +3,13 @@ Balanced::Hold.capture(...)
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
hold = Balanced::Hold.find('/v1/marketplaces/TEST-
|
8
|
+
hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/holds/HLKvFGAzFm4LqiLblBvyCzm')
|
9
9
|
debit = hold.capture(
|
10
10
|
:appears_on_statement_as => 'ShowsUpOnStmt',
|
11
|
-
:description => 'Some descriptive text for the debit in the dashboard'
|
11
|
+
:description => 'Some descriptive text for the debit in the dashboard',
|
12
|
+
:hold_uri => '/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/holds/HLKvFGAzFm4LqiLblBvyCzm'
|
12
13
|
)
|
13
14
|
|
14
15
|
% endif
|
@@ -3,12 +3,12 @@ Balanced::Customer.hold(...)
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
:
|
11
|
-
:
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/ACO702cHD2tPiOCRSKYzVf1')
|
9
|
+
customer.hold(
|
10
|
+
:amount => '5000',
|
11
|
+
:description => 'Some descriptive text for the debit in the dashboard'
|
12
12
|
)
|
13
|
-
|
13
|
+
|
14
14
|
% endif
|
@@ -3,9 +3,9 @@ Balanced::Customer.holds
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
customer = Balanced::Customer.find('/v1/customers/
|
8
|
+
customer = Balanced::Customer.find('/v1/customers/AC8REMQqvuj8Kz8Yc3tpOPg')
|
9
9
|
holds = customer.holds
|
10
10
|
|
11
11
|
% endif
|
@@ -3,8 +3,8 @@ Balanced::Hold.find()
|
|
3
3
|
|
4
4
|
% else:
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
|
7
7
|
|
8
|
-
hold = Balanced::Hold.find('/v1/marketplaces/TEST-
|
8
|
+
hold = Balanced::Hold.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/holds/HLoRDe8mOJ3arKOC95Yd0k0')
|
9
9
|
|
10
10
|
% endif
|