balanced 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (234) hide show
  1. data/.gitignore +3 -1
  2. data/.travis.yml +1 -0
  3. data/CONTRIBUTORS +3 -1
  4. data/README.md +19 -3
  5. data/Rakefile +17 -0
  6. data/examples/customers.rb +1 -1
  7. data/lib/balanced/resources.rb +1 -1
  8. data/lib/balanced/resources/credit.rb +18 -0
  9. data/lib/balanced/resources/invoice.rb +11 -0
  10. data/lib/balanced/resources/marketplace.rb +3 -1
  11. data/lib/balanced/resources/reversal.rb +20 -0
  12. data/lib/balanced/resources/transaction.rb +1 -2
  13. data/lib/balanced/version.rb +1 -1
  14. data/scenario.cache +540 -0
  15. data/scenarios/account_add_card/definition.rb +1 -0
  16. data/scenarios/account_add_card/request.rb +3 -0
  17. data/scenarios/account_add_card/ruby.mako +11 -0
  18. data/scenarios/account_capture_hold/definition.rb +1 -0
  19. data/scenarios/account_capture_hold/request.rb +3 -0
  20. data/scenarios/account_capture_hold/ruby.mako +11 -0
  21. data/scenarios/account_create/definition.rb +1 -0
  22. data/scenarios/account_create/request.rb +2 -0
  23. data/scenarios/account_create/ruby.mako +10 -0
  24. data/scenarios/account_create_buyer/definition.rb +1 -0
  25. data/scenarios/account_create_buyer/request.rb +4 -0
  26. data/scenarios/account_create_buyer/ruby.mako +12 -0
  27. data/scenarios/account_create_debit/definition.rb +1 -0
  28. data/scenarios/account_create_debit/request.rb +3 -0
  29. data/scenarios/account_create_debit/ruby.mako +11 -0
  30. data/scenarios/account_create_hold/definition.rb +1 -0
  31. data/scenarios/account_create_hold/request.rb +3 -0
  32. data/scenarios/account_create_hold/ruby.mako +11 -0
  33. data/scenarios/account_create_merchant/definition.rb +1 -0
  34. data/scenarios/account_create_merchant/request.rb +3 -0
  35. data/scenarios/account_create_merchant/ruby.mako +11 -0
  36. data/scenarios/account_underwrite_business/definition.rb +1 -0
  37. data/scenarios/account_underwrite_business/request.rb +19 -0
  38. data/scenarios/account_underwrite_business/ruby.mako +27 -0
  39. data/scenarios/account_underwrite_person/definition.rb +1 -0
  40. data/scenarios/account_underwrite_person/request.rb +18 -0
  41. data/scenarios/account_underwrite_person/ruby.mako +26 -0
  42. data/scenarios/bank_account_create/definition.rb +1 -0
  43. data/scenarios/bank_account_create/request.rb +4 -0
  44. data/scenarios/bank_account_create/ruby.mako +12 -0
  45. data/scenarios/bank_account_delete/definition.rb +1 -0
  46. data/scenarios/bank_account_delete/request.rb +3 -0
  47. data/scenarios/bank_account_delete/ruby.mako +11 -0
  48. data/scenarios/bank_account_find_and_credit/definition.rb +1 -0
  49. data/scenarios/bank_account_find_and_credit/request.rb +5 -0
  50. data/scenarios/bank_account_find_and_credit/ruby.mako +13 -0
  51. data/scenarios/bank_account_find_and_delete/definition.rb +1 -0
  52. data/scenarios/bank_account_find_and_delete/request.rb +3 -0
  53. data/scenarios/bank_account_find_and_delete/ruby.mako +10 -0
  54. data/scenarios/bank_account_invalid_routing_number/definition.rb +1 -0
  55. data/scenarios/bank_account_invalid_routing_number/request.rb +8 -0
  56. data/scenarios/bank_account_invalid_routing_number/ruby.mako +16 -0
  57. data/scenarios/bank_account_list/definition.rb +1 -0
  58. data/scenarios/bank_account_list/request.rb +2 -0
  59. data/scenarios/bank_account_list/ruby.mako +10 -0
  60. data/scenarios/bank_account_show/definition.rb +1 -0
  61. data/scenarios/bank_account_show/request.rb +2 -0
  62. data/scenarios/bank_account_show/ruby.mako +10 -0
  63. data/scenarios/bank_account_verification_create/definition.rb +1 -0
  64. data/scenarios/bank_account_verification_create/request.rb +3 -0
  65. data/scenarios/bank_account_verification_create/ruby.mako +11 -0
  66. data/scenarios/bank_account_verification_show/definition.rb +1 -0
  67. data/scenarios/bank_account_verification_show/request.rb +2 -0
  68. data/scenarios/bank_account_verification_show/ruby.mako +10 -0
  69. data/scenarios/bank_account_verification_update/definition.rb +1 -0
  70. data/scenarios/bank_account_verification_update/request.rb +7 -0
  71. data/scenarios/bank_account_verification_update/ruby.mako +17 -0
  72. data/scenarios/callback_create/definition.rb +1 -0
  73. data/scenarios/callback_create/request.rb +4 -0
  74. data/scenarios/callback_create/ruby.mako +0 -0
  75. data/scenarios/callback_delete/definition.rb +1 -0
  76. data/scenarios/callback_delete/request.rb +3 -0
  77. data/scenarios/callback_delete/ruby.mako +0 -0
  78. data/scenarios/callback_list/definition.rb +1 -0
  79. data/scenarios/callback_list/request.rb +3 -0
  80. data/scenarios/callback_list/ruby.mako +0 -0
  81. data/scenarios/callback_show/definition.rb +1 -0
  82. data/scenarios/callback_show/request.rb +2 -0
  83. data/scenarios/callback_show/ruby.mako +0 -0
  84. data/scenarios/card_create/definition.rb +1 -0
  85. data/scenarios/card_create/request.rb +5 -0
  86. data/scenarios/card_create/ruby.mako +13 -0
  87. data/scenarios/card_invalidate/definition.rb +1 -0
  88. data/scenarios/card_invalidate/request.rb +3 -0
  89. data/scenarios/card_invalidate/ruby.mako +10 -0
  90. data/scenarios/card_list/definition.rb +1 -0
  91. data/scenarios/card_list/request.rb +2 -0
  92. data/scenarios/card_list/ruby.mako +9 -0
  93. data/scenarios/card_show/definition.rb +1 -0
  94. data/scenarios/card_show/request.rb +2 -0
  95. data/scenarios/card_show/ruby.mako +9 -0
  96. data/scenarios/card_update/definition.rb +1 -0
  97. data/scenarios/card_update/request.rb +6 -0
  98. data/scenarios/card_update/ruby.mako +14 -0
  99. data/scenarios/credit_account_list/definition.rb +1 -0
  100. data/scenarios/credit_account_list/request.rb +3 -0
  101. data/scenarios/credit_account_list/ruby.mako +10 -0
  102. data/scenarios/credit_account_merchant_create/definition.rb +1 -0
  103. data/scenarios/credit_account_merchant_create/request.rb +5 -0
  104. data/scenarios/credit_account_merchant_create/ruby.mako +12 -0
  105. data/scenarios/credit_bank_account_list/definition.rb +1 -0
  106. data/scenarios/credit_bank_account_list/request.rb +5 -0
  107. data/scenarios/credit_bank_account_list/ruby.mako +12 -0
  108. data/scenarios/credit_create_existing_bank_account/definition.rb +1 -0
  109. data/scenarios/credit_create_existing_bank_account/request.rb +5 -0
  110. data/scenarios/credit_create_existing_bank_account/ruby.mako +12 -0
  111. data/scenarios/credit_create_new_bank_account/definition.rb +1 -0
  112. data/scenarios/credit_create_new_bank_account/request.rb +10 -0
  113. data/scenarios/credit_create_new_bank_account/ruby.mako +18 -0
  114. data/scenarios/credit_customer_list/definition.rb +1 -0
  115. data/scenarios/credit_customer_list/request.rb +4 -0
  116. data/scenarios/credit_customer_list/ruby.mako +12 -0
  117. data/scenarios/credit_failed_state/definition.rb +1 -0
  118. data/scenarios/credit_failed_state/request.rb +10 -0
  119. data/scenarios/credit_failed_state/ruby.mako +18 -0
  120. data/scenarios/credit_list/definition.rb +1 -0
  121. data/scenarios/credit_list/request.rb +4 -0
  122. data/scenarios/credit_list/ruby.mako +11 -0
  123. data/scenarios/credit_paid_state/definition.rb +1 -0
  124. data/scenarios/credit_paid_state/request.rb +11 -0
  125. data/scenarios/credit_paid_state/ruby.mako +19 -0
  126. data/scenarios/credit_pending_state/definition.rb +1 -0
  127. data/scenarios/credit_pending_state/request.rb +9 -0
  128. data/scenarios/credit_pending_state/ruby.mako +17 -0
  129. data/scenarios/credit_show/definition.rb +1 -0
  130. data/scenarios/credit_show/request.rb +4 -0
  131. data/scenarios/credit_show/ruby.mako +11 -0
  132. data/scenarios/customer_add_bank_account/definition.rb +1 -0
  133. data/scenarios/customer_add_bank_account/request.rb +3 -0
  134. data/scenarios/customer_add_bank_account/ruby.mako +11 -0
  135. data/scenarios/customer_add_card/definition.rb +1 -0
  136. data/scenarios/customer_add_card/request.rb +3 -0
  137. data/scenarios/customer_add_card/ruby.mako +11 -0
  138. data/scenarios/customer_capture_hold/definition.rb +1 -0
  139. data/scenarios/customer_capture_hold/request.rb +3 -0
  140. data/scenarios/customer_capture_hold/ruby.mako +0 -0
  141. data/scenarios/customer_create/definition.rb +1 -0
  142. data/scenarios/customer_create/request.rb +2 -0
  143. data/scenarios/customer_create/ruby.mako +10 -0
  144. data/scenarios/customer_create_debit/definition.rb +1 -0
  145. data/scenarios/customer_create_debit/request.rb +3 -0
  146. data/scenarios/customer_create_debit/ruby.mako +11 -0
  147. data/scenarios/customer_create_hold/definition.rb +1 -0
  148. data/scenarios/customer_create_hold/request.rb +3 -0
  149. data/scenarios/customer_create_hold/ruby.mako +11 -0
  150. data/scenarios/customer_credit/definition.rb +1 -0
  151. data/scenarios/customer_credit/request.rb +2 -0
  152. data/scenarios/customer_credit/ruby.mako +8 -0
  153. data/scenarios/debit_account_list/definition.rb +1 -0
  154. data/scenarios/debit_account_list/request.rb +3 -0
  155. data/scenarios/debit_account_list/ruby.mako +10 -0
  156. data/scenarios/debit_create/definition.rb +1 -0
  157. data/scenarios/debit_create/request.rb +3 -0
  158. data/scenarios/debit_create/ruby.mako +11 -0
  159. data/scenarios/debit_customer_list/definition.rb +1 -0
  160. data/scenarios/debit_customer_list/request.rb +4 -0
  161. data/scenarios/debit_customer_list/ruby.mako +12 -0
  162. data/scenarios/debit_list/definition.rb +1 -0
  163. data/scenarios/debit_list/request.rb +4 -0
  164. data/scenarios/debit_list/ruby.mako +11 -0
  165. data/scenarios/debit_refund/definition.rb +1 -0
  166. data/scenarios/debit_refund/request.rb +3 -0
  167. data/scenarios/debit_refund/ruby.mako +10 -0
  168. data/scenarios/debit_show/definition.rb +1 -0
  169. data/scenarios/debit_show/request.rb +2 -0
  170. data/scenarios/debit_show/ruby.mako +10 -0
  171. data/scenarios/debit_update/definition.rb +1 -0
  172. data/scenarios/debit_update/request.rb +5 -0
  173. data/scenarios/debit_update/ruby.mako +13 -0
  174. data/scenarios/delete.rb +7 -0
  175. data/scenarios/event_list/definition.rb +1 -0
  176. data/scenarios/event_list/request.rb +3 -0
  177. data/scenarios/event_list/ruby.mako +10 -0
  178. data/scenarios/event_replay/definition.rb +0 -0
  179. data/scenarios/event_replay/request.rb +1 -0
  180. data/scenarios/event_replay/ruby.mako +0 -0
  181. data/scenarios/event_show/definition.rb +1 -0
  182. data/scenarios/event_show/request.rb +2 -0
  183. data/scenarios/event_show/ruby.mako +10 -0
  184. data/scenarios/execute.rb +27 -0
  185. data/scenarios/helpers.rb +15 -0
  186. data/scenarios/hold_account_list/definition.rb +1 -0
  187. data/scenarios/hold_account_list/request.rb +3 -0
  188. data/scenarios/hold_account_list/ruby.mako +10 -0
  189. data/scenarios/hold_capture/definition.rb +1 -0
  190. data/scenarios/hold_capture/request.rb +5 -0
  191. data/scenarios/hold_capture/ruby.mako +13 -0
  192. data/scenarios/hold_create/definition.rb +1 -0
  193. data/scenarios/hold_create/request.rb +5 -0
  194. data/scenarios/hold_create/ruby.mako +13 -0
  195. data/scenarios/hold_customer_list/definition.rb +1 -0
  196. data/scenarios/hold_customer_list/request.rb +3 -0
  197. data/scenarios/hold_customer_list/ruby.mako +11 -0
  198. data/scenarios/hold_list/definition.rb +1 -0
  199. data/scenarios/hold_list/request.rb +4 -0
  200. data/scenarios/hold_list/ruby.mako +11 -0
  201. data/scenarios/hold_show/definition.rb +1 -0
  202. data/scenarios/hold_show/request.rb +2 -0
  203. data/scenarios/hold_show/ruby.mako +10 -0
  204. data/scenarios/hold_update/definition.rb +1 -0
  205. data/scenarios/hold_update/request.rb +5 -0
  206. data/scenarios/hold_update/ruby.mako +13 -0
  207. data/scenarios/hold_void/definition.rb +1 -0
  208. data/scenarios/hold_void/request.rb +3 -0
  209. data/scenarios/hold_void/ruby.mako +10 -0
  210. data/scenarios/refund_account_list/definition.rb +1 -0
  211. data/scenarios/refund_account_list/request.rb +3 -0
  212. data/scenarios/refund_account_list/ruby.mako +10 -0
  213. data/scenarios/refund_create/definition.rb +1 -0
  214. data/scenarios/refund_create/request.rb +6 -0
  215. data/scenarios/refund_create/ruby.mako +14 -0
  216. data/scenarios/refund_customer_list/definition.rb +1 -0
  217. data/scenarios/refund_customer_list/request.rb +3 -0
  218. data/scenarios/refund_list/definition.rb +1 -0
  219. data/scenarios/refund_list/request.rb +4 -0
  220. data/scenarios/refund_list/ruby.mako +11 -0
  221. data/scenarios/refund_show/definition.rb +1 -0
  222. data/scenarios/refund_show/request.rb +2 -0
  223. data/scenarios/refund_show/ruby.mako +10 -0
  224. data/scenarios/refund_update/definition.rb +1 -0
  225. data/scenarios/refund_update/request.rb +5 -0
  226. data/scenarios/refund_update/ruby.mako +13 -0
  227. data/scenarios/render.rb +32 -0
  228. data/scenarios/render_mako.rb +43 -0
  229. data/scenarios/render_one.rb +32 -0
  230. data/spec/balanced/resources/credit_spec.rb +23 -0
  231. data/spec/scenarios_spec.rb +39 -0
  232. data/spec/spec_helper.rb +2 -1
  233. metadata +237 -11
  234. checksums.yaml +0 -7
@@ -0,0 +1 @@
1
+ Balanced::Credit.save
@@ -0,0 +1,9 @@
1
+ <%= boiler_plate %>
2
+ bank_account_info = {
3
+ <%= params_to_hash.call(request['bank_account']) %>
4
+ }
5
+
6
+ credit = Balanced::Credit.new(
7
+ :amount => <%= request['amount'] %>,
8
+ :bank_account => bank_account_info
9
+ ).save
@@ -0,0 +1,17 @@
1
+ % if mode == 'definition':
2
+ Balanced::Credit.save
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ bank_account_info = {
9
+ :account_number => '9900000001',:name => 'Johann Bernoulli',:routing_number => '121000358',:type => 'checking',
10
+ }
11
+
12
+ credit = Balanced::Credit.new(
13
+ :amount => 10000,
14
+ :bank_account => bank_account_info
15
+ ).save
16
+
17
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Credit.find
@@ -0,0 +1,4 @@
1
+ <%= boiler_plate %>
2
+ marketplace = Balanced::Marketplace.my_marketplace
3
+
4
+ credit = Balanced::Credit.find('<%= request["uri"] %>')
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Credit.find
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ marketplace = Balanced::Marketplace.my_marketplace
9
+
10
+ credit = Balanced::Credit.find('/v1/credits/CR4PR7caYHW7H4SFJsSDQ5So')
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.add_bank_account
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%=request['uri']%>')
3
+ customer.add_bank_account("<%=payload['bank_account_uri']%>")
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.add_bank_account
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ customer = Balanced::Customer.find('/v1/customers/CU5NTZ8MGBW3x8Axx8fTzgeQ')
9
+ customer.add_bank_account("/v1/bank_accounts/BA5ONs53HNn1Od9g99v0GNFJ")
10
+
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.add_card
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%=request['uri']%>')
3
+ response = customer.add_card('<%= payload['card_uri']%>')
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.add_card
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ customer = Balanced::Customer.find('/v1/customers/CU5KrnM7ufxhgePgmghE6f5K')
9
+ response = customer.add_card('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/cards/CC5Lx8CAHB3bRXG1sENg7urM')
10
+
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.debit
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%=request['uri']%>')
3
+ customer.debit(:amount => '<%=payload['amount']%>', :hold_uri => '<%=payload['hold_uri']%>')
File without changes
@@ -0,0 +1 @@
1
+ Balanced::Customer.new
@@ -0,0 +1,2 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.new.save
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.new
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ customer = Balanced::Customer.new.save
9
+
10
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.debit
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%=request['customer_uri']%>')
3
+ customer.debit(:amount => '<%=payload['amount']%>')
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.debit
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('c72cb360d3ae11e29593026ba7d31e6f')
7
+
8
+ customer = Balanced::Customer.find('/v1/customers/CU7GuPv9Y2F8ySwJHuHL0YWq')
9
+ customer.debit(:amount => '1000')
10
+
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.hold
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%=request['customer_uri']%>')
3
+ customer.hold(:amount => '<%=payload['amount']%>')
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.hold
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('c72cb360d3ae11e29593026ba7d31e6f')
7
+
8
+ customer = Balanced::Customer.find('/v1/customers/CU7GuPv9Y2F8ySwJHuHL0YWq')
9
+ customer.hold(:amount => '1000')
10
+
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.credit
@@ -0,0 +1,2 @@
1
+ customer = Balanced::Customer.find('<%=request['customer_uri']%>')
2
+ customer.credit(:amount => '<%=payload['amount']%>')
@@ -0,0 +1,8 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.credit
3
+
4
+ % else:
5
+ customer = Balanced::Customer.find('/v1/customers/CU6PXyMacKRYKNJPJFKtONK0')
6
+ customer.credit(:amount => '100')
7
+
8
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Account.debits
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ account = Balanced::Account.find('<%= request['uri'] %>')
3
+ debits = account.debits
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Account.debits
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ account = Balanced::Account.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/accounts/AC4FqqEyFyTcd3eHhh2YXL4c')
9
+ debits = account.debits
10
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.debit()
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ customer = Balanced::Customer.find('<%= request['customer_uri'] %>')
3
+ customer.debit(<%= params_to_hash_for_args.call(payload) %>)
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.debit()
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ customer = Balanced::Customer.find('')
9
+ customer.debit({:amount=>5000, :appears_on_statement_as=>"Statement text", :description=>"Some descriptive text for the debit in the dashboard"})
10
+
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Customer.debits
@@ -0,0 +1,4 @@
1
+ <%= boiler_plate %>
2
+
3
+ customer = Balanced::Customer.find('<%=request['uri']%>')
4
+ debits = customer.debits
@@ -0,0 +1,12 @@
1
+ % if mode == 'definition':
2
+ Balanced::Customer.debits
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('c72cb360d3ae11e29593026ba7d31e6f')
7
+
8
+
9
+ customer = Balanced::Customer.find('/v1/customers/CU6W5pSk2CUXQxhENqyGRvQe')
10
+ debits = customer.debits
11
+
12
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Debit.all
@@ -0,0 +1,4 @@
1
+ <%= boiler_plate %>
2
+ marketplace = Balanced::Marketplace.my_marketplace
3
+
4
+ debits = Balanced::Debit.all(:limit => 2)
@@ -0,0 +1,11 @@
1
+ % if mode == 'definition':
2
+ Balanced::Debit.all
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ marketplace = Balanced::Marketplace.my_marketplace
9
+
10
+ debits = Balanced::Debit.all(:limit => 2)
11
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Debit.refund()
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ debit = Balanced::Debit.find('<%= request['debit_uri'] %>')
3
+ debit.refund
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Debit.refund()
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/debits/WD5aKzkNv487e4XjjbbfV5TU')
9
+ debit.refund
10
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Debit.find()
@@ -0,0 +1,2 @@
1
+ <%= boiler_plate %>
2
+ debit = Balanced::Debit.find('<%= request['uri'] %>')
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Debit.find()
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/debits/WD51Ol3hw58fAlNvC3V0qLg3')
9
+
10
+ % endif
@@ -0,0 +1 @@
1
+ Balanced::Debit.save()
@@ -0,0 +1,5 @@
1
+ <%= boiler_plate %>
2
+ debit = Balanced::Debit.find('<%= request['uri'] %>')
3
+ debit.description = '<%= payload['description'] %>'
4
+ debit.meta = <%= params_to_hash_for_args.call(payload['meta']) %>
5
+ debit.save
@@ -0,0 +1,13 @@
1
+ % if mode == 'definition':
2
+ Balanced::Debit.save()
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ debit = Balanced::Debit.find('/v1/marketplaces/TEST-MP4erLnXCYoaeyr3tx95WSKc/debits/WD51Ol3hw58fAlNvC3V0qLg3')
9
+ debit.description = 'New description for debit'
10
+ debit.meta = {:anykey=>"valuegoeshere", :"facebook.id"=>"1234567890"}
11
+ debit.save
12
+
13
+ % endif
@@ -0,0 +1,7 @@
1
+ require 'fileutils'
2
+
3
+ Dir.chdir("./scenarios")
4
+ subdir_list = Dir["*"].reject { |o| not File.directory?(o) }
5
+ subdir_list.each do |scenario|
6
+ FileUtils.rm_rf("./#{scenario}/executable.rb", secure: true)
7
+ end
@@ -0,0 +1 @@
1
+ Balanced::Event.all
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ marketplace = Balanced::Marketplace.my_marketplace
3
+ events = Balanced::Event.all(:limit => 2)
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Event.all
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ marketplace = Balanced::Marketplace.my_marketplace
9
+ events = Balanced::Event.all(:limit => 2)
10
+ % endif
File without changes
@@ -0,0 +1 @@
1
+ <%= boiler_plate %>
File without changes
@@ -0,0 +1 @@
1
+ Balanced::Event.find()
@@ -0,0 +1,2 @@
1
+ <%= boiler_plate %>
2
+ event = Balanced::Event.find('<%= request['uri'] %>')
@@ -0,0 +1,10 @@
1
+ % if mode == 'definition':
2
+ Balanced::Event.find()
3
+
4
+ % else:
5
+ require 'balanced'
6
+ Balanced.configure('8af725c6d54611e2bf5e026ba7f8ec28')
7
+
8
+ event = Balanced::Event.find('/v1/events/EV8b1a77a6d54611e2bbc4026ba7f8ec28')
9
+
10
+ % endif
@@ -0,0 +1,27 @@
1
+ require 'json'
2
+ require 'rspec'
3
+
4
+ parsed_data = JSON.parse(File.read('./scenario.cache'))
5
+
6
+ # list all directories in scenarios directory
7
+
8
+ Dir.chdir("./scenarios")
9
+ subdir_list = Dir["*"].reject { |o| not File.directory?(o) }
10
+
11
+ describe "each scenario should execute" do
12
+ subdir_list.each do |scenario|
13
+ response = nil
14
+ next unless File.exist?("./#{scenario}/executable.rb")
15
+ next if scenario == "event_list" # bug with event_list, hangs
16
+ # and then times out
17
+ file = File.read("./#{scenario}/executable.rb")
18
+ begin
19
+ response = eval(file) # evaluate file to make sure it's a valid Ruby file
20
+ rescue
21
+ puts "#{scenario}'s executable raised an error"
22
+ end
23
+ it "#{scenario}" do
24
+ response.should_not be_nil
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,15 @@
1
+ # stabby lambdas "= ->"" is same as lambda { |params ... }
2
+ params_to_hash = ->(params) do
3
+ "".tap do |s|
4
+ params.each do |k, v|
5
+ s << ":#{k} => '#{v}',"
6
+ end
7
+ end
8
+ end
9
+
10
+ params_to_hash_for_args = ->(payload) do
11
+ payload.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
12
+ end
13
+
14
+ @helpers = {:params_to_hash => params_to_hash,
15
+ :params_to_hash_for_args => params_to_hash_for_args}