balanced 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +10 -6
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/balanced/resources.rb +2 -0
- data/lib/balanced/resources/account.rb +33 -0
- data/lib/balanced/resources/card.rb +1 -1
- data/lib/balanced/resources/customer.rb +8 -0
- data/lib/balanced/resources/resource.rb +4 -6
- data/lib/balanced/resources/settlement.rb +12 -0
- data/lib/balanced/response/balanced_exception_middleware.rb +1 -1
- data/lib/balanced/utils.rb +1 -1
- data/lib/balanced/version.rb +1 -1
- data/scenarios/account_credit/definition.rb +1 -0
- data/scenarios/account_credit/request.rb +5 -0
- data/scenarios/account_credit/ruby.mako +49 -0
- data/scenarios/account_list/definition.rb +1 -0
- data/scenarios/account_list/request.rb +2 -0
- data/scenarios/account_list/ruby.mako +64 -0
- data/scenarios/account_list_customer/definition.rb +1 -0
- data/scenarios/account_list_customer/request.rb +3 -0
- data/scenarios/account_list_customer/ruby.mako +38 -0
- data/scenarios/account_show/definition.rb +1 -0
- data/scenarios/account_show/request.rb +2 -0
- data/scenarios/account_show/ruby.mako +37 -0
- data/scenarios/api_key_create/ruby.mako +6 -6
- data/scenarios/api_key_delete/ruby.mako +2 -2
- data/scenarios/api_key_list/ruby.mako +10 -10
- data/scenarios/api_key_show/ruby.mako +6 -6
- data/scenarios/bank_account_associate_to_customer/ruby.mako +16 -14
- data/scenarios/bank_account_create/ruby.mako +13 -11
- data/scenarios/bank_account_credit/ruby.mako +16 -16
- data/scenarios/bank_account_debit/ruby.mako +21 -18
- data/scenarios/bank_account_debit_order/definition.rb +1 -0
- data/scenarios/bank_account_debit_order/request.rb +7 -0
- data/scenarios/bank_account_debit_order/ruby.mako +52 -0
- data/scenarios/bank_account_delete/ruby.mako +2 -2
- data/scenarios/bank_account_list/ruby.mako +26 -22
- data/scenarios/bank_account_show/ruby.mako +14 -12
- data/scenarios/bank_account_update/ruby.mako +14 -12
- data/scenarios/bank_account_verification_create/ruby.mako +10 -10
- data/scenarios/bank_account_verification_show/ruby.mako +10 -10
- data/scenarios/bank_account_verification_update/ruby.mako +9 -9
- data/scenarios/callback_create/ruby.mako +4 -4
- data/scenarios/callback_delete/ruby.mako +2 -2
- data/scenarios/callback_list/ruby.mako +4 -4
- data/scenarios/callback_show/ruby.mako +5 -5
- data/scenarios/card_associate_to_customer/ruby.mako +26 -26
- data/scenarios/card_create/ruby.mako +13 -15
- data/scenarios/card_create_creditable/ruby.mako +11 -11
- data/scenarios/card_create_dispute/ruby.mako +13 -13
- data/scenarios/card_credit/ruby.mako +16 -14
- data/scenarios/card_credit_order/definition.rb +1 -0
- data/scenarios/card_credit_order/request.rb +7 -0
- data/scenarios/card_credit_order/ruby.mako +45 -0
- data/scenarios/card_debit/ruby.mako +20 -17
- data/scenarios/card_debit_dispute/ruby.mako +20 -17
- data/scenarios/card_delete/ruby.mako +2 -2
- data/scenarios/card_hold_capture/ruby.mako +20 -17
- data/scenarios/card_hold_create/ruby.mako +16 -14
- data/scenarios/card_hold_list/ruby.mako +33 -27
- data/scenarios/card_hold_order/definition.rb +1 -0
- data/scenarios/card_hold_order/request.rb +6 -0
- data/scenarios/card_hold_order/ruby.mako +45 -0
- data/scenarios/card_hold_show/ruby.mako +16 -14
- data/scenarios/card_hold_update/ruby.mako +16 -14
- data/scenarios/card_hold_void/ruby.mako +17 -15
- data/scenarios/card_list/ruby.mako +25 -29
- data/scenarios/card_show/ruby.mako +14 -16
- data/scenarios/card_update/ruby.mako +14 -16
- data/scenarios/credit_list/ruby.mako +44 -14
- data/scenarios/credit_list_bank_account/ruby.mako +3 -3
- data/scenarios/credit_order/request.rb +2 -2
- data/scenarios/credit_order/ruby.mako +35 -14
- data/scenarios/credit_show/ruby.mako +16 -16
- data/scenarios/credit_update/ruby.mako +16 -16
- data/scenarios/customer_create/ruby.mako +22 -20
- data/scenarios/customer_delete/ruby.mako +1 -1
- data/scenarios/customer_list/ruby.mako +43 -39
- data/scenarios/customer_show/ruby.mako +23 -21
- data/scenarios/customer_update/ruby.mako +23 -21
- data/scenarios/debit_dispute_show/ruby.mako +12 -12
- data/scenarios/debit_list/ruby.mako +43 -37
- data/scenarios/debit_order/ruby.mako +22 -19
- data/scenarios/debit_show/ruby.mako +20 -17
- data/scenarios/debit_update/ruby.mako +20 -17
- data/scenarios/dispute_list/ruby.mako +11 -11
- data/scenarios/dispute_show/ruby.mako +12 -12
- data/scenarios/event_list/ruby.mako +55 -81
- data/scenarios/event_show/ruby.mako +35 -45
- data/scenarios/order_create/ruby.mako +16 -14
- data/scenarios/order_list/ruby.mako +33 -29
- data/scenarios/order_show/ruby.mako +16 -14
- data/scenarios/order_update/ruby.mako +16 -14
- data/scenarios/refund_create/ruby.mako +13 -13
- data/scenarios/refund_list/ruby.mako +12 -12
- data/scenarios/refund_show/ruby.mako +13 -13
- data/scenarios/refund_update/ruby.mako +13 -13
- data/scenarios/reversal_create/ruby.mako +13 -13
- data/scenarios/reversal_list/ruby.mako +12 -12
- data/scenarios/reversal_show/ruby.mako +13 -13
- data/scenarios/reversal_update/ruby.mako +13 -13
- data/scenarios/settlement_create/definition.rb +1 -0
- data/scenarios/settlement_create/request.rb +5 -0
- data/scenarios/settlement_create/ruby.mako +48 -0
- data/scenarios/settlement_list/definition.rb +1 -0
- data/scenarios/settlement_list/request.rb +2 -0
- data/scenarios/settlement_list/ruby.mako +40 -0
- data/scenarios/settlement_list_account/definition.rb +1 -0
- data/scenarios/settlement_list_account/request.rb +3 -0
- data/scenarios/settlement_list_account/ruby.mako +41 -0
- data/scenarios/settlement_show/definition.rb +1 -0
- data/scenarios/settlement_show/request.rb +2 -0
- data/scenarios/settlement_show/ruby.mako +40 -0
- data/snippets/account-balance.rb +1 -0
- data/snippets/bank-account-create.rb +6 -0
- data/snippets/bank-account-debit.rb +9 -0
- data/snippets/bank-account-verification-confirm.rb +5 -0
- data/snippets/bank-account-verification-create.rb +1 -0
- data/snippets/callback-create.rb +4 -0
- data/snippets/card-associate-to-customer.rb +2 -0
- data/snippets/card-create-dispute.rb +6 -0
- data/snippets/card-create.rb +7 -0
- data/snippets/card-credit.rb +9 -0
- data/snippets/card-debit.rb +9 -0
- data/snippets/card-hold-capture.rb +6 -0
- data/snippets/card-hold-create.rb +6 -0
- data/snippets/card-hold-void.rb +3 -0
- data/snippets/create-buyer-and-card.rb +13 -0
- data/snippets/credit-create.rb +8 -0
- data/snippets/credit-fetch.rb +1 -0
- data/snippets/credit-marketplace-escrow.rb +4 -0
- data/snippets/credit-reverse.rb +1 -0
- data/snippets/credit-soft-descriptor.rb +9 -0
- data/snippets/credit-split.rb +13 -0
- data/snippets/customer-create.rb +8 -0
- data/snippets/debit-dispute-show.rb +3 -0
- data/snippets/debit-fetch.rb +1 -0
- data/snippets/debit-marketplace-escrow.rb +4 -0
- data/snippets/debit-refund.rb +1 -0
- data/snippets/dispute-list.rb +1 -0
- data/snippets/dispute-show.rb +2 -0
- data/snippets/examine-order-after-refund.rb +3 -0
- data/snippets/examine-order-after-reversal.rb +3 -0
- data/snippets/example.rb +1 -0
- data/snippets/marketplace-in-escrow.rb +1 -0
- data/snippets/merchant-payable-account-fetch.rb +2 -0
- data/snippets/order-amount-escrowed.rb +3 -0
- data/snippets/order-bank-account-create.rb +8 -0
- data/snippets/order-create.rb +1 -0
- data/snippets/order-credit-marketplace.rb +5 -0
- data/snippets/order-credit-merchant-payable-account.rb +4 -0
- data/snippets/order-credit.rb +4 -0
- data/snippets/order-credits-fetch.rb +1 -0
- data/snippets/order-debit.rb +4 -0
- data/snippets/order-debits-fetch.rb +1 -0
- data/snippets/order-fetch.rb +1 -0
- data/snippets/order-update.rb +5 -0
- data/snippets/refund-create.rb +13 -0
- data/snippets/reversal-create.rb +13 -0
- data/snippets/settlement-create.rb +5 -0
- data/spec/balanced/resources/account_spec.rb +265 -0
- data/spec/balanced/resources/card_spec.rb +6 -6
- metadata +86 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a66e85ff9cfa64cba089a93a7be7196aad46869
|
4
|
+
data.tar.gz: df752979769567873fb795f385ac26b2b8f9d5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1aecb8be5843b8103c8da9e61f58bb8a8224d7f0df59757e883e9d0f6aec1d3c3e34990af58310d2cf3d338e8e64f5444603d1af4bc863eed9e5efa7c22b084
|
7
|
+
data.tar.gz: 7ddabfeea4044df97d0dbf1a70d034709f41ca3d27951327651ffd9b5f5e603dde59fd02521406ba5e9054f7ab550208ae9785780723b7158db79173aac1e4bf
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.5
|
data/.travis.yml
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
bundler_args: --without development
|
3
|
-
script:
|
3
|
+
script: bundle exec rake spec
|
4
4
|
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
- 1.8.7
|
6
|
+
- 1.9.3
|
7
|
+
- 2.1.1
|
8
|
+
deploy:
|
9
|
+
provider: rubygems
|
10
|
+
api_key:
|
11
|
+
secure: 0pFmsvwqf1MKY8QGw3VDE6G6yi5b2JwA1zJIbxyv+12rNiA35Q8FszKK2cRdtpxczXt2aNanMqbwYGU+JDSo894l9vZVfbeSCZX1yg7mTxnjlvSloFtt4VMiRcJ7DANdtdmisYzJL2t5Pzaea/C8/hvjZGZrS34f/78+uO2Vln0=
|
12
|
+
on:
|
13
|
+
tags: true
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Or install it yourself as:
|
|
28
28
|
* [Balanced Overview](https://docs.balancedpayments.com/?language=ruby)
|
29
29
|
* [RDoc](http://rubydoc.info/gems/balanced)
|
30
30
|
* [Balanced API with Ruby examples](https://docs.balancedpayments.com/api?language=ruby)
|
31
|
-
* [Example scripts](https://github.com/balanced/balanced-ruby/tree/master/
|
31
|
+
* [Example scripts](https://github.com/balanced/balanced-ruby/tree/master/scenarios)
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
data/lib/balanced/resources.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Balanced
|
2
|
+
# An Account is a way to pool funds from across multiple Orders
|
3
|
+
#
|
4
|
+
class Account < Balanced::FundingInstrument
|
5
|
+
include Balanced::Resource
|
6
|
+
include Balanced::HypermediaRegistry
|
7
|
+
|
8
|
+
define_hypermedia_types [:accounts]
|
9
|
+
|
10
|
+
# Creates a Credit of funds from to this Account.
|
11
|
+
#
|
12
|
+
# @return [Credit]
|
13
|
+
def credit(options = {})
|
14
|
+
options[:href] = self.credits.href
|
15
|
+
credit = Balanced::Credit.new(options)
|
16
|
+
credit.save
|
17
|
+
end
|
18
|
+
|
19
|
+
# Creates a Settlement from to this Account.
|
20
|
+
#
|
21
|
+
# @return [Credit]
|
22
|
+
def settle(options = {})
|
23
|
+
Balanced::Utils.assert_required_keys(
|
24
|
+
options,
|
25
|
+
:required => [:funding_instrument]
|
26
|
+
)
|
27
|
+
options[:href] = self.settlements.href
|
28
|
+
settlement = Balanced::Settlement.new(options)
|
29
|
+
settlement.save
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -1,16 +1,12 @@
|
|
1
1
|
require File.expand_path('../../pager', __FILE__)
|
2
2
|
require File.expand_path('../../utils', __FILE__)
|
3
3
|
require 'addressable/template'
|
4
|
-
require 'pp'
|
5
|
-
|
6
4
|
|
7
5
|
module Balanced
|
8
6
|
|
9
7
|
module Resource
|
10
|
-
|
11
8
|
attr_accessor :attributes
|
12
9
|
attr_accessor :hyperlinks
|
13
|
-
|
14
10
|
attr_accessor :id
|
15
11
|
attr_accessor :href
|
16
12
|
attr_accessor :links
|
@@ -113,7 +109,9 @@ module Balanced
|
|
113
109
|
def sanitize
|
114
110
|
to_submit = {}
|
115
111
|
@attributes.each do |key, value|
|
116
|
-
|
112
|
+
if value.is_a? Balanced::Resource
|
113
|
+
to_submit[key] = value.href if value.href
|
114
|
+
else
|
117
115
|
to_submit[key] = value
|
118
116
|
end
|
119
117
|
end
|
@@ -260,7 +258,7 @@ module Balanced
|
|
260
258
|
if arguments.nil? ||
|
261
259
|
arguments.empty? ||
|
262
260
|
arguments[0].nil? ||
|
263
|
-
arguments[0].empty?
|
261
|
+
arguments[0].to_s.empty? # no symbol.empty? in 1.8.7
|
264
262
|
raise Balanced::NotFound
|
265
263
|
end
|
266
264
|
scope = arguments.slice!(0)
|
@@ -32,7 +32,7 @@ module Faraday
|
|
32
32
|
}
|
33
33
|
def on_complete(response)
|
34
34
|
status_code = response[:status].to_i
|
35
|
-
if response
|
35
|
+
if response[:body] != nil && response[:body]['errors']
|
36
36
|
category_code = response[:body]['errors'][0]['category_code']
|
37
37
|
else
|
38
38
|
category_code = nil
|
data/lib/balanced/utils.rb
CHANGED
data/lib/balanced/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Account.credit
|
@@ -0,0 +1,49 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Account.credit
|
3
|
+
% elif mode == 'request':
|
4
|
+
require 'balanced'
|
5
|
+
Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
|
6
|
+
|
7
|
+
account = Balanced::Account.fetch('/accounts/AT68yF0GzJByks2OxU6oNjPy')
|
8
|
+
account.credit(
|
9
|
+
:amount => 1000,
|
10
|
+
:appears_on_statement_as => 'ThingsCo',
|
11
|
+
:description => 'A simple credit',
|
12
|
+
:meta => {
|
13
|
+
:rating => 8
|
14
|
+
},
|
15
|
+
:order => '/orders/OR6c6n11zKSFfjE6kGNKtsE8'
|
16
|
+
)
|
17
|
+
% elif mode == 'response':
|
18
|
+
#<Balanced::Credit:0x007fcde12a3580
|
19
|
+
@attributes=
|
20
|
+
{"amount"=>1000,
|
21
|
+
"appears_on_statement_as"=>"ThingsCo",
|
22
|
+
"created_at"=>"2014-12-17T21:24:09.952905Z",
|
23
|
+
"currency"=>"USD",
|
24
|
+
"description"=>"A simple credit",
|
25
|
+
"failure_reason"=>nil,
|
26
|
+
"failure_reason_code"=>nil,
|
27
|
+
"href"=>"/credits/CR6eZ4ImaC1iLixxrkHsoqcg",
|
28
|
+
"id"=>"CR6eZ4ImaC1iLixxrkHsoqcg",
|
29
|
+
"links"=>
|
30
|
+
{"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq",
|
31
|
+
"destination"=>"AT68yF0GzJByks2OxU6oNjPy",
|
32
|
+
"order"=>"OR6c6n11zKSFfjE6kGNKtsE8"},
|
33
|
+
"meta"=>{"rating"=>"8"},
|
34
|
+
"status"=>"succeeded",
|
35
|
+
"transaction_number"=>"CRP9Y-4QQ-VGRE",
|
36
|
+
"updated_at"=>"2014-12-17T21:24:10.051544Z"},
|
37
|
+
@hyperlinks=
|
38
|
+
{"customer"=>
|
39
|
+
#<Proc:0x007fcde12a1938/lib/balanced/resources/resource.rb:56 (lambda)>,
|
40
|
+
"destination"=>
|
41
|
+
#<Proc:0x007fcde12abfa0/lib/balanced/resources/resource.rb:56 (lambda)>,
|
42
|
+
"events"=>
|
43
|
+
#<Proc:0x007fcde12aa128/lib/balanced/utils.rb:6 (lambda)>,
|
44
|
+
"order"=>
|
45
|
+
#<Proc:0x007fcde12a8788/lib/balanced/resources/resource.rb:56 (lambda)>,
|
46
|
+
"reversals"=>
|
47
|
+
#<Proc:0x007fcde12b28f0/lib/balanced/utils.rb:6 (lambda)>}>
|
48
|
+
|
49
|
+
% endif
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Account.all
|
@@ -0,0 +1,64 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Account.all
|
3
|
+
|
4
|
+
% elif mode == 'request':
|
5
|
+
require 'balanced'
|
6
|
+
Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
|
7
|
+
|
8
|
+
Balanced::Account.all
|
9
|
+
|
10
|
+
% elif mode == 'response':
|
11
|
+
[#<Balanced::Account:0x007fcde12cb378
|
12
|
+
@attributes=
|
13
|
+
{"balance"=>0,
|
14
|
+
"can_credit"=>true,
|
15
|
+
"can_debit"=>true,
|
16
|
+
"created_at"=>"2014-12-17T21:23:58.053807Z",
|
17
|
+
"currency"=>"USD",
|
18
|
+
"href"=>"/accounts/AT61AkTlbK0xOgK0M85qbMJO",
|
19
|
+
"id"=>"AT61AkTlbK0xOgK0M85qbMJO",
|
20
|
+
"links"=>{"customer"=>"CU61tZf6xgGgpLmoNkXHfSOQ"},
|
21
|
+
"meta"=>{},
|
22
|
+
"type"=>"payable",
|
23
|
+
"updated_at"=>"2014-12-17T21:23:58.053810Z"},
|
24
|
+
@hyperlinks=
|
25
|
+
{"credits"=>
|
26
|
+
#<Proc:0x007fcde12c9348/lib/balanced/utils.rb:6 (lambda)>,
|
27
|
+
"customer"=>
|
28
|
+
#<Proc:0x007fcde12d3960/lib/balanced/resources/resource.rb:56 (lambda)>,
|
29
|
+
"debits"=>
|
30
|
+
#<Proc:0x007fcde12d1b10/lib/balanced/utils.rb:6 (lambda)>,
|
31
|
+
"refunds"=>
|
32
|
+
#<Proc:0x007fcde12dbc50/lib/balanced/utils.rb:6 (lambda)>,
|
33
|
+
"reversals"=>
|
34
|
+
#<Proc:0x007fcde12d9dd8/lib/balanced/utils.rb:6 (lambda)>,
|
35
|
+
"settlements"=>
|
36
|
+
#<Proc:0x007fcde12e3ef0/lib/balanced/utils.rb:6 (lambda)>}>,
|
37
|
+
#<Balanced::Account:0x007fcde12e3ea0
|
38
|
+
@attributes=
|
39
|
+
{"balance"=>0,
|
40
|
+
"can_credit"=>true,
|
41
|
+
"can_debit"=>true,
|
42
|
+
"created_at"=>"2014-12-17T21:23:57.406645Z",
|
43
|
+
"currency"=>"USD",
|
44
|
+
"href"=>"/accounts/AT60Eh7L4WodxuKzzN5LW4tG",
|
45
|
+
"id"=>"AT60Eh7L4WodxuKzzN5LW4tG",
|
46
|
+
"links"=>{"customer"=>"CU60xqwNwAzX21Qg0dddDDvG"},
|
47
|
+
"meta"=>{},
|
48
|
+
"type"=>"payable",
|
49
|
+
"updated_at"=>"2014-12-17T21:23:57.406647Z"},
|
50
|
+
@hyperlinks=
|
51
|
+
{"credits"=>
|
52
|
+
#<Proc:0x007fcde12e1ec0/lib/balanced/utils.rb:6 (lambda)>,
|
53
|
+
"customer"=>
|
54
|
+
#<Proc:0x007fcde12e0520/lib/balanced/resources/resource.rb:56 (lambda)>,
|
55
|
+
"debits"=>
|
56
|
+
#<Proc:0x007fcde12ea6b0/lib/balanced/utils.rb:6 (lambda)>,
|
57
|
+
"refunds"=>
|
58
|
+
#<Proc:0x007fcde12e8860/lib/balanced/utils.rb:6 (lambda)>,
|
59
|
+
"reversals"=>
|
60
|
+
#<Proc:0x007fcde12f29c8/lib/balanced/utils.rb:6 (lambda)>,
|
61
|
+
"settlements"=>
|
62
|
+
#<Proc:0x007fcde12f0b78/lib/balanced/utils.rb:6 (lambda)>}>]
|
63
|
+
|
64
|
+
% endif
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Customer.accounts
|
@@ -0,0 +1,38 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Customer.accounts
|
3
|
+
|
4
|
+
% elif mode == 'request':
|
5
|
+
require 'balanced'
|
6
|
+
Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
|
7
|
+
|
8
|
+
customer = Balanced::Customer.fetch('/customers/CU68iUpvvUwpRpuuBL3u9Slq')
|
9
|
+
customer.accounts
|
10
|
+
% elif mode == 'response':
|
11
|
+
[#<Balanced::Account:0x007fcde1318a10
|
12
|
+
@attributes=
|
13
|
+
{"balance"=>0,
|
14
|
+
"can_credit"=>true,
|
15
|
+
"can_debit"=>true,
|
16
|
+
"created_at"=>"2014-12-17T21:24:04.257700Z",
|
17
|
+
"currency"=>"USD",
|
18
|
+
"href"=>"/accounts/AT68yF0GzJByks2OxU6oNjPy",
|
19
|
+
"id"=>"AT68yF0GzJByks2OxU6oNjPy",
|
20
|
+
"links"=>{"customer"=>"CU68iUpvvUwpRpuuBL3u9Slq"},
|
21
|
+
"meta"=>{},
|
22
|
+
"type"=>"payable",
|
23
|
+
"updated_at"=>"2014-12-17T21:24:04.257702Z"},
|
24
|
+
@hyperlinks=
|
25
|
+
{"credits"=>
|
26
|
+
#<Proc:0x007fcde13229c0/lib/balanced/utils.rb:6 (lambda)>,
|
27
|
+
"customer"=>
|
28
|
+
#<Proc:0x007fcde1321020/lib/balanced/resources/resource.rb:56 (lambda)>,
|
29
|
+
"debits"=>
|
30
|
+
#<Proc:0x007fcde132b188/lib/balanced/utils.rb:6 (lambda)>,
|
31
|
+
"refunds"=>
|
32
|
+
#<Proc:0x007fcde1329310/lib/balanced/utils.rb:6 (lambda)>,
|
33
|
+
"reversals"=>
|
34
|
+
#<Proc:0x007fcde1333428/lib/balanced/utils.rb:6 (lambda)>,
|
35
|
+
"settlements"=>
|
36
|
+
#<Proc:0x007fcde13315b0/lib/balanced/utils.rb:6 (lambda)>}>]
|
37
|
+
|
38
|
+
% endif
|
@@ -0,0 +1 @@
|
|
1
|
+
Balanced::Account.fetch
|
@@ -0,0 +1,37 @@
|
|
1
|
+
% if mode == 'definition':
|
2
|
+
Balanced::Account.fetch
|
3
|
+
% elif mode == 'request':
|
4
|
+
require 'balanced'
|
5
|
+
Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
|
6
|
+
|
7
|
+
account = Balanced::Account.fetch('/accounts/AT61AkTlbK0xOgK0M85qbMJO')
|
8
|
+
|
9
|
+
% elif mode == 'response':
|
10
|
+
#<Balanced::Account:0x007fcde1349d68
|
11
|
+
@attributes=
|
12
|
+
{"balance"=>0,
|
13
|
+
"can_credit"=>true,
|
14
|
+
"can_debit"=>true,
|
15
|
+
"created_at"=>"2014-12-17T21:23:58.053807Z",
|
16
|
+
"currency"=>"USD",
|
17
|
+
"href"=>"/accounts/AT61AkTlbK0xOgK0M85qbMJO",
|
18
|
+
"id"=>"AT61AkTlbK0xOgK0M85qbMJO",
|
19
|
+
"links"=>{"customer"=>"CU61tZf6xgGgpLmoNkXHfSOQ"},
|
20
|
+
"meta"=>{},
|
21
|
+
"type"=>"payable",
|
22
|
+
"updated_at"=>"2014-12-17T21:23:58.053810Z"},
|
23
|
+
@hyperlinks=
|
24
|
+
{"credits"=>
|
25
|
+
#<Proc:0x007fcde1353d18/lib/balanced/utils.rb:6 (lambda)>,
|
26
|
+
"customer"=>
|
27
|
+
#<Proc:0x007fcde1352378/lib/balanced/resources/resource.rb:56 (lambda)>,
|
28
|
+
"debits"=>
|
29
|
+
#<Proc:0x007fcde1350528/lib/balanced/utils.rb:6 (lambda)>,
|
30
|
+
"refunds"=>
|
31
|
+
#<Proc:0x007fcde135a640/lib/balanced/utils.rb:6 (lambda)>,
|
32
|
+
"reversals"=>
|
33
|
+
#<Proc:0x007fcde13587c8/lib/balanced/utils.rb:6 (lambda)>,
|
34
|
+
"settlements"=>
|
35
|
+
#<Proc:0x007fcde1362908/lib/balanced/utils.rb:6 (lambda)>}>
|
36
|
+
|
37
|
+
% endif
|
@@ -3,19 +3,19 @@ Balanced::ApiKey.new
|
|
3
3
|
|
4
4
|
% elif mode == 'request':
|
5
5
|
require 'balanced'
|
6
|
-
Balanced.configure('ak-test-
|
6
|
+
Balanced.configure('ak-test-YoVGJWMjOpkCPo6dWMfuiYbBYIB8q2JX')
|
7
7
|
|
8
8
|
key = Balanced::ApiKey.new.save
|
9
9
|
|
10
10
|
% elif mode == 'response':
|
11
|
-
#<Balanced::ApiKey:
|
11
|
+
#<Balanced::ApiKey:0x007fcde137bbd8
|
12
12
|
@attributes=
|
13
|
-
{"created_at"=>"2014-
|
14
|
-
"href"=>"/api_keys/
|
15
|
-
"id"=>"
|
13
|
+
{"created_at"=>"2014-12-17T21:24:11.308489Z",
|
14
|
+
"href"=>"/api_keys/AK6gw2iNQrFpQk7jb8ONNjdb",
|
15
|
+
"id"=>"AK6gw2iNQrFpQk7jb8ONNjdb",
|
16
16
|
"links"=>{},
|
17
17
|
"meta"=>{},
|
18
|
-
"secret"=>"ak-test-
|
18
|
+
"secret"=>"ak-test-29kmTuMRgZTtOFmeMWVUclctfpNQnlUb5"},
|
19
19
|
@hyperlinks={}>
|
20
20
|
|
21
21
|
% endif
|