balanced 0.8.2 → 1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rbenv-version +1 -1
- data/.ruby-version +1 -1
- data/Gemfile +7 -3
- data/README.md +2 -10
- data/Rakefile +4 -18
- data/balanced.gemspec +8 -10
- data/lib/balanced.rb +28 -28
- data/lib/balanced/client.rb +15 -6
- data/lib/balanced/error.rb +21 -12
- data/lib/balanced/pager.rb +66 -25
- data/lib/balanced/resources.rb +18 -17
- data/lib/balanced/resources/api_key.rb +4 -0
- data/lib/balanced/resources/bank_account.rb +26 -75
- data/lib/balanced/resources/callback.rb +2 -0
- data/lib/balanced/resources/card.rb +15 -65
- data/lib/balanced/resources/card_hold.rb +38 -0
- data/lib/balanced/resources/credit.rb +6 -50
- data/lib/balanced/resources/customer.rb +33 -71
- data/lib/balanced/resources/debit.rb +6 -14
- data/lib/balanced/resources/event.rb +6 -0
- data/lib/balanced/resources/funding_instrument.rb +11 -0
- data/lib/balanced/resources/hypermedia.rb +28 -0
- data/lib/balanced/resources/marketplace.rb +5 -203
- data/lib/balanced/resources/order.rb +71 -0
- data/lib/balanced/resources/refund.rb +2 -7
- data/lib/balanced/resources/resource.rb +169 -106
- data/lib/balanced/resources/reversal.rb +2 -8
- data/lib/balanced/resources/transfer.rb +11 -0
- data/lib/balanced/response/balanced_exception_middleware.rb +2 -2
- data/lib/balanced/utils.rb +47 -14
- data/lib/balanced/version.rb +1 -1
- data/scenario.cache +526 -380
- data/scenarios/api_key_create/definition.rb +1 -0
- data/scenarios/api_key_create/request.rb +2 -0
- data/scenarios/api_key_create/ruby.mako +21 -0
- data/scenarios/api_key_delete/definition.rb +1 -0
- data/scenarios/api_key_delete/request.rb +3 -0
- data/scenarios/api_key_delete/ruby.mako +12 -0
- data/scenarios/api_key_list/definition.rb +1 -0
- data/scenarios/api_key_list/request.rb +2 -0
- data/scenarios/api_key_list/ruby.mako +28 -0
- data/scenarios/api_key_show/definition.rb +1 -0
- data/scenarios/api_key_show/request.rb +2 -0
- data/scenarios/api_key_show/ruby.mako +18 -0
- data/scenarios/{customer_add_bank_account → bank_account_associate_to_customer}/definition.rb +0 -0
- data/scenarios/bank_account_associate_to_customer/request.rb +3 -0
- data/scenarios/bank_account_associate_to_customer/ruby.mako +49 -0
- data/scenarios/bank_account_create/definition.rb +1 -1
- data/scenarios/bank_account_create/request.rb +1 -1
- data/scenarios/bank_account_create/ruby.mako +44 -7
- data/scenarios/{credit_create_existing_bank_account → bank_account_credit}/definition.rb +0 -0
- data/scenarios/bank_account_credit/request.rb +3 -0
- data/scenarios/bank_account_credit/ruby.mako +42 -0
- data/scenarios/bank_account_debit/definition.rb +1 -0
- data/scenarios/bank_account_debit/request.rb +5 -0
- data/scenarios/bank_account_debit/ruby.mako +50 -0
- data/scenarios/bank_account_delete/request.rb +1 -1
- data/scenarios/bank_account_delete/ruby.mako +5 -3
- data/scenarios/bank_account_list/ruby.mako +76 -2
- data/scenarios/bank_account_show/definition.rb +1 -1
- data/scenarios/bank_account_show/request.rb +1 -1
- data/scenarios/bank_account_show/ruby.mako +41 -5
- data/scenarios/bank_account_update/definition.rb +1 -0
- data/scenarios/bank_account_update/request.rb +6 -0
- data/scenarios/bank_account_update/ruby.mako +56 -0
- data/scenarios/bank_account_verification_create/request.rb +1 -1
- data/scenarios/bank_account_verification_create/ruby.mako +20 -3
- data/scenarios/bank_account_verification_show/definition.rb +1 -1
- data/scenarios/bank_account_verification_show/request.rb +1 -1
- data/scenarios/bank_account_verification_show/ruby.mako +21 -4
- data/scenarios/bank_account_verification_update/definition.rb +1 -1
- data/scenarios/bank_account_verification_update/request.rb +5 -5
- data/scenarios/bank_account_verification_update/ruby.mako +24 -8
- data/scenarios/callback_create/definition.rb +1 -1
- data/scenarios/callback_create/request.rb +2 -2
- data/scenarios/callback_create/ruby.mako +22 -0
- data/scenarios/callback_delete/definition.rb +1 -1
- data/scenarios/callback_delete/request.rb +2 -2
- data/scenarios/callback_delete/ruby.mako +12 -0
- data/scenarios/callback_list/definition.rb +1 -1
- data/scenarios/callback_list/request.rb +1 -2
- data/scenarios/callback_list/ruby.mako +20 -0
- data/scenarios/callback_show/definition.rb +1 -1
- data/scenarios/callback_show/request.rb +1 -1
- data/scenarios/callback_show/ruby.mako +20 -0
- data/scenarios/{customer_add_card → card_associate_to_customer}/definition.rb +0 -0
- data/scenarios/card_associate_to_customer/request.rb +3 -0
- data/scenarios/card_associate_to_customer/ruby.mako +49 -0
- data/scenarios/card_create/request.rb +1 -2
- data/scenarios/card_create/ruby.mako +44 -7
- data/scenarios/card_debit/definition.rb +1 -0
- data/scenarios/card_debit/request.rb +5 -0
- data/scenarios/card_debit/ruby.mako +49 -0
- data/scenarios/card_delete/request.rb +1 -1
- data/scenarios/card_delete/ruby.mako +5 -3
- data/scenarios/card_hold_capture/definition.rb +1 -0
- data/scenarios/card_hold_capture/request.rb +5 -0
- data/scenarios/card_hold_capture/ruby.mako +49 -0
- data/scenarios/card_hold_create/definition.rb +1 -0
- data/scenarios/card_hold_create/request.rb +5 -0
- data/scenarios/card_hold_create/ruby.mako +38 -0
- data/scenarios/card_hold_list/definition.rb +1 -0
- data/scenarios/card_hold_list/request.rb +2 -0
- data/scenarios/card_hold_list/ruby.mako +60 -0
- data/scenarios/card_hold_show/definition.rb +1 -0
- data/scenarios/card_hold_show/request.rb +2 -0
- data/scenarios/card_hold_show/ruby.mako +36 -0
- data/scenarios/card_hold_update/definition.rb +1 -0
- data/scenarios/card_hold_update/request.rb +7 -0
- data/scenarios/card_hold_update/ruby.mako +42 -0
- data/scenarios/card_hold_void/definition.rb +1 -0
- data/scenarios/card_hold_void/request.rb +3 -0
- data/scenarios/card_hold_void/ruby.mako +36 -0
- data/scenarios/card_list/definition.rb +1 -1
- data/scenarios/card_list/request.rb +1 -1
- data/scenarios/card_list/ruby.mako +78 -5
- data/scenarios/card_show/definition.rb +1 -1
- data/scenarios/card_show/request.rb +1 -1
- data/scenarios/card_show/ruby.mako +42 -4
- data/scenarios/card_update/definition.rb +1 -1
- data/scenarios/card_update/request.rb +1 -1
- data/scenarios/card_update/ruby.mako +45 -4
- data/scenarios/credit_list/request.rb +1 -3
- data/scenarios/credit_list/ruby.mako +34 -4
- data/scenarios/{credit_bank_account_list → credit_list_bank_account}/definition.rb +0 -0
- data/scenarios/credit_list_bank_account/request.rb +3 -0
- data/scenarios/credit_list_bank_account/ruby.mako +13 -0
- data/scenarios/credit_show/definition.rb +1 -1
- data/scenarios/credit_show/request.rb +1 -3
- data/scenarios/credit_show/ruby.mako +35 -5
- data/scenarios/{credit_create_new_bank_account → credit_update}/definition.rb +0 -0
- data/scenarios/credit_update/request.rb +7 -0
- data/scenarios/credit_update/ruby.mako +48 -0
- data/scenarios/customer_create/request.rb +4 -1
- data/scenarios/customer_create/ruby.mako +60 -3
- data/scenarios/customer_delete/request.rb +1 -1
- data/scenarios/customer_delete/ruby.mako +4 -2
- data/scenarios/customer_list/definition.rb +1 -0
- data/scenarios/customer_list/request.rb +2 -0
- data/scenarios/customer_list/ruby.mako +105 -0
- data/scenarios/customer_show/definition.rb +1 -0
- data/scenarios/customer_show/request.rb +2 -0
- data/scenarios/customer_show/ruby.mako +58 -0
- data/scenarios/customer_update/definition.rb +1 -0
- data/scenarios/customer_update/request.rb +7 -0
- data/scenarios/customer_update/ruby.mako +64 -0
- data/scenarios/debit_list/request.rb +1 -3
- data/scenarios/debit_list/ruby.mako +70 -4
- data/scenarios/debit_show/definition.rb +1 -1
- data/scenarios/debit_show/request.rb +1 -1
- data/scenarios/debit_show/ruby.mako +39 -4
- data/scenarios/debit_update/definition.rb +1 -1
- data/scenarios/debit_update/request.rb +1 -1
- data/scenarios/debit_update/ruby.mako +39 -4
- data/scenarios/event_list/definition.rb +1 -1
- data/scenarios/event_list/request.rb +1 -2
- data/scenarios/event_list/ruby.mako +54 -5
- data/scenarios/event_show/definition.rb +1 -1
- data/scenarios/event_show/request.rb +1 -1
- data/scenarios/event_show/ruby.mako +54 -4
- data/scenarios/helpers.rb +29 -2
- data/scenarios/order_create/definition.rb +1 -0
- data/scenarios/order_create/request.rb +5 -0
- data/scenarios/order_create/ruby.mako +46 -0
- data/scenarios/order_list/definition.rb +1 -0
- data/scenarios/order_list/request.rb +2 -0
- data/scenarios/order_list/ruby.mako +42 -0
- data/scenarios/order_show/definition.rb +1 -0
- data/scenarios/order_show/request.rb +2 -0
- data/scenarios/order_show/ruby.mako +44 -0
- data/scenarios/order_update/definition.rb +1 -0
- data/scenarios/order_update/request.rb +7 -0
- data/scenarios/order_update/ruby.mako +50 -0
- data/scenarios/refund_create/definition.rb +1 -1
- data/scenarios/refund_create/request.rb +2 -1
- data/scenarios/refund_create/ruby.mako +33 -5
- data/scenarios/refund_list/request.rb +1 -3
- data/scenarios/refund_list/ruby.mako +30 -4
- data/scenarios/refund_show/definition.rb +1 -1
- data/scenarios/refund_show/request.rb +1 -1
- data/scenarios/refund_show/ruby.mako +32 -4
- data/scenarios/refund_update/definition.rb +1 -1
- data/scenarios/refund_update/request.rb +1 -1
- data/scenarios/refund_update/ruby.mako +32 -4
- data/scenarios/render_mako.rb +59 -4
- data/scenarios/reversal_create/definition.rb +1 -0
- data/scenarios/reversal_create/request.rb +9 -0
- data/scenarios/reversal_create/ruby.mako +45 -0
- data/scenarios/reversal_list/definition.rb +1 -0
- data/scenarios/reversal_list/request.rb +2 -0
- data/scenarios/reversal_list/ruby.mako +36 -0
- data/scenarios/reversal_show/definition.rb +1 -0
- data/scenarios/reversal_show/request.rb +2 -0
- data/scenarios/reversal_show/ruby.mako +37 -0
- data/scenarios/reversal_update/definition.rb +1 -0
- data/scenarios/reversal_update/request.rb +7 -0
- data/scenarios/reversal_update/ruby.mako +44 -0
- data/spec/balanced/error_spec.rb +7 -7
- data/spec/balanced/pager_spec.rb +10 -10
- data/spec/balanced/resources/api_key_spec.rb +6 -35
- data/spec/balanced/resources/bank_account_spec.rb +123 -218
- data/spec/balanced/resources/callback_spec.rb +12 -13
- data/spec/balanced/resources/card_hold_spec.rb +103 -0
- data/spec/balanced/resources/card_spec.rb +101 -27
- data/spec/balanced/resources/credit_spec.rb +69 -35
- data/spec/balanced/resources/customer_spec.rb +91 -271
- data/spec/balanced/resources/debit_spec.rb +95 -0
- data/spec/balanced/resources/marketplace_spec.rb +17 -170
- data/spec/balanced/resources/order_spec.rb +364 -0
- data/spec/balanced/resources/resource_spec.rb +25 -32
- data/spec/balanced_spec.rb +18 -36
- data/spec/client_spec.rb +7 -7
- data/spec/spec_helper.rb +19 -18
- data/spec/utils_spec.rb +5 -5
- metadata +123 -165
- data/examples/bank_account_debits.rb +0 -57
- data/examples/customers.rb +0 -114
- data/examples/events_and_callbacks.rb +0 -81
- data/examples/examples.rb +0 -162
- data/examples/exception_handling.rb +0 -44
- data/lib/balanced/resources/account.rb +0 -179
- data/lib/balanced/resources/hold.rb +0 -61
- data/lib/balanced/resources/invoice.rb +0 -11
- data/lib/balanced/resources/merchant.rb +0 -21
- data/lib/balanced/resources/transaction.rb +0 -17
- data/scenarios/account_add_card/definition.rb +0 -1
- data/scenarios/account_add_card/request.rb +0 -3
- data/scenarios/account_add_card/ruby.mako +0 -11
- data/scenarios/account_capture_hold/definition.rb +0 -1
- data/scenarios/account_capture_hold/request.rb +0 -3
- data/scenarios/account_capture_hold/ruby.mako +0 -11
- data/scenarios/account_create/definition.rb +0 -1
- data/scenarios/account_create/request.rb +0 -2
- data/scenarios/account_create/ruby.mako +0 -10
- data/scenarios/account_create_buyer/definition.rb +0 -1
- data/scenarios/account_create_buyer/request.rb +0 -5
- data/scenarios/account_create_buyer/ruby.mako +0 -13
- data/scenarios/account_create_debit/definition.rb +0 -1
- data/scenarios/account_create_debit/request.rb +0 -3
- data/scenarios/account_create_debit/ruby.mako +0 -11
- data/scenarios/account_create_hold/definition.rb +0 -1
- data/scenarios/account_create_hold/request.rb +0 -3
- data/scenarios/account_create_hold/ruby.mako +0 -11
- data/scenarios/account_create_merchant/definition.rb +0 -1
- data/scenarios/account_create_merchant/request.rb +0 -3
- data/scenarios/account_create_merchant/ruby.mako +0 -11
- data/scenarios/account_underwrite_business/definition.rb +0 -1
- data/scenarios/account_underwrite_business/request.rb +0 -17
- data/scenarios/account_underwrite_business/ruby.mako +0 -37
- data/scenarios/account_underwrite_person/definition.rb +0 -1
- data/scenarios/account_underwrite_person/request.rb +0 -18
- data/scenarios/account_underwrite_person/ruby.mako +0 -31
- data/scenarios/bank_account_find_and_credit/definition.rb +0 -1
- data/scenarios/bank_account_find_and_credit/request.rb +0 -5
- data/scenarios/bank_account_find_and_credit/ruby.mako +0 -13
- data/scenarios/bank_account_find_and_delete/definition.rb +0 -1
- data/scenarios/bank_account_find_and_delete/request.rb +0 -3
- data/scenarios/bank_account_find_and_delete/ruby.mako +0 -10
- data/scenarios/bank_account_invalid_routing_number/definition.rb +0 -1
- data/scenarios/bank_account_invalid_routing_number/request.rb +0 -11
- data/scenarios/bank_account_invalid_routing_number/ruby.mako +0 -16
- data/scenarios/card_invalidate/definition.rb +0 -1
- data/scenarios/card_invalidate/request.rb +0 -3
- data/scenarios/card_invalidate/ruby.mako +0 -10
- data/scenarios/credit_account_list/definition.rb +0 -1
- data/scenarios/credit_account_list/request.rb +0 -3
- data/scenarios/credit_account_list/ruby.mako +0 -10
- data/scenarios/credit_account_merchant_create/definition.rb +0 -1
- data/scenarios/credit_account_merchant_create/request.rb +0 -5
- data/scenarios/credit_account_merchant_create/ruby.mako +0 -12
- data/scenarios/credit_bank_account_list/request.rb +0 -5
- data/scenarios/credit_bank_account_list/ruby.mako +0 -12
- data/scenarios/credit_create_existing_bank_account/request.rb +0 -5
- data/scenarios/credit_create_existing_bank_account/ruby.mako +0 -12
- data/scenarios/credit_create_new_bank_account/request.rb +0 -10
- data/scenarios/credit_create_new_bank_account/ruby.mako +0 -21
- data/scenarios/credit_customer_list/definition.rb +0 -1
- data/scenarios/credit_customer_list/request.rb +0 -4
- data/scenarios/credit_customer_list/ruby.mako +0 -12
- data/scenarios/credit_failed_state/definition.rb +0 -1
- data/scenarios/credit_failed_state/request.rb +0 -10
- data/scenarios/credit_failed_state/ruby.mako +0 -18
- data/scenarios/credit_paid_state/definition.rb +0 -1
- data/scenarios/credit_paid_state/request.rb +0 -11
- data/scenarios/credit_paid_state/ruby.mako +0 -19
- data/scenarios/credit_pending_state/definition.rb +0 -1
- data/scenarios/credit_pending_state/request.rb +0 -9
- data/scenarios/credit_pending_state/ruby.mako +0 -17
- data/scenarios/customer_add_bank_account/request.rb +0 -3
- data/scenarios/customer_add_bank_account/ruby.mako +0 -11
- data/scenarios/customer_add_card/request.rb +0 -3
- data/scenarios/customer_add_card/ruby.mako +0 -11
- data/scenarios/customer_capture_hold/definition.rb +0 -1
- data/scenarios/customer_capture_hold/request.rb +0 -3
- data/scenarios/customer_capture_hold/ruby.mako +0 -0
- data/scenarios/customer_create_debit/definition.rb +0 -1
- data/scenarios/customer_create_debit/request.rb +0 -3
- data/scenarios/customer_create_debit/ruby.mako +0 -11
- data/scenarios/customer_create_hold/definition.rb +0 -1
- data/scenarios/customer_create_hold/request.rb +0 -3
- data/scenarios/customer_create_hold/ruby.mako +0 -11
- data/scenarios/customer_credit/definition.rb +0 -1
- data/scenarios/customer_credit/request.rb +0 -2
- data/scenarios/customer_credit/ruby.mako +0 -8
- data/scenarios/debit_account_list/definition.rb +0 -1
- data/scenarios/debit_account_list/request.rb +0 -3
- data/scenarios/debit_account_list/ruby.mako +0 -10
- data/scenarios/debit_create/definition.rb +0 -1
- data/scenarios/debit_create/request.rb +0 -5
- data/scenarios/debit_create/ruby.mako +0 -15
- data/scenarios/debit_customer_list/definition.rb +0 -1
- data/scenarios/debit_customer_list/request.rb +0 -4
- data/scenarios/debit_customer_list/ruby.mako +0 -12
- data/scenarios/debit_refund/definition.rb +0 -1
- data/scenarios/debit_refund/request.rb +0 -3
- data/scenarios/debit_refund/ruby.mako +0 -10
- data/scenarios/delete.rb +0 -7
- data/scenarios/event_replay/definition.rb +0 -0
- data/scenarios/event_replay/request.rb +0 -1
- data/scenarios/event_replay/ruby.mako +0 -0
- data/scenarios/execute.rb +0 -27
- data/scenarios/hold_account_list/definition.rb +0 -1
- data/scenarios/hold_account_list/request.rb +0 -3
- data/scenarios/hold_account_list/ruby.mako +0 -10
- data/scenarios/hold_capture/definition.rb +0 -1
- data/scenarios/hold_capture/request.rb +0 -5
- data/scenarios/hold_capture/ruby.mako +0 -15
- data/scenarios/hold_create/definition.rb +0 -1
- data/scenarios/hold_create/request.rb +0 -5
- data/scenarios/hold_create/ruby.mako +0 -14
- data/scenarios/hold_customer_list/definition.rb +0 -1
- data/scenarios/hold_customer_list/request.rb +0 -3
- data/scenarios/hold_customer_list/ruby.mako +0 -11
- data/scenarios/hold_list/definition.rb +0 -1
- data/scenarios/hold_list/request.rb +0 -4
- data/scenarios/hold_list/ruby.mako +0 -11
- data/scenarios/hold_show/definition.rb +0 -1
- data/scenarios/hold_show/request.rb +0 -2
- data/scenarios/hold_show/ruby.mako +0 -10
- data/scenarios/hold_update/definition.rb +0 -1
- data/scenarios/hold_update/request.rb +0 -7
- data/scenarios/hold_update/ruby.mako +0 -16
- data/scenarios/hold_void/definition.rb +0 -1
- data/scenarios/hold_void/request.rb +0 -3
- data/scenarios/hold_void/ruby.mako +0 -10
- data/scenarios/refund_account_list/definition.rb +0 -1
- data/scenarios/refund_account_list/request.rb +0 -3
- data/scenarios/refund_account_list/ruby.mako +0 -10
- data/scenarios/refund_customer_list/definition.rb +0 -1
- data/scenarios/refund_customer_list/request.rb +0 -3
- data/scenarios/refund_customer_list/ruby.mako +0 -11
- data/scenarios/render.rb +0 -32
- data/scenarios/render_one.rb +0 -32
- data/spec/balanced/resources/account_spec.rb +0 -636
- data/spec/balanced/resources/hold_spec.rb +0 -48
- data/spec/balanced/resources/merchant_spec.rb +0 -6
- data/spec/scenarios_spec.rb +0 -39
- data/upload_docs.rb +0 -40
@@ -1 +1 @@
|
|
1
|
-
Balanced::Debit.
|
1
|
+
Balanced::Debit.fetch
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%= boiler_plate %>
|
2
|
-
debit = Balanced::Debit.
|
2
|
+
debit = Balanced::Debit.fetch('<%= request['uri'] %>')
|
@@ -1,10 +1,45 @@
|
|
1
1
|
% if mode == 'definition':
|
2
|
-
Balanced::Debit.
|
2
|
+
Balanced::Debit.fetch
|
3
3
|
|
4
|
-
%
|
4
|
+
% elif mode == 'request':
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
7
|
|
8
|
-
debit = Balanced::Debit.
|
8
|
+
debit = Balanced::Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM')
|
9
|
+
|
10
|
+
% elif mode == 'response':
|
11
|
+
#<Balanced::Debit:0x007fdc9d1e3058
|
12
|
+
@attributes=
|
13
|
+
{"amount"=>5000,
|
14
|
+
"appears_on_statement_as"=>"BAL*Statement text",
|
15
|
+
"created_at"=>"2014-01-27T22:57:05.511023Z",
|
16
|
+
"currency"=>"USD",
|
17
|
+
"description"=>"Some descriptive text for the debit in the dashboard",
|
18
|
+
"failure_reason"=>nil,
|
19
|
+
"failure_reason_code"=>nil,
|
20
|
+
"href"=>"/debits/WD2Fd3jVcMZEWyXHtG3U1LRM",
|
21
|
+
"id"=>"WD2Fd3jVcMZEWyXHtG3U1LRM",
|
22
|
+
"links"=>
|
23
|
+
{"customer"=>nil,
|
24
|
+
"dispute"=>nil,
|
25
|
+
"order"=>nil,
|
26
|
+
"source"=>"CC2uc8iPDjgyxOXHVtnZloyI"},
|
27
|
+
"meta"=>{},
|
28
|
+
"status"=>"succeeded",
|
29
|
+
"transaction_number"=>"W906-153-1439",
|
30
|
+
"updated_at"=>"2014-01-27T22:57:10.153696Z"},
|
31
|
+
@hyperlinks=
|
32
|
+
{"customer"=>
|
33
|
+
#<Proc:0x007fdc9d1e1e10/lib/balanced/utils.rb:6 (lambda)>,
|
34
|
+
"dispute"=>
|
35
|
+
#<Proc:0x007fdc9d1e1320/lib/balanced/utils.rb:6 (lambda)>,
|
36
|
+
"events"=>
|
37
|
+
#<Proc:0x007fdc9d1db8d0/lib/balanced/utils.rb:6 (lambda)>,
|
38
|
+
"order"=>
|
39
|
+
#<Proc:0x007fdc9d1dac28/lib/balanced/utils.rb:6 (lambda)>,
|
40
|
+
"refunds"=>
|
41
|
+
#<Proc:0x007fdc9d1d8770/lib/balanced/utils.rb:6 (lambda)>,
|
42
|
+
"source"=>
|
43
|
+
#<Proc:0x007fdc9d1d2e88/lib/balanced/resources/resource.rb:60 (lambda)>}>
|
9
44
|
|
10
45
|
% endif
|
@@ -1 +1 @@
|
|
1
|
-
Balanced::Debit.save
|
1
|
+
Balanced::Debit.save
|
@@ -1,11 +1,11 @@
|
|
1
1
|
% if mode == 'definition':
|
2
|
-
Balanced::Debit.save
|
2
|
+
Balanced::Debit.save
|
3
3
|
|
4
|
-
%
|
4
|
+
% elif mode == 'request':
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
7
|
|
8
|
-
debit = Balanced::Debit.
|
8
|
+
debit = Balanced::Debit.fetch('/debits/WD2Fd3jVcMZEWyXHtG3U1LRM')
|
9
9
|
debit.description = 'New description for debit'
|
10
10
|
debit.meta = {
|
11
11
|
'anykey' => 'valuegoeshere',
|
@@ -13,4 +13,39 @@ debit.meta = {
|
|
13
13
|
}
|
14
14
|
debit.save
|
15
15
|
|
16
|
+
% elif mode == 'response':
|
17
|
+
#<Balanced::Debit:0x007fdc9d1b2750
|
18
|
+
@attributes=
|
19
|
+
{"amount"=>5000,
|
20
|
+
"appears_on_statement_as"=>"BAL*Statement text",
|
21
|
+
"created_at"=>"2014-01-27T22:57:05.511023Z",
|
22
|
+
"currency"=>"USD",
|
23
|
+
"description"=>"New description for debit",
|
24
|
+
"failure_reason"=>nil,
|
25
|
+
"failure_reason_code"=>nil,
|
26
|
+
"href"=>"/debits/WD2Fd3jVcMZEWyXHtG3U1LRM",
|
27
|
+
"id"=>"WD2Fd3jVcMZEWyXHtG3U1LRM",
|
28
|
+
"links"=>
|
29
|
+
{"customer"=>nil,
|
30
|
+
"dispute"=>nil,
|
31
|
+
"order"=>nil,
|
32
|
+
"source"=>"CC2uc8iPDjgyxOXHVtnZloyI"},
|
33
|
+
"meta"=>{"anykey"=>"valuegoeshere", "facebook.id"=>"1234567890"},
|
34
|
+
"status"=>"succeeded",
|
35
|
+
"transaction_number"=>"W906-153-1439",
|
36
|
+
"updated_at"=>"2014-01-27T22:57:53.776191Z"},
|
37
|
+
@hyperlinks=
|
38
|
+
{"customer"=>
|
39
|
+
#<Proc:0x007fdc9d1b1800/lib/balanced/utils.rb:6 (lambda)>,
|
40
|
+
"dispute"=>
|
41
|
+
#<Proc:0x007fdc9d1b0dd8/lib/balanced/utils.rb:6 (lambda)>,
|
42
|
+
"events"=>
|
43
|
+
#<Proc:0x007fdc9d1ab478/lib/balanced/utils.rb:6 (lambda)>,
|
44
|
+
"order"=>
|
45
|
+
#<Proc:0x007fdc9d1aa938/lib/balanced/utils.rb:6 (lambda)>,
|
46
|
+
"refunds"=>
|
47
|
+
#<Proc:0x007fdc9d1a85c0/lib/balanced/utils.rb:6 (lambda)>,
|
48
|
+
"source"=>
|
49
|
+
#<Proc:0x007fdc9d1a3228/lib/balanced/resources/resource.rb:60 (lambda)>}>
|
50
|
+
|
16
51
|
% endif
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Balanced::Event.all
|
@@ -1,10 +1,59 @@
|
|
1
1
|
% if mode == 'definition':
|
2
|
-
|
2
|
+
Balanced::Event.all
|
3
3
|
|
4
|
-
%
|
4
|
+
% elif mode == 'request':
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
|
+
|
8
|
+
events = Balanced::Event.all
|
9
|
+
% elif mode == 'response':
|
10
|
+
[#<Balanced::Event:0x007fdc9d1787a8
|
11
|
+
@attributes=
|
12
|
+
{"callback_statuses"=>
|
13
|
+
{"failed"=>0, "pending"=>0, "retrying"=>0, "succeeded"=>0},
|
14
|
+
"entity"=>
|
15
|
+
{"customers"=>
|
16
|
+
[{"address"=>
|
17
|
+
{"city"=>nil,
|
18
|
+
"country_code"=>nil,
|
19
|
+
"line1"=>nil,
|
20
|
+
"line2"=>nil,
|
21
|
+
"postal_code"=>nil,
|
22
|
+
"state"=>nil},
|
23
|
+
"business_name"=>nil,
|
24
|
+
"created_at"=>"2014-01-27T22:55:50.253066Z",
|
25
|
+
"dob_month"=>nil,
|
26
|
+
"dob_year"=>nil,
|
27
|
+
"ein"=>nil,
|
28
|
+
"email"=>nil,
|
29
|
+
"href"=>"/customers/CU1iDnBalzHoZg47Np92rNrV",
|
30
|
+
"id"=>"CU1iDnBalzHoZg47Np92rNrV",
|
31
|
+
"links"=>{"destination"=>nil, "source"=>nil},
|
32
|
+
"merchant_status"=>"no-match",
|
33
|
+
"meta"=>{},
|
34
|
+
"name"=>nil,
|
35
|
+
"phone"=>nil,
|
36
|
+
"ssn_last4"=>nil,
|
37
|
+
"updated_at"=>"2014-01-27T22:55:50.767858Z"}],
|
38
|
+
"links"=>
|
39
|
+
{"customers.bank_accounts"=>"/customers/{customers.id}/bank_accounts",
|
40
|
+
"customers.card_holds"=>"/customers/{customers.id}/card_holds",
|
41
|
+
"customers.cards"=>"/customers/{customers.id}/cards",
|
42
|
+
"customers.credits"=>"/customers/{customers.id}/credits",
|
43
|
+
"customers.debits"=>"/customers/{customers.id}/debits",
|
44
|
+
"customers.destination"=>"/resources/{customers.destination}",
|
45
|
+
"customers.orders"=>"/customers/{customers.id}/orders",
|
46
|
+
"customers.refunds"=>"/customers/{customers.id}/refunds",
|
47
|
+
"customers.reversals"=>"/customers/{customers.id}/reversals",
|
48
|
+
"customers.source"=>"/resources/{customers.source}",
|
49
|
+
"customers.transactions"=>"/customers/{customers.id}/transactions"}},
|
50
|
+
"href"=>"/events/EV2abbb98487a611e3a86f026ba7d31e6f",
|
51
|
+
"id"=>"EV2abbb98487a611e3a86f026ba7d31e6f",
|
52
|
+
"links"=>{},
|
53
|
+
"occurred_at"=>"2014-01-27T22:55:50.767000Z",
|
54
|
+
"type"=>"account.created"},
|
55
|
+
@hyperlinks=
|
56
|
+
{"callbacks"=>
|
57
|
+
#<Proc:0x007fdc9d17a968/lib/balanced/utils.rb:6 (lambda)>}>]
|
7
58
|
|
8
|
-
marketplace = Balanced::Marketplace.my_marketplace
|
9
|
-
events = Balanced::Event.all(:limit => 2)
|
10
59
|
% endif
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Balanced::Event.fetch
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<%= boiler_plate %>
|
2
|
-
event = Balanced::Event.
|
2
|
+
event = Balanced::Event.fetch('<%= request['uri'] %>')
|
@@ -1,10 +1,60 @@
|
|
1
1
|
% if mode == 'definition':
|
2
|
-
|
2
|
+
Balanced::Event.fetch
|
3
3
|
|
4
|
-
%
|
4
|
+
% elif mode == 'request':
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
7
|
|
8
|
-
event = Balanced::Event.
|
8
|
+
event = Balanced::Event.fetch('/events/EV2abbb98487a611e3a86f026ba7d31e6f')
|
9
|
+
|
10
|
+
% elif mode == 'response':
|
11
|
+
#<Balanced::Event:0x007fdc9d13b420
|
12
|
+
@attributes=
|
13
|
+
{"callback_statuses"=>
|
14
|
+
{"failed"=>0, "pending"=>0, "retrying"=>0, "succeeded"=>0},
|
15
|
+
"entity"=>
|
16
|
+
{"customers"=>
|
17
|
+
[{"address"=>
|
18
|
+
{"city"=>nil,
|
19
|
+
"country_code"=>nil,
|
20
|
+
"line1"=>nil,
|
21
|
+
"line2"=>nil,
|
22
|
+
"postal_code"=>nil,
|
23
|
+
"state"=>nil},
|
24
|
+
"business_name"=>nil,
|
25
|
+
"created_at"=>"2014-01-27T22:55:50.253066Z",
|
26
|
+
"dob_month"=>nil,
|
27
|
+
"dob_year"=>nil,
|
28
|
+
"ein"=>nil,
|
29
|
+
"email"=>nil,
|
30
|
+
"href"=>"/customers/CU1iDnBalzHoZg47Np92rNrV",
|
31
|
+
"id"=>"CU1iDnBalzHoZg47Np92rNrV",
|
32
|
+
"links"=>{"destination"=>nil, "source"=>nil},
|
33
|
+
"merchant_status"=>"no-match",
|
34
|
+
"meta"=>{},
|
35
|
+
"name"=>nil,
|
36
|
+
"phone"=>nil,
|
37
|
+
"ssn_last4"=>nil,
|
38
|
+
"updated_at"=>"2014-01-27T22:55:50.767858Z"}],
|
39
|
+
"links"=>
|
40
|
+
{"customers.bank_accounts"=>"/customers/{customers.id}/bank_accounts",
|
41
|
+
"customers.card_holds"=>"/customers/{customers.id}/card_holds",
|
42
|
+
"customers.cards"=>"/customers/{customers.id}/cards",
|
43
|
+
"customers.credits"=>"/customers/{customers.id}/credits",
|
44
|
+
"customers.debits"=>"/customers/{customers.id}/debits",
|
45
|
+
"customers.destination"=>"/resources/{customers.destination}",
|
46
|
+
"customers.orders"=>"/customers/{customers.id}/orders",
|
47
|
+
"customers.refunds"=>"/customers/{customers.id}/refunds",
|
48
|
+
"customers.reversals"=>"/customers/{customers.id}/reversals",
|
49
|
+
"customers.source"=>"/resources/{customers.source}",
|
50
|
+
"customers.transactions"=>"/customers/{customers.id}/transactions"}},
|
51
|
+
"href"=>"/events/EV2abbb98487a611e3a86f026ba7d31e6f",
|
52
|
+
"id"=>"EV2abbb98487a611e3a86f026ba7d31e6f",
|
53
|
+
"links"=>{},
|
54
|
+
"occurred_at"=>"2014-01-27T22:55:50.767000Z",
|
55
|
+
"type"=>"account.created"},
|
56
|
+
@hyperlinks=
|
57
|
+
{"callbacks"=>
|
58
|
+
#<Proc:0x007fdc9d139468/lib/balanced/utils.rb:6 (lambda)>}>
|
9
59
|
|
10
60
|
% endif
|
data/scenarios/helpers.rb
CHANGED
@@ -7,7 +7,11 @@ params_to_hash = lambda { |params|
|
|
7
7
|
s << "#{params_to_hash.call(v)}".indent(2)
|
8
8
|
s << "\n}"
|
9
9
|
else
|
10
|
-
|
10
|
+
if v.is_a? String
|
11
|
+
s << ":#{k} => '#{v}'"
|
12
|
+
else
|
13
|
+
s << ":#{k} => #{v}"
|
14
|
+
end
|
11
15
|
end
|
12
16
|
if i != params.length - 1
|
13
17
|
s << ",\n"
|
@@ -27,8 +31,31 @@ params_to_hash_for_args = lambda { |payload|
|
|
27
31
|
end
|
28
32
|
}
|
29
33
|
|
34
|
+
|
35
|
+
params_to_key_word_arguments = lambda { |params|
|
36
|
+
"".tap do |s|
|
37
|
+
params.each_with_index do |(k, v), i|
|
38
|
+
if v.is_a? Hash
|
39
|
+
s << "#{k} = {\n"
|
40
|
+
s << "#{params_to_key_word_arguments.call(v)}".indent(2)
|
41
|
+
s << "\n}"
|
42
|
+
else
|
43
|
+
if v.is_a? String
|
44
|
+
s << "#{k} = '#{v}'"
|
45
|
+
else
|
46
|
+
s << "#{k} = #{v}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
if i != params.length - 1
|
50
|
+
s << ",\n"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
}
|
55
|
+
|
30
56
|
@helpers = {:params_to_hash => params_to_hash,
|
31
|
-
:params_to_hash_for_args => params_to_hash_for_args
|
57
|
+
:params_to_hash_for_args => params_to_hash_for_args,
|
58
|
+
:params_to_key_word_arguments => params_to_key_word_arguments}
|
32
59
|
|
33
60
|
String.class_eval do
|
34
61
|
def indent(count, char = ' ')
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Customer.create_order
|
@@ -0,0 +1,46 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Customer.create_order
|
3
|
+
|
4
|
+
% elif mode == 'request':
|
5
|
+
require 'balanced'
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
|
+
|
8
|
+
merchant_customer = Balanced::Customer.fetch('/customers/CU3eeasZ9yQ86uzzIYZkrPGg')
|
9
|
+
merchant_customer.create_order(
|
10
|
+
:description => 'Order #12341234'
|
11
|
+
)
|
12
|
+
% elif mode == 'response':
|
13
|
+
#<Balanced::Order:0x007fdc9c1eb948
|
14
|
+
@attributes=
|
15
|
+
{"amount"=>0,
|
16
|
+
"amount_escrowed"=>0,
|
17
|
+
"created_at"=>"2014-01-27T22:58:01.115720Z",
|
18
|
+
"currency"=>"USD",
|
19
|
+
"delivery_address"=>
|
20
|
+
{"city"=>nil,
|
21
|
+
"country_code"=>nil,
|
22
|
+
"line1"=>nil,
|
23
|
+
"line2"=>nil,
|
24
|
+
"postal_code"=>nil,
|
25
|
+
"state"=>nil},
|
26
|
+
"description"=>"Order #12341234",
|
27
|
+
"href"=>"/orders/OR3FOihZa7lMHdAP5p8BJZVY",
|
28
|
+
"id"=>"OR3FOihZa7lMHdAP5p8BJZVY",
|
29
|
+
"links"=>{"merchant"=>"CU3eeasZ9yQ86uzzIYZkrPGg"},
|
30
|
+
"meta"=>{},
|
31
|
+
"updated_at"=>"2014-01-27T22:58:01.115723Z"},
|
32
|
+
@hyperlinks=
|
33
|
+
{"buyers"=>
|
34
|
+
#<Proc:0x007fdc9c1e2320/lib/balanced/utils.rb:6 (lambda)>,
|
35
|
+
"credits"=>
|
36
|
+
#<Proc:0x007fdc9c1e2028/lib/balanced/utils.rb:6 (lambda)>,
|
37
|
+
"debits"=>
|
38
|
+
#<Proc:0x007fdc9c1d85a0/lib/balanced/utils.rb:6 (lambda)>,
|
39
|
+
"merchant"=>
|
40
|
+
#<Proc:0x007fdc9c1da990/lib/balanced/resources/resource.rb:60 (lambda)>,
|
41
|
+
"refunds"=>
|
42
|
+
#<Proc:0x007fdc9c1d84d8/lib/balanced/utils.rb:6 (lambda)>,
|
43
|
+
"reversals"=>
|
44
|
+
#<Proc:0x007fdc9c1d2588/lib/balanced/utils.rb:6 (lambda)>}>
|
45
|
+
|
46
|
+
% endif
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Order.all
|
@@ -0,0 +1,42 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Order.all
|
3
|
+
% elif mode == 'request':
|
4
|
+
require 'balanced'
|
5
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
6
|
+
|
7
|
+
orders = Balanced::Order.all
|
8
|
+
% elif mode == 'response':
|
9
|
+
[#<Balanced::Order:0x007fdc9c1a8ff8
|
10
|
+
@attributes=
|
11
|
+
{"amount"=>0,
|
12
|
+
"amount_escrowed"=>0,
|
13
|
+
"created_at"=>"2014-01-27T22:58:01.115720Z",
|
14
|
+
"currency"=>"USD",
|
15
|
+
"delivery_address"=>
|
16
|
+
{"city"=>nil,
|
17
|
+
"country_code"=>nil,
|
18
|
+
"line1"=>nil,
|
19
|
+
"line2"=>nil,
|
20
|
+
"postal_code"=>nil,
|
21
|
+
"state"=>nil},
|
22
|
+
"description"=>"Order #12341234",
|
23
|
+
"href"=>"/orders/OR3FOihZa7lMHdAP5p8BJZVY",
|
24
|
+
"id"=>"OR3FOihZa7lMHdAP5p8BJZVY",
|
25
|
+
"links"=>{"merchant"=>"CU3eeasZ9yQ86uzzIYZkrPGg"},
|
26
|
+
"meta"=>{},
|
27
|
+
"updated_at"=>"2014-01-27T22:58:01.115723Z"},
|
28
|
+
@hyperlinks=
|
29
|
+
{"buyers"=>
|
30
|
+
#<Proc:0x007fdc9c1a2b30/lib/balanced/utils.rb:6 (lambda)>,
|
31
|
+
"credits"=>
|
32
|
+
#<Proc:0x007fdc9c198b30/lib/balanced/utils.rb:6 (lambda)>,
|
33
|
+
"debits"=>
|
34
|
+
#<Proc:0x007fdc9c19a0c0/lib/balanced/utils.rb:6 (lambda)>,
|
35
|
+
"merchant"=>
|
36
|
+
#<Proc:0x007fdc9c198108/lib/balanced/resources/resource.rb:60 (lambda)>,
|
37
|
+
"refunds"=>
|
38
|
+
#<Proc:0x007fdc9c1916a0/lib/balanced/utils.rb:6 (lambda)>,
|
39
|
+
"reversals"=>
|
40
|
+
#<Proc:0x007fdc9c18b958/lib/balanced/utils.rb:6 (lambda)>}>]
|
41
|
+
|
42
|
+
% endif
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Order.fetch
|
@@ -0,0 +1,44 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Order.fetch
|
3
|
+
|
4
|
+
% elif mode == 'request':
|
5
|
+
require 'balanced'
|
6
|
+
Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
|
7
|
+
|
8
|
+
order = Balanced::Order.fetch('/orders/OR3FOihZa7lMHdAP5p8BJZVY')
|
9
|
+
|
10
|
+
% elif mode == 'response':
|
11
|
+
#<Balanced::Order:0x007fdc9c166b80
|
12
|
+
@attributes=
|
13
|
+
{"amount"=>0,
|
14
|
+
"amount_escrowed"=>0,
|
15
|
+
"created_at"=>"2014-01-27T22:58:01.115720Z",
|
16
|
+
"currency"=>"USD",
|
17
|
+
"delivery_address"=>
|
18
|
+
{"city"=>nil,
|
19
|
+
"country_code"=>nil,
|
20
|
+
"line1"=>nil,
|
21
|
+
"line2"=>nil,
|
22
|
+
"postal_code"=>nil,
|
23
|
+
"state"=>nil},
|
24
|
+
"description"=>"Order #12341234",
|
25
|
+
"href"=>"/orders/OR3FOihZa7lMHdAP5p8BJZVY",
|
26
|
+
"id"=>"OR3FOihZa7lMHdAP5p8BJZVY",
|
27
|
+
"links"=>{"merchant"=>"CU3eeasZ9yQ86uzzIYZkrPGg"},
|
28
|
+
"meta"=>{},
|
29
|
+
"updated_at"=>"2014-01-27T22:58:01.115723Z"},
|
30
|
+
@hyperlinks=
|
31
|
+
{"buyers"=>
|
32
|
+
#<Proc:0x007fdc9c15e570/lib/balanced/utils.rb:6 (lambda)>,
|
33
|
+
"credits"=>
|
34
|
+
#<Proc:0x007fdc9c15c428/lib/balanced/utils.rb:6 (lambda)>,
|
35
|
+
"debits"=>
|
36
|
+
#<Proc:0x007fdc9c13f2d8/lib/balanced/utils.rb:6 (lambda)>,
|
37
|
+
"merchant"=>
|
38
|
+
#<Proc:0x007fdc9c14c988/lib/balanced/resources/resource.rb:60 (lambda)>,
|
39
|
+
"refunds"=>
|
40
|
+
#<Proc:0x007fdc9c136d18/lib/balanced/utils.rb:6 (lambda)>,
|
41
|
+
"reversals"=>
|
42
|
+
#<Proc:0x007fdc9c1330a0/lib/balanced/utils.rb:6 (lambda)>}>
|
43
|
+
|
44
|
+
% endif
|