balanced 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +10 -6
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +1 -1
  6. data/lib/balanced/resources.rb +2 -0
  7. data/lib/balanced/resources/account.rb +33 -0
  8. data/lib/balanced/resources/card.rb +1 -1
  9. data/lib/balanced/resources/customer.rb +8 -0
  10. data/lib/balanced/resources/resource.rb +4 -6
  11. data/lib/balanced/resources/settlement.rb +12 -0
  12. data/lib/balanced/response/balanced_exception_middleware.rb +1 -1
  13. data/lib/balanced/utils.rb +1 -1
  14. data/lib/balanced/version.rb +1 -1
  15. data/scenarios/account_credit/definition.rb +1 -0
  16. data/scenarios/account_credit/request.rb +5 -0
  17. data/scenarios/account_credit/ruby.mako +49 -0
  18. data/scenarios/account_list/definition.rb +1 -0
  19. data/scenarios/account_list/request.rb +2 -0
  20. data/scenarios/account_list/ruby.mako +64 -0
  21. data/scenarios/account_list_customer/definition.rb +1 -0
  22. data/scenarios/account_list_customer/request.rb +3 -0
  23. data/scenarios/account_list_customer/ruby.mako +38 -0
  24. data/scenarios/account_show/definition.rb +1 -0
  25. data/scenarios/account_show/request.rb +2 -0
  26. data/scenarios/account_show/ruby.mako +37 -0
  27. data/scenarios/api_key_create/ruby.mako +6 -6
  28. data/scenarios/api_key_delete/ruby.mako +2 -2
  29. data/scenarios/api_key_list/ruby.mako +10 -10
  30. data/scenarios/api_key_show/ruby.mako +6 -6
  31. data/scenarios/bank_account_associate_to_customer/ruby.mako +16 -14
  32. data/scenarios/bank_account_create/ruby.mako +13 -11
  33. data/scenarios/bank_account_credit/ruby.mako +16 -16
  34. data/scenarios/bank_account_debit/ruby.mako +21 -18
  35. data/scenarios/bank_account_debit_order/definition.rb +1 -0
  36. data/scenarios/bank_account_debit_order/request.rb +7 -0
  37. data/scenarios/bank_account_debit_order/ruby.mako +52 -0
  38. data/scenarios/bank_account_delete/ruby.mako +2 -2
  39. data/scenarios/bank_account_list/ruby.mako +26 -22
  40. data/scenarios/bank_account_show/ruby.mako +14 -12
  41. data/scenarios/bank_account_update/ruby.mako +14 -12
  42. data/scenarios/bank_account_verification_create/ruby.mako +10 -10
  43. data/scenarios/bank_account_verification_show/ruby.mako +10 -10
  44. data/scenarios/bank_account_verification_update/ruby.mako +9 -9
  45. data/scenarios/callback_create/ruby.mako +4 -4
  46. data/scenarios/callback_delete/ruby.mako +2 -2
  47. data/scenarios/callback_list/ruby.mako +4 -4
  48. data/scenarios/callback_show/ruby.mako +5 -5
  49. data/scenarios/card_associate_to_customer/ruby.mako +26 -26
  50. data/scenarios/card_create/ruby.mako +13 -15
  51. data/scenarios/card_create_creditable/ruby.mako +11 -11
  52. data/scenarios/card_create_dispute/ruby.mako +13 -13
  53. data/scenarios/card_credit/ruby.mako +16 -14
  54. data/scenarios/card_credit_order/definition.rb +1 -0
  55. data/scenarios/card_credit_order/request.rb +7 -0
  56. data/scenarios/card_credit_order/ruby.mako +45 -0
  57. data/scenarios/card_debit/ruby.mako +20 -17
  58. data/scenarios/card_debit_dispute/ruby.mako +20 -17
  59. data/scenarios/card_delete/ruby.mako +2 -2
  60. data/scenarios/card_hold_capture/ruby.mako +20 -17
  61. data/scenarios/card_hold_create/ruby.mako +16 -14
  62. data/scenarios/card_hold_list/ruby.mako +33 -27
  63. data/scenarios/card_hold_order/definition.rb +1 -0
  64. data/scenarios/card_hold_order/request.rb +6 -0
  65. data/scenarios/card_hold_order/ruby.mako +45 -0
  66. data/scenarios/card_hold_show/ruby.mako +16 -14
  67. data/scenarios/card_hold_update/ruby.mako +16 -14
  68. data/scenarios/card_hold_void/ruby.mako +17 -15
  69. data/scenarios/card_list/ruby.mako +25 -29
  70. data/scenarios/card_show/ruby.mako +14 -16
  71. data/scenarios/card_update/ruby.mako +14 -16
  72. data/scenarios/credit_list/ruby.mako +44 -14
  73. data/scenarios/credit_list_bank_account/ruby.mako +3 -3
  74. data/scenarios/credit_order/request.rb +2 -2
  75. data/scenarios/credit_order/ruby.mako +35 -14
  76. data/scenarios/credit_show/ruby.mako +16 -16
  77. data/scenarios/credit_update/ruby.mako +16 -16
  78. data/scenarios/customer_create/ruby.mako +22 -20
  79. data/scenarios/customer_delete/ruby.mako +1 -1
  80. data/scenarios/customer_list/ruby.mako +43 -39
  81. data/scenarios/customer_show/ruby.mako +23 -21
  82. data/scenarios/customer_update/ruby.mako +23 -21
  83. data/scenarios/debit_dispute_show/ruby.mako +12 -12
  84. data/scenarios/debit_list/ruby.mako +43 -37
  85. data/scenarios/debit_order/ruby.mako +22 -19
  86. data/scenarios/debit_show/ruby.mako +20 -17
  87. data/scenarios/debit_update/ruby.mako +20 -17
  88. data/scenarios/dispute_list/ruby.mako +11 -11
  89. data/scenarios/dispute_show/ruby.mako +12 -12
  90. data/scenarios/event_list/ruby.mako +55 -81
  91. data/scenarios/event_show/ruby.mako +35 -45
  92. data/scenarios/order_create/ruby.mako +16 -14
  93. data/scenarios/order_list/ruby.mako +33 -29
  94. data/scenarios/order_show/ruby.mako +16 -14
  95. data/scenarios/order_update/ruby.mako +16 -14
  96. data/scenarios/refund_create/ruby.mako +13 -13
  97. data/scenarios/refund_list/ruby.mako +12 -12
  98. data/scenarios/refund_show/ruby.mako +13 -13
  99. data/scenarios/refund_update/ruby.mako +13 -13
  100. data/scenarios/reversal_create/ruby.mako +13 -13
  101. data/scenarios/reversal_list/ruby.mako +12 -12
  102. data/scenarios/reversal_show/ruby.mako +13 -13
  103. data/scenarios/reversal_update/ruby.mako +13 -13
  104. data/scenarios/settlement_create/definition.rb +1 -0
  105. data/scenarios/settlement_create/request.rb +5 -0
  106. data/scenarios/settlement_create/ruby.mako +48 -0
  107. data/scenarios/settlement_list/definition.rb +1 -0
  108. data/scenarios/settlement_list/request.rb +2 -0
  109. data/scenarios/settlement_list/ruby.mako +40 -0
  110. data/scenarios/settlement_list_account/definition.rb +1 -0
  111. data/scenarios/settlement_list_account/request.rb +3 -0
  112. data/scenarios/settlement_list_account/ruby.mako +41 -0
  113. data/scenarios/settlement_show/definition.rb +1 -0
  114. data/scenarios/settlement_show/request.rb +2 -0
  115. data/scenarios/settlement_show/ruby.mako +40 -0
  116. data/snippets/account-balance.rb +1 -0
  117. data/snippets/bank-account-create.rb +6 -0
  118. data/snippets/bank-account-debit.rb +9 -0
  119. data/snippets/bank-account-verification-confirm.rb +5 -0
  120. data/snippets/bank-account-verification-create.rb +1 -0
  121. data/snippets/callback-create.rb +4 -0
  122. data/snippets/card-associate-to-customer.rb +2 -0
  123. data/snippets/card-create-dispute.rb +6 -0
  124. data/snippets/card-create.rb +7 -0
  125. data/snippets/card-credit.rb +9 -0
  126. data/snippets/card-debit.rb +9 -0
  127. data/snippets/card-hold-capture.rb +6 -0
  128. data/snippets/card-hold-create.rb +6 -0
  129. data/snippets/card-hold-void.rb +3 -0
  130. data/snippets/create-buyer-and-card.rb +13 -0
  131. data/snippets/credit-create.rb +8 -0
  132. data/snippets/credit-fetch.rb +1 -0
  133. data/snippets/credit-marketplace-escrow.rb +4 -0
  134. data/snippets/credit-reverse.rb +1 -0
  135. data/snippets/credit-soft-descriptor.rb +9 -0
  136. data/snippets/credit-split.rb +13 -0
  137. data/snippets/customer-create.rb +8 -0
  138. data/snippets/debit-dispute-show.rb +3 -0
  139. data/snippets/debit-fetch.rb +1 -0
  140. data/snippets/debit-marketplace-escrow.rb +4 -0
  141. data/snippets/debit-refund.rb +1 -0
  142. data/snippets/dispute-list.rb +1 -0
  143. data/snippets/dispute-show.rb +2 -0
  144. data/snippets/examine-order-after-refund.rb +3 -0
  145. data/snippets/examine-order-after-reversal.rb +3 -0
  146. data/snippets/example.rb +1 -0
  147. data/snippets/marketplace-in-escrow.rb +1 -0
  148. data/snippets/merchant-payable-account-fetch.rb +2 -0
  149. data/snippets/order-amount-escrowed.rb +3 -0
  150. data/snippets/order-bank-account-create.rb +8 -0
  151. data/snippets/order-create.rb +1 -0
  152. data/snippets/order-credit-marketplace.rb +5 -0
  153. data/snippets/order-credit-merchant-payable-account.rb +4 -0
  154. data/snippets/order-credit.rb +4 -0
  155. data/snippets/order-credits-fetch.rb +1 -0
  156. data/snippets/order-debit.rb +4 -0
  157. data/snippets/order-debits-fetch.rb +1 -0
  158. data/snippets/order-fetch.rb +1 -0
  159. data/snippets/order-update.rb +5 -0
  160. data/snippets/refund-create.rb +13 -0
  161. data/snippets/reversal-create.rb +13 -0
  162. data/snippets/settlement-create.rb +5 -0
  163. data/spec/balanced/resources/account_spec.rb +265 -0
  164. data/spec/balanced/resources/card_spec.rb +6 -6
  165. metadata +86 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 219dbbd5adfbc85b25a89851e6d81149b7c6c885
4
- data.tar.gz: 021828832cf8d9b233f41ad9c13578dbe5f21399
3
+ metadata.gz: 0a66e85ff9cfa64cba089a93a7be7196aad46869
4
+ data.tar.gz: df752979769567873fb795f385ac26b2b8f9d5bd
5
5
  SHA512:
6
- metadata.gz: fbd91388524f30395916d87f33a8c8c2377473d996feb38780a99a92f0ffb337debdb2563abe4e483d05425854bd2c1f6e6b8262d904f8e582ba050be8cd6aa7
7
- data.tar.gz: a6a2da990d5941e291c98e8db187acaf2346f2c1c0cc3112846ab31a9a7738b67102b4d174922675402984ee38a80efb6fe5c0a62404a0aec8e5f3aaf2e46d56
6
+ metadata.gz: b1aecb8be5843b8103c8da9e61f58bb8a8224d7f0df59757e883e9d0f6aec1d3c3e34990af58310d2cf3d338e8e64f5444603d1af4bc863eed9e5efa7c22b084
7
+ data.tar.gz: 7ddabfeea4044df97d0dbf1a70d034709f41ca3d27951327651ffd9b5f5e603dde59fd02521406ba5e9054f7ab550208ae9785780723b7158db79173aac1e4bf
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.5
@@ -1,9 +1,13 @@
1
1
  language: ruby
2
2
  bundler_args: --without development
3
- script: "bundle exec rake spec"
3
+ script: bundle exec rake spec
4
4
  rvm:
5
- - 1.8.7
6
- - 1.9.2
7
- - 1.9.3
8
- - 2.0.0
9
- - 2.1.1
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
@@ -1,3 +1,7 @@
1
+ ## 1.2
2
+
3
+ * Account and Settlement support
4
+
1
5
  ## 1.1.1
2
6
 
3
7
  * Fix nil fetch exception
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/examples)
31
+ * [Example scripts](https://github.com/balanced/balanced-ruby/tree/master/scenarios)
32
32
 
33
33
  ## Contributing
34
34
 
@@ -16,3 +16,5 @@ require 'balanced/resources/event'
16
16
  require 'balanced/resources/customer'
17
17
  require 'balanced/resources/order'
18
18
  require 'balanced/resources/transfer'
19
+ require 'balanced/resources/account'
20
+ require 'balanced/resources/settlement'
@@ -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
@@ -23,7 +23,7 @@ module Balanced
23
23
  # @param [Hash] options
24
24
  # @return [Credit]
25
25
  def credit(options={})
26
- if ! defined? self.credits
26
+ if ! self.respond_to?(:credits)
27
27
  raise Balanced::FundingInstrumentNotCreditable
28
28
  end
29
29
 
@@ -59,5 +59,13 @@ module Balanced
59
59
  save
60
60
  end
61
61
 
62
+ # Returns an Account with type 'payable'
63
+ #
64
+ # @return [Customer]
65
+ def payable_account
66
+ payable_account = self.accounts.where(:type=>'payable').first
67
+ payable_account
68
+ end
69
+
62
70
  end
63
71
  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
- unless value.is_a? Balanced::Resource
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)
@@ -0,0 +1,12 @@
1
+ module Balanced
2
+ # A Settlement is the action of moving money out of an Account to a bank
3
+ # account.
4
+ #
5
+ class Settlement
6
+ include Balanced::Resource
7
+ include Balanced::HypermediaRegistry
8
+
9
+ define_hypermedia_types [:settlements]
10
+
11
+ end
12
+ end
@@ -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.key? :body and response[:body] != nil and response[:body]['errors']
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
@@ -2,7 +2,7 @@ module Balanced
2
2
 
3
3
  module Utils
4
4
 
5
- def callable( callable_or_not )
5
+ def callable(callable_or_not)
6
6
  callable_or_not.respond_to?(:call) ? callable_or_not : lambda { callable_or_not }
7
7
  end
8
8
 
@@ -1,3 +1,3 @@
1
1
  module Balanced
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.1'
3
3
  end
@@ -0,0 +1 @@
1
+ Balanced::Account.credit
@@ -0,0 +1,5 @@
1
+ <%= boiler_plate %>
2
+ account = Balanced::Account.fetch('<%= request['account_href'] %>')
3
+ account.credit(
4
+ <%= params_to_hash.call(payload).indent(2) %>
5
+ )
@@ -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,2 @@
1
+ <%= boiler_plate %>
2
+ 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,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.fetch('<%= request['customer_href'] %>')
3
+ 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,2 @@
1
+ <%= boiler_plate %>
2
+ account = Balanced::Account.fetch('<%=request['uri']%>')
@@ -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-2q80HU8DISm2atgm0iRKRVIePzDb34qYp')
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:0x007fa7d40b53a0
11
+ #<Balanced::ApiKey:0x007fcde137bbd8
12
12
  @attributes=
13
- {"created_at"=>"2014-05-15T00:38:16.692063Z",
14
- "href"=>"/api_keys/AK1B3lNyPQ63pRQa1JDC5os5",
15
- "id"=>"AK1B3lNyPQ63pRQa1JDC5os5",
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-1GkkDibAyqrZDI1LDfepJSuUqKbSUnqA5"},
18
+ "secret"=>"ak-test-29kmTuMRgZTtOFmeMWVUclctfpNQnlUb5"},
19
19
  @hyperlinks={}>
20
20
 
21
21
  % endif