balanced 0.8.2 → 1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. checksums.yaml +4 -4
  2. data/.rbenv-version +1 -1
  3. data/.ruby-version +1 -1
  4. data/Gemfile +7 -3
  5. data/README.md +2 -10
  6. data/Rakefile +4 -18
  7. data/balanced.gemspec +8 -10
  8. data/lib/balanced.rb +28 -28
  9. data/lib/balanced/client.rb +15 -6
  10. data/lib/balanced/error.rb +21 -12
  11. data/lib/balanced/pager.rb +66 -25
  12. data/lib/balanced/resources.rb +18 -17
  13. data/lib/balanced/resources/api_key.rb +4 -0
  14. data/lib/balanced/resources/bank_account.rb +26 -75
  15. data/lib/balanced/resources/callback.rb +2 -0
  16. data/lib/balanced/resources/card.rb +15 -65
  17. data/lib/balanced/resources/card_hold.rb +38 -0
  18. data/lib/balanced/resources/credit.rb +6 -50
  19. data/lib/balanced/resources/customer.rb +33 -71
  20. data/lib/balanced/resources/debit.rb +6 -14
  21. data/lib/balanced/resources/event.rb +6 -0
  22. data/lib/balanced/resources/funding_instrument.rb +11 -0
  23. data/lib/balanced/resources/hypermedia.rb +28 -0
  24. data/lib/balanced/resources/marketplace.rb +5 -203
  25. data/lib/balanced/resources/order.rb +71 -0
  26. data/lib/balanced/resources/refund.rb +2 -7
  27. data/lib/balanced/resources/resource.rb +169 -106
  28. data/lib/balanced/resources/reversal.rb +2 -8
  29. data/lib/balanced/resources/transfer.rb +11 -0
  30. data/lib/balanced/response/balanced_exception_middleware.rb +2 -2
  31. data/lib/balanced/utils.rb +47 -14
  32. data/lib/balanced/version.rb +1 -1
  33. data/scenario.cache +526 -380
  34. data/scenarios/api_key_create/definition.rb +1 -0
  35. data/scenarios/api_key_create/request.rb +2 -0
  36. data/scenarios/api_key_create/ruby.mako +21 -0
  37. data/scenarios/api_key_delete/definition.rb +1 -0
  38. data/scenarios/api_key_delete/request.rb +3 -0
  39. data/scenarios/api_key_delete/ruby.mako +12 -0
  40. data/scenarios/api_key_list/definition.rb +1 -0
  41. data/scenarios/api_key_list/request.rb +2 -0
  42. data/scenarios/api_key_list/ruby.mako +28 -0
  43. data/scenarios/api_key_show/definition.rb +1 -0
  44. data/scenarios/api_key_show/request.rb +2 -0
  45. data/scenarios/api_key_show/ruby.mako +18 -0
  46. data/scenarios/{customer_add_bank_account → bank_account_associate_to_customer}/definition.rb +0 -0
  47. data/scenarios/bank_account_associate_to_customer/request.rb +3 -0
  48. data/scenarios/bank_account_associate_to_customer/ruby.mako +49 -0
  49. data/scenarios/bank_account_create/definition.rb +1 -1
  50. data/scenarios/bank_account_create/request.rb +1 -1
  51. data/scenarios/bank_account_create/ruby.mako +44 -7
  52. data/scenarios/{credit_create_existing_bank_account → bank_account_credit}/definition.rb +0 -0
  53. data/scenarios/bank_account_credit/request.rb +3 -0
  54. data/scenarios/bank_account_credit/ruby.mako +42 -0
  55. data/scenarios/bank_account_debit/definition.rb +1 -0
  56. data/scenarios/bank_account_debit/request.rb +5 -0
  57. data/scenarios/bank_account_debit/ruby.mako +50 -0
  58. data/scenarios/bank_account_delete/request.rb +1 -1
  59. data/scenarios/bank_account_delete/ruby.mako +5 -3
  60. data/scenarios/bank_account_list/ruby.mako +76 -2
  61. data/scenarios/bank_account_show/definition.rb +1 -1
  62. data/scenarios/bank_account_show/request.rb +1 -1
  63. data/scenarios/bank_account_show/ruby.mako +41 -5
  64. data/scenarios/bank_account_update/definition.rb +1 -0
  65. data/scenarios/bank_account_update/request.rb +6 -0
  66. data/scenarios/bank_account_update/ruby.mako +56 -0
  67. data/scenarios/bank_account_verification_create/request.rb +1 -1
  68. data/scenarios/bank_account_verification_create/ruby.mako +20 -3
  69. data/scenarios/bank_account_verification_show/definition.rb +1 -1
  70. data/scenarios/bank_account_verification_show/request.rb +1 -1
  71. data/scenarios/bank_account_verification_show/ruby.mako +21 -4
  72. data/scenarios/bank_account_verification_update/definition.rb +1 -1
  73. data/scenarios/bank_account_verification_update/request.rb +5 -5
  74. data/scenarios/bank_account_verification_update/ruby.mako +24 -8
  75. data/scenarios/callback_create/definition.rb +1 -1
  76. data/scenarios/callback_create/request.rb +2 -2
  77. data/scenarios/callback_create/ruby.mako +22 -0
  78. data/scenarios/callback_delete/definition.rb +1 -1
  79. data/scenarios/callback_delete/request.rb +2 -2
  80. data/scenarios/callback_delete/ruby.mako +12 -0
  81. data/scenarios/callback_list/definition.rb +1 -1
  82. data/scenarios/callback_list/request.rb +1 -2
  83. data/scenarios/callback_list/ruby.mako +20 -0
  84. data/scenarios/callback_show/definition.rb +1 -1
  85. data/scenarios/callback_show/request.rb +1 -1
  86. data/scenarios/callback_show/ruby.mako +20 -0
  87. data/scenarios/{customer_add_card → card_associate_to_customer}/definition.rb +0 -0
  88. data/scenarios/card_associate_to_customer/request.rb +3 -0
  89. data/scenarios/card_associate_to_customer/ruby.mako +49 -0
  90. data/scenarios/card_create/request.rb +1 -2
  91. data/scenarios/card_create/ruby.mako +44 -7
  92. data/scenarios/card_debit/definition.rb +1 -0
  93. data/scenarios/card_debit/request.rb +5 -0
  94. data/scenarios/card_debit/ruby.mako +49 -0
  95. data/scenarios/card_delete/request.rb +1 -1
  96. data/scenarios/card_delete/ruby.mako +5 -3
  97. data/scenarios/card_hold_capture/definition.rb +1 -0
  98. data/scenarios/card_hold_capture/request.rb +5 -0
  99. data/scenarios/card_hold_capture/ruby.mako +49 -0
  100. data/scenarios/card_hold_create/definition.rb +1 -0
  101. data/scenarios/card_hold_create/request.rb +5 -0
  102. data/scenarios/card_hold_create/ruby.mako +38 -0
  103. data/scenarios/card_hold_list/definition.rb +1 -0
  104. data/scenarios/card_hold_list/request.rb +2 -0
  105. data/scenarios/card_hold_list/ruby.mako +60 -0
  106. data/scenarios/card_hold_show/definition.rb +1 -0
  107. data/scenarios/card_hold_show/request.rb +2 -0
  108. data/scenarios/card_hold_show/ruby.mako +36 -0
  109. data/scenarios/card_hold_update/definition.rb +1 -0
  110. data/scenarios/card_hold_update/request.rb +7 -0
  111. data/scenarios/card_hold_update/ruby.mako +42 -0
  112. data/scenarios/card_hold_void/definition.rb +1 -0
  113. data/scenarios/card_hold_void/request.rb +3 -0
  114. data/scenarios/card_hold_void/ruby.mako +36 -0
  115. data/scenarios/card_list/definition.rb +1 -1
  116. data/scenarios/card_list/request.rb +1 -1
  117. data/scenarios/card_list/ruby.mako +78 -5
  118. data/scenarios/card_show/definition.rb +1 -1
  119. data/scenarios/card_show/request.rb +1 -1
  120. data/scenarios/card_show/ruby.mako +42 -4
  121. data/scenarios/card_update/definition.rb +1 -1
  122. data/scenarios/card_update/request.rb +1 -1
  123. data/scenarios/card_update/ruby.mako +45 -4
  124. data/scenarios/credit_list/request.rb +1 -3
  125. data/scenarios/credit_list/ruby.mako +34 -4
  126. data/scenarios/{credit_bank_account_list → credit_list_bank_account}/definition.rb +0 -0
  127. data/scenarios/credit_list_bank_account/request.rb +3 -0
  128. data/scenarios/credit_list_bank_account/ruby.mako +13 -0
  129. data/scenarios/credit_show/definition.rb +1 -1
  130. data/scenarios/credit_show/request.rb +1 -3
  131. data/scenarios/credit_show/ruby.mako +35 -5
  132. data/scenarios/{credit_create_new_bank_account → credit_update}/definition.rb +0 -0
  133. data/scenarios/credit_update/request.rb +7 -0
  134. data/scenarios/credit_update/ruby.mako +48 -0
  135. data/scenarios/customer_create/request.rb +4 -1
  136. data/scenarios/customer_create/ruby.mako +60 -3
  137. data/scenarios/customer_delete/request.rb +1 -1
  138. data/scenarios/customer_delete/ruby.mako +4 -2
  139. data/scenarios/customer_list/definition.rb +1 -0
  140. data/scenarios/customer_list/request.rb +2 -0
  141. data/scenarios/customer_list/ruby.mako +105 -0
  142. data/scenarios/customer_show/definition.rb +1 -0
  143. data/scenarios/customer_show/request.rb +2 -0
  144. data/scenarios/customer_show/ruby.mako +58 -0
  145. data/scenarios/customer_update/definition.rb +1 -0
  146. data/scenarios/customer_update/request.rb +7 -0
  147. data/scenarios/customer_update/ruby.mako +64 -0
  148. data/scenarios/debit_list/request.rb +1 -3
  149. data/scenarios/debit_list/ruby.mako +70 -4
  150. data/scenarios/debit_show/definition.rb +1 -1
  151. data/scenarios/debit_show/request.rb +1 -1
  152. data/scenarios/debit_show/ruby.mako +39 -4
  153. data/scenarios/debit_update/definition.rb +1 -1
  154. data/scenarios/debit_update/request.rb +1 -1
  155. data/scenarios/debit_update/ruby.mako +39 -4
  156. data/scenarios/event_list/definition.rb +1 -1
  157. data/scenarios/event_list/request.rb +1 -2
  158. data/scenarios/event_list/ruby.mako +54 -5
  159. data/scenarios/event_show/definition.rb +1 -1
  160. data/scenarios/event_show/request.rb +1 -1
  161. data/scenarios/event_show/ruby.mako +54 -4
  162. data/scenarios/helpers.rb +29 -2
  163. data/scenarios/order_create/definition.rb +1 -0
  164. data/scenarios/order_create/request.rb +5 -0
  165. data/scenarios/order_create/ruby.mako +46 -0
  166. data/scenarios/order_list/definition.rb +1 -0
  167. data/scenarios/order_list/request.rb +2 -0
  168. data/scenarios/order_list/ruby.mako +42 -0
  169. data/scenarios/order_show/definition.rb +1 -0
  170. data/scenarios/order_show/request.rb +2 -0
  171. data/scenarios/order_show/ruby.mako +44 -0
  172. data/scenarios/order_update/definition.rb +1 -0
  173. data/scenarios/order_update/request.rb +7 -0
  174. data/scenarios/order_update/ruby.mako +50 -0
  175. data/scenarios/refund_create/definition.rb +1 -1
  176. data/scenarios/refund_create/request.rb +2 -1
  177. data/scenarios/refund_create/ruby.mako +33 -5
  178. data/scenarios/refund_list/request.rb +1 -3
  179. data/scenarios/refund_list/ruby.mako +30 -4
  180. data/scenarios/refund_show/definition.rb +1 -1
  181. data/scenarios/refund_show/request.rb +1 -1
  182. data/scenarios/refund_show/ruby.mako +32 -4
  183. data/scenarios/refund_update/definition.rb +1 -1
  184. data/scenarios/refund_update/request.rb +1 -1
  185. data/scenarios/refund_update/ruby.mako +32 -4
  186. data/scenarios/render_mako.rb +59 -4
  187. data/scenarios/reversal_create/definition.rb +1 -0
  188. data/scenarios/reversal_create/request.rb +9 -0
  189. data/scenarios/reversal_create/ruby.mako +45 -0
  190. data/scenarios/reversal_list/definition.rb +1 -0
  191. data/scenarios/reversal_list/request.rb +2 -0
  192. data/scenarios/reversal_list/ruby.mako +36 -0
  193. data/scenarios/reversal_show/definition.rb +1 -0
  194. data/scenarios/reversal_show/request.rb +2 -0
  195. data/scenarios/reversal_show/ruby.mako +37 -0
  196. data/scenarios/reversal_update/definition.rb +1 -0
  197. data/scenarios/reversal_update/request.rb +7 -0
  198. data/scenarios/reversal_update/ruby.mako +44 -0
  199. data/spec/balanced/error_spec.rb +7 -7
  200. data/spec/balanced/pager_spec.rb +10 -10
  201. data/spec/balanced/resources/api_key_spec.rb +6 -35
  202. data/spec/balanced/resources/bank_account_spec.rb +123 -218
  203. data/spec/balanced/resources/callback_spec.rb +12 -13
  204. data/spec/balanced/resources/card_hold_spec.rb +103 -0
  205. data/spec/balanced/resources/card_spec.rb +101 -27
  206. data/spec/balanced/resources/credit_spec.rb +69 -35
  207. data/spec/balanced/resources/customer_spec.rb +91 -271
  208. data/spec/balanced/resources/debit_spec.rb +95 -0
  209. data/spec/balanced/resources/marketplace_spec.rb +17 -170
  210. data/spec/balanced/resources/order_spec.rb +364 -0
  211. data/spec/balanced/resources/resource_spec.rb +25 -32
  212. data/spec/balanced_spec.rb +18 -36
  213. data/spec/client_spec.rb +7 -7
  214. data/spec/spec_helper.rb +19 -18
  215. data/spec/utils_spec.rb +5 -5
  216. metadata +123 -165
  217. data/examples/bank_account_debits.rb +0 -57
  218. data/examples/customers.rb +0 -114
  219. data/examples/events_and_callbacks.rb +0 -81
  220. data/examples/examples.rb +0 -162
  221. data/examples/exception_handling.rb +0 -44
  222. data/lib/balanced/resources/account.rb +0 -179
  223. data/lib/balanced/resources/hold.rb +0 -61
  224. data/lib/balanced/resources/invoice.rb +0 -11
  225. data/lib/balanced/resources/merchant.rb +0 -21
  226. data/lib/balanced/resources/transaction.rb +0 -17
  227. data/scenarios/account_add_card/definition.rb +0 -1
  228. data/scenarios/account_add_card/request.rb +0 -3
  229. data/scenarios/account_add_card/ruby.mako +0 -11
  230. data/scenarios/account_capture_hold/definition.rb +0 -1
  231. data/scenarios/account_capture_hold/request.rb +0 -3
  232. data/scenarios/account_capture_hold/ruby.mako +0 -11
  233. data/scenarios/account_create/definition.rb +0 -1
  234. data/scenarios/account_create/request.rb +0 -2
  235. data/scenarios/account_create/ruby.mako +0 -10
  236. data/scenarios/account_create_buyer/definition.rb +0 -1
  237. data/scenarios/account_create_buyer/request.rb +0 -5
  238. data/scenarios/account_create_buyer/ruby.mako +0 -13
  239. data/scenarios/account_create_debit/definition.rb +0 -1
  240. data/scenarios/account_create_debit/request.rb +0 -3
  241. data/scenarios/account_create_debit/ruby.mako +0 -11
  242. data/scenarios/account_create_hold/definition.rb +0 -1
  243. data/scenarios/account_create_hold/request.rb +0 -3
  244. data/scenarios/account_create_hold/ruby.mako +0 -11
  245. data/scenarios/account_create_merchant/definition.rb +0 -1
  246. data/scenarios/account_create_merchant/request.rb +0 -3
  247. data/scenarios/account_create_merchant/ruby.mako +0 -11
  248. data/scenarios/account_underwrite_business/definition.rb +0 -1
  249. data/scenarios/account_underwrite_business/request.rb +0 -17
  250. data/scenarios/account_underwrite_business/ruby.mako +0 -37
  251. data/scenarios/account_underwrite_person/definition.rb +0 -1
  252. data/scenarios/account_underwrite_person/request.rb +0 -18
  253. data/scenarios/account_underwrite_person/ruby.mako +0 -31
  254. data/scenarios/bank_account_find_and_credit/definition.rb +0 -1
  255. data/scenarios/bank_account_find_and_credit/request.rb +0 -5
  256. data/scenarios/bank_account_find_and_credit/ruby.mako +0 -13
  257. data/scenarios/bank_account_find_and_delete/definition.rb +0 -1
  258. data/scenarios/bank_account_find_and_delete/request.rb +0 -3
  259. data/scenarios/bank_account_find_and_delete/ruby.mako +0 -10
  260. data/scenarios/bank_account_invalid_routing_number/definition.rb +0 -1
  261. data/scenarios/bank_account_invalid_routing_number/request.rb +0 -11
  262. data/scenarios/bank_account_invalid_routing_number/ruby.mako +0 -16
  263. data/scenarios/card_invalidate/definition.rb +0 -1
  264. data/scenarios/card_invalidate/request.rb +0 -3
  265. data/scenarios/card_invalidate/ruby.mako +0 -10
  266. data/scenarios/credit_account_list/definition.rb +0 -1
  267. data/scenarios/credit_account_list/request.rb +0 -3
  268. data/scenarios/credit_account_list/ruby.mako +0 -10
  269. data/scenarios/credit_account_merchant_create/definition.rb +0 -1
  270. data/scenarios/credit_account_merchant_create/request.rb +0 -5
  271. data/scenarios/credit_account_merchant_create/ruby.mako +0 -12
  272. data/scenarios/credit_bank_account_list/request.rb +0 -5
  273. data/scenarios/credit_bank_account_list/ruby.mako +0 -12
  274. data/scenarios/credit_create_existing_bank_account/request.rb +0 -5
  275. data/scenarios/credit_create_existing_bank_account/ruby.mako +0 -12
  276. data/scenarios/credit_create_new_bank_account/request.rb +0 -10
  277. data/scenarios/credit_create_new_bank_account/ruby.mako +0 -21
  278. data/scenarios/credit_customer_list/definition.rb +0 -1
  279. data/scenarios/credit_customer_list/request.rb +0 -4
  280. data/scenarios/credit_customer_list/ruby.mako +0 -12
  281. data/scenarios/credit_failed_state/definition.rb +0 -1
  282. data/scenarios/credit_failed_state/request.rb +0 -10
  283. data/scenarios/credit_failed_state/ruby.mako +0 -18
  284. data/scenarios/credit_paid_state/definition.rb +0 -1
  285. data/scenarios/credit_paid_state/request.rb +0 -11
  286. data/scenarios/credit_paid_state/ruby.mako +0 -19
  287. data/scenarios/credit_pending_state/definition.rb +0 -1
  288. data/scenarios/credit_pending_state/request.rb +0 -9
  289. data/scenarios/credit_pending_state/ruby.mako +0 -17
  290. data/scenarios/customer_add_bank_account/request.rb +0 -3
  291. data/scenarios/customer_add_bank_account/ruby.mako +0 -11
  292. data/scenarios/customer_add_card/request.rb +0 -3
  293. data/scenarios/customer_add_card/ruby.mako +0 -11
  294. data/scenarios/customer_capture_hold/definition.rb +0 -1
  295. data/scenarios/customer_capture_hold/request.rb +0 -3
  296. data/scenarios/customer_capture_hold/ruby.mako +0 -0
  297. data/scenarios/customer_create_debit/definition.rb +0 -1
  298. data/scenarios/customer_create_debit/request.rb +0 -3
  299. data/scenarios/customer_create_debit/ruby.mako +0 -11
  300. data/scenarios/customer_create_hold/definition.rb +0 -1
  301. data/scenarios/customer_create_hold/request.rb +0 -3
  302. data/scenarios/customer_create_hold/ruby.mako +0 -11
  303. data/scenarios/customer_credit/definition.rb +0 -1
  304. data/scenarios/customer_credit/request.rb +0 -2
  305. data/scenarios/customer_credit/ruby.mako +0 -8
  306. data/scenarios/debit_account_list/definition.rb +0 -1
  307. data/scenarios/debit_account_list/request.rb +0 -3
  308. data/scenarios/debit_account_list/ruby.mako +0 -10
  309. data/scenarios/debit_create/definition.rb +0 -1
  310. data/scenarios/debit_create/request.rb +0 -5
  311. data/scenarios/debit_create/ruby.mako +0 -15
  312. data/scenarios/debit_customer_list/definition.rb +0 -1
  313. data/scenarios/debit_customer_list/request.rb +0 -4
  314. data/scenarios/debit_customer_list/ruby.mako +0 -12
  315. data/scenarios/debit_refund/definition.rb +0 -1
  316. data/scenarios/debit_refund/request.rb +0 -3
  317. data/scenarios/debit_refund/ruby.mako +0 -10
  318. data/scenarios/delete.rb +0 -7
  319. data/scenarios/event_replay/definition.rb +0 -0
  320. data/scenarios/event_replay/request.rb +0 -1
  321. data/scenarios/event_replay/ruby.mako +0 -0
  322. data/scenarios/execute.rb +0 -27
  323. data/scenarios/hold_account_list/definition.rb +0 -1
  324. data/scenarios/hold_account_list/request.rb +0 -3
  325. data/scenarios/hold_account_list/ruby.mako +0 -10
  326. data/scenarios/hold_capture/definition.rb +0 -1
  327. data/scenarios/hold_capture/request.rb +0 -5
  328. data/scenarios/hold_capture/ruby.mako +0 -15
  329. data/scenarios/hold_create/definition.rb +0 -1
  330. data/scenarios/hold_create/request.rb +0 -5
  331. data/scenarios/hold_create/ruby.mako +0 -14
  332. data/scenarios/hold_customer_list/definition.rb +0 -1
  333. data/scenarios/hold_customer_list/request.rb +0 -3
  334. data/scenarios/hold_customer_list/ruby.mako +0 -11
  335. data/scenarios/hold_list/definition.rb +0 -1
  336. data/scenarios/hold_list/request.rb +0 -4
  337. data/scenarios/hold_list/ruby.mako +0 -11
  338. data/scenarios/hold_show/definition.rb +0 -1
  339. data/scenarios/hold_show/request.rb +0 -2
  340. data/scenarios/hold_show/ruby.mako +0 -10
  341. data/scenarios/hold_update/definition.rb +0 -1
  342. data/scenarios/hold_update/request.rb +0 -7
  343. data/scenarios/hold_update/ruby.mako +0 -16
  344. data/scenarios/hold_void/definition.rb +0 -1
  345. data/scenarios/hold_void/request.rb +0 -3
  346. data/scenarios/hold_void/ruby.mako +0 -10
  347. data/scenarios/refund_account_list/definition.rb +0 -1
  348. data/scenarios/refund_account_list/request.rb +0 -3
  349. data/scenarios/refund_account_list/ruby.mako +0 -10
  350. data/scenarios/refund_customer_list/definition.rb +0 -1
  351. data/scenarios/refund_customer_list/request.rb +0 -3
  352. data/scenarios/refund_customer_list/ruby.mako +0 -11
  353. data/scenarios/render.rb +0 -32
  354. data/scenarios/render_one.rb +0 -32
  355. data/spec/balanced/resources/account_spec.rb +0 -636
  356. data/spec/balanced/resources/hold_spec.rb +0 -48
  357. data/spec/balanced/resources/merchant_spec.rb +0 -6
  358. data/spec/scenarios_spec.rb +0 -39
  359. data/upload_docs.rb +0 -40
@@ -0,0 +1,36 @@
1
+ % if mode == 'definition':
2
+ Balanced::CardHold.void
3
+
4
+ % elif mode == 'request':
5
+ require 'balanced'
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
+
8
+ card_hold = Balanced::CardHold.fetch('/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG')
9
+ card_hold.void
10
+ % elif mode == 'response':
11
+ #<Balanced::CardHold:0x007fdc9d2ee9c0
12
+ @attributes=
13
+ {"amount"=>5000,
14
+ "created_at"=>"2014-01-27T22:56:49.446376Z",
15
+ "currency"=>"USD",
16
+ "description"=>"Some descriptive text for the debit in the dashboard",
17
+ "expires_at"=>"2014-02-03T22:56:50.793698Z",
18
+ "failure_reason"=>nil,
19
+ "failure_reason_code"=>nil,
20
+ "href"=>"/card_holds/HL2ncCO5Bir2S0PCdsDHV3cG",
21
+ "id"=>"HL2ncCO5Bir2S0PCdsDHV3cG",
22
+ "links"=>{"card"=>"CC2abDOQVm5aNFhHpcRvWS02", "debit"=>nil},
23
+ "meta"=>{},
24
+ "transaction_number"=>"HL102-313-8003",
25
+ "updated_at"=>"2014-01-27T22:56:51.686616Z"},
26
+ @hyperlinks=
27
+ {"card"=>
28
+ #<Proc:0x007fdc9d2ec3a0/lib/balanced/resources/resource.rb:60 (lambda)>,
29
+ "debit"=>
30
+ #<Proc:0x007fdc9c07f988/lib/balanced/utils.rb:6 (lambda)>,
31
+ "debits"=>
32
+ #<Proc:0x007fdc9c07da20/lib/balanced/utils.rb:6 (lambda)>,
33
+ "events"=>
34
+ #<Proc:0x007fdc9c25ba18/lib/balanced/utils.rb:6 (lambda)>}>
35
+
36
+ % endif
@@ -1 +1 @@
1
- Balanced::Marketplace.cards
1
+ Balanced::Card.all
@@ -1,2 +1,2 @@
1
1
  <%= boiler_plate %>
2
- cards = Balanced::Marketplace.my_marketplace.cards
2
+ cards = Balanced::Card.all
@@ -1,9 +1,82 @@
1
1
  % if mode == 'definition':
2
- Balanced::Marketplace.cards
3
-
4
- % else:
2
+ Balanced::Card.all
3
+ % elif mode == 'request':
5
4
  require 'balanced'
6
- Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
5
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
6
+
7
+ cards = Balanced::Card.all
8
+ % elif mode == 'response':
9
+ [#<Balanced::Card:0x007fdc9c270a30
10
+ @attributes=
11
+ {"address"=>
12
+ {"city"=>nil,
13
+ "country_code"=>nil,
14
+ "line1"=>nil,
15
+ "line2"=>nil,
16
+ "postal_code"=>nil,
17
+ "state"=>nil},
18
+ "avs_postal_match"=>nil,
19
+ "avs_result"=>nil,
20
+ "avs_street_match"=>nil,
21
+ "brand"=>"MasterCard",
22
+ "created_at"=>"2014-01-27T22:56:55.656375Z",
23
+ "cvv"=>nil,
24
+ "cvv_match"=>nil,
25
+ "cvv_result"=>nil,
26
+ "expiration_month"=>12,
27
+ "expiration_year"=>2020,
28
+ "fingerprint"=>
29
+ "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
30
+ "href"=>"/cards/CC2uc8iPDjgyxOXHVtnZloyI",
31
+ "id"=>"CC2uc8iPDjgyxOXHVtnZloyI",
32
+ "is_verified"=>true,
33
+ "links"=>{"customer"=>nil},
34
+ "meta"=>{},
35
+ "name"=>nil,
36
+ "number"=>"xxxxxxxxxxxx5100",
37
+ "updated_at"=>"2014-01-27T22:56:55.656379Z"},
38
+ @hyperlinks=
39
+ {"card_holds"=>
40
+ #<Proc:0x007fdc9c27a4e0/lib/balanced/utils.rb:6 (lambda)>,
41
+ "customer"=>
42
+ #<Proc:0x007fdc9c279b08/lib/balanced/utils.rb:6 (lambda)>,
43
+ "debits"=>
44
+ #<Proc:0x007fdc9c283c20/lib/balanced/utils.rb:6 (lambda)>}>,
45
+ #<Balanced::Card:0x007fdc9c283bd0
46
+ @attributes=
47
+ {"address"=>
48
+ {"city"=>nil,
49
+ "country_code"=>nil,
50
+ "line1"=>nil,
51
+ "line2"=>nil,
52
+ "postal_code"=>nil,
53
+ "state"=>nil},
54
+ "avs_postal_match"=>nil,
55
+ "avs_result"=>nil,
56
+ "avs_street_match"=>nil,
57
+ "brand"=>"MasterCard",
58
+ "created_at"=>"2014-01-27T22:56:37.869483Z",
59
+ "cvv"=>nil,
60
+ "cvv_match"=>nil,
61
+ "cvv_result"=>nil,
62
+ "expiration_month"=>12,
63
+ "expiration_year"=>2020,
64
+ "fingerprint"=>
65
+ "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
66
+ "href"=>"/cards/CC2abDOQVm5aNFhHpcRvWS02",
67
+ "id"=>"CC2abDOQVm5aNFhHpcRvWS02",
68
+ "is_verified"=>true,
69
+ "links"=>{"customer"=>"CU1f8Ygc4t0F2FKNcw235x9I"},
70
+ "meta"=>{},
71
+ "name"=>nil,
72
+ "number"=>"xxxxxxxxxxxx5100",
73
+ "updated_at"=>"2014-01-27T22:56:39.354525Z"},
74
+ @hyperlinks=
75
+ {"card_holds"=>
76
+ #<Proc:0x007fdc9c281718/lib/balanced/utils.rb:6 (lambda)>,
77
+ "customer"=>
78
+ #<Proc:0x007fdc9c28bce0/lib/balanced/resources/resource.rb:60 (lambda)>,
79
+ "debits"=>
80
+ #<Proc:0x007fdc9c289e90/lib/balanced/utils.rb:6 (lambda)>}>]
7
81
 
8
- cards = Balanced::Marketplace.my_marketplace.cards
9
82
  % endif
@@ -1 +1 @@
1
- Balanced::Card.find()
1
+ Balanced::Card.fetch
@@ -1,2 +1,2 @@
1
1
  <%= boiler_plate %>
2
- card = Balanced::Card.find('<%= request['uri'] %>')
2
+ card = Balanced::Card.fetch('<%= request['uri'] %>')
@@ -1,9 +1,47 @@
1
1
  % if mode == 'definition':
2
- Balanced::Card.find()
2
+ Balanced::Card.fetch
3
3
 
4
- % else:
4
+ % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
+
8
+ card = Balanced::Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI')
9
+ % elif mode == 'response':
10
+ #<Balanced::Card:0x007fdc9c2cab48
11
+ @attributes=
12
+ {"address"=>
13
+ {"city"=>nil,
14
+ "country_code"=>nil,
15
+ "line1"=>nil,
16
+ "line2"=>nil,
17
+ "postal_code"=>nil,
18
+ "state"=>nil},
19
+ "avs_postal_match"=>nil,
20
+ "avs_result"=>nil,
21
+ "avs_street_match"=>nil,
22
+ "brand"=>"MasterCard",
23
+ "created_at"=>"2014-01-27T22:56:55.656375Z",
24
+ "cvv"=>nil,
25
+ "cvv_match"=>nil,
26
+ "cvv_result"=>nil,
27
+ "expiration_month"=>12,
28
+ "expiration_year"=>2020,
29
+ "fingerprint"=>
30
+ "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
31
+ "href"=>"/cards/CC2uc8iPDjgyxOXHVtnZloyI",
32
+ "id"=>"CC2uc8iPDjgyxOXHVtnZloyI",
33
+ "is_verified"=>true,
34
+ "links"=>{"customer"=>nil},
35
+ "meta"=>{},
36
+ "name"=>nil,
37
+ "number"=>"xxxxxxxxxxxx5100",
38
+ "updated_at"=>"2014-01-27T22:56:55.656379Z"},
39
+ @hyperlinks=
40
+ {"card_holds"=>
41
+ #<Proc:0x007fdc9c2c8668/lib/balanced/utils.rb:6 (lambda)>,
42
+ "customer"=>
43
+ #<Proc:0x007fdc9c2d3c20/lib/balanced/utils.rb:6 (lambda)>,
44
+ "debits"=>
45
+ #<Proc:0x007fdc9c2d1da8/lib/balanced/utils.rb:6 (lambda)>}>
7
46
 
8
- card = Balanced::Card.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/cards/CC5ZP031cwTSKE3pSIHNNMRi')
9
47
  % endif
@@ -1 +1 @@
1
- Balanced::Card.save()
1
+ Balanced::Card.save
@@ -1,5 +1,5 @@
1
1
  <%= boiler_plate %>
2
- card = Balanced::Card.find('<%= request['uri'] %>')
2
+ card = Balanced::Card.fetch('<%= request['uri'] %>')
3
3
  card.meta = {
4
4
  <%= params_to_hash_for_args.call(payload['meta'])%>
5
5
  }
@@ -1,11 +1,11 @@
1
1
  % if mode == 'definition':
2
- Balanced::Card.save()
2
+ Balanced::Card.save
3
3
 
4
- % else:
4
+ % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
7
 
8
- card = Balanced::Card.find('/v1/marketplaces/TEST-MP4h8BxozeLxe7VAllP6b5gj/cards/CC5ZP031cwTSKE3pSIHNNMRi')
8
+ card = Balanced::Card.fetch('/cards/CC2uc8iPDjgyxOXHVtnZloyI')
9
9
  card.meta = {
10
10
  'facebook.user_id' => '0192837465',
11
11
  'my-own-customer-id' => '12345',
@@ -13,4 +13,45 @@ card.meta = {
13
13
  }
14
14
  card.save
15
15
 
16
+ % elif mode == 'response':
17
+ #<Balanced::Card:0x007fdc9c2f0438
18
+ @attributes=
19
+ {"address"=>
20
+ {"city"=>nil,
21
+ "country_code"=>nil,
22
+ "line1"=>nil,
23
+ "line2"=>nil,
24
+ "postal_code"=>nil,
25
+ "state"=>nil},
26
+ "avs_postal_match"=>nil,
27
+ "avs_result"=>nil,
28
+ "avs_street_match"=>nil,
29
+ "brand"=>"MasterCard",
30
+ "created_at"=>"2014-01-27T22:56:55.656375Z",
31
+ "cvv"=>nil,
32
+ "cvv_match"=>nil,
33
+ "cvv_result"=>nil,
34
+ "expiration_month"=>12,
35
+ "expiration_year"=>2020,
36
+ "fingerprint"=>
37
+ "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
38
+ "href"=>"/cards/CC2uc8iPDjgyxOXHVtnZloyI",
39
+ "id"=>"CC2uc8iPDjgyxOXHVtnZloyI",
40
+ "is_verified"=>true,
41
+ "links"=>{"customer"=>nil},
42
+ "meta"=>
43
+ {"facebook.user_id"=>"0192837465",
44
+ "my-own-customer-id"=>"12345",
45
+ "twitter.id"=>"1234987650"},
46
+ "name"=>nil,
47
+ "number"=>"xxxxxxxxxxxx5100",
48
+ "updated_at"=>"2014-01-27T22:57:02.195769Z"},
49
+ @hyperlinks=
50
+ {"card_holds"=>
51
+ #<Proc:0x007fdc9c2f9e70/lib/balanced/utils.rb:6 (lambda)>,
52
+ "customer"=>
53
+ #<Proc:0x007fdc9c2f9498/lib/balanced/utils.rb:6 (lambda)>,
54
+ "debits"=>
55
+ #<Proc:0x007fdc9c3035b0/lib/balanced/utils.rb:6 (lambda)>}>
56
+
16
57
  % endif
@@ -1,4 +1,2 @@
1
1
  <%= boiler_plate %>
2
- marketplace = Balanced::Marketplace.my_marketplace
3
-
4
- Balanced::Credit.all(:limit => 2)
2
+ credits = Balanced::Credit.all
@@ -1,11 +1,41 @@
1
1
  % if mode == 'definition':
2
2
  Balanced::Credit.all
3
3
 
4
- % else:
4
+ % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
7
 
8
- marketplace = Balanced::Marketplace.my_marketplace
8
+ credits = Balanced::Credit.all
9
+ % elif mode == 'response':
10
+ [#<Balanced::Credit:0x007fdc9c32bcb8
11
+ @attributes=
12
+ {"amount"=>5000,
13
+ "appears_on_statement_as"=>"example.com",
14
+ "created_at"=>"2014-01-27T22:57:19.073817Z",
15
+ "currency"=>"USD",
16
+ "description"=>nil,
17
+ "failure_reason"=>nil,
18
+ "failure_reason_code"=>nil,
19
+ "href"=>"/credits/CR2UtQgq6L3FPd1YoOc8eyOC",
20
+ "id"=>"CR2UtQgq6L3FPd1YoOc8eyOC",
21
+ "links"=>
22
+ {"customer"=>"CU2N5goX8AQJE0CCPeapHUsM",
23
+ "destination"=>"BA2QAksIxlLt60lqKc1wwgJy",
24
+ "order"=>nil},
25
+ "meta"=>{},
26
+ "status"=>"succeeded",
27
+ "transaction_number"=>"CR408-633-3169",
28
+ "updated_at"=>"2014-01-27T22:57:20.208794Z"},
29
+ @hyperlinks=
30
+ {"customer"=>
31
+ #<Proc:0x007fdc9c329eb8/lib/balanced/resources/resource.rb:60 (lambda)>,
32
+ "destination"=>
33
+ #<Proc:0x007fdc9c328540/lib/balanced/resources/resource.rb:60 (lambda)>,
34
+ "events"=>
35
+ #<Proc:0x007fdc9c332658/lib/balanced/utils.rb:6 (lambda)>,
36
+ "order"=>
37
+ #<Proc:0x007fdc9c331c58/lib/balanced/utils.rb:6 (lambda)>,
38
+ "reversals"=>
39
+ #<Proc:0x007fdc9c33bd70/lib/balanced/utils.rb:6 (lambda)>}>]
9
40
 
10
- Balanced::Credit.all(:limit => 2)
11
41
  % endif
@@ -0,0 +1,3 @@
1
+ <%= boiler_plate %>
2
+ bank_account = Balanced::BankAccount.fetch('<%= request['bank_account_href'] %>')
3
+ credits = bank_account.credits
@@ -0,0 +1,13 @@
1
+ % if mode == 'definition':
2
+ Balanced::BankAccount.credits
3
+
4
+ % elif mode == 'request':
5
+ require 'balanced'
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
+
8
+ bank_account = Balanced::BankAccount.fetch('/bank_accounts/BA1QFf0LmIxr8p41msqX46Oy')
9
+ credits = bank_account.credits
10
+ % elif mode == 'response':
11
+ {}
12
+
13
+ % endif
@@ -1 +1 @@
1
- Balanced::Credit.find
1
+ Balanced::Credit.fetch
@@ -1,4 +1,2 @@
1
1
  <%= boiler_plate %>
2
- marketplace = Balanced::Marketplace.my_marketplace
3
-
4
- credit = Balanced::Credit.find('<%= request["uri"] %>')
2
+ credit = Balanced::Credit.fetch('<%= request["uri"] %>')
@@ -1,11 +1,41 @@
1
1
  % if mode == 'definition':
2
- Balanced::Credit.find
2
+ Balanced::Credit.fetch
3
3
 
4
- % else:
4
+ % elif mode == 'request':
5
5
  require 'balanced'
6
- Balanced.configure('8c3aeeb80e9e11e38901026ba7f8ec28')
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
7
 
8
- marketplace = Balanced::Marketplace.my_marketplace
8
+ credit = Balanced::Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC')
9
+ % elif mode == 'response':
10
+ #<Balanced::Credit:0x007fdc9e80f7f0
11
+ @attributes=
12
+ {"amount"=>5000,
13
+ "appears_on_statement_as"=>"example.com",
14
+ "created_at"=>"2014-01-27T22:57:19.073817Z",
15
+ "currency"=>"USD",
16
+ "description"=>nil,
17
+ "failure_reason"=>nil,
18
+ "failure_reason_code"=>nil,
19
+ "href"=>"/credits/CR2UtQgq6L3FPd1YoOc8eyOC",
20
+ "id"=>"CR2UtQgq6L3FPd1YoOc8eyOC",
21
+ "links"=>
22
+ {"customer"=>"CU2N5goX8AQJE0CCPeapHUsM",
23
+ "destination"=>"BA2QAksIxlLt60lqKc1wwgJy",
24
+ "order"=>nil},
25
+ "meta"=>{},
26
+ "status"=>"succeeded",
27
+ "transaction_number"=>"CR408-633-3169",
28
+ "updated_at"=>"2014-01-27T22:57:20.208794Z"},
29
+ @hyperlinks=
30
+ {"customer"=>
31
+ #<Proc:0x007fdc9e80d9f0/lib/balanced/resources/resource.rb:60 (lambda)>,
32
+ "destination"=>
33
+ #<Proc:0x007fdc9e80c078/lib/balanced/resources/resource.rb:60 (lambda)>,
34
+ "events"=>
35
+ #<Proc:0x007fdc9e816190/lib/balanced/utils.rb:6 (lambda)>,
36
+ "order"=>
37
+ #<Proc:0x007fdc9e815790/lib/balanced/utils.rb:6 (lambda)>,
38
+ "reversals"=>
39
+ #<Proc:0x007fdc9e81f8a8/lib/balanced/utils.rb:6 (lambda)>}>
9
40
 
10
- credit = Balanced::Credit.find('/v1/credits/CR6lEmXFHCW9aNOoLQk9XjfG')
11
41
  % endif
@@ -0,0 +1,7 @@
1
+ <%= boiler_plate %>
2
+ credit = Balanced::Credit.fetch('<%= request['uri'] %>')
3
+ credit.description = '<%= payload['description'] %>'
4
+ credit.meta = {
5
+ <%= params_to_hash_for_args.call(payload['meta']).indent(2) %>
6
+ }
7
+ credit.save
@@ -0,0 +1,48 @@
1
+ % if mode == 'definition':
2
+ Balanced::Credit.save
3
+
4
+ % elif mode == 'request':
5
+ require 'balanced'
6
+ Balanced.configure('ak-test-1kvvievk0Qqw5wQPsrlM9g7wQwNe62cyc')
7
+
8
+ credit = Balanced::Credit.fetch('/credits/CR2UtQgq6L3FPd1YoOc8eyOC')
9
+ credit.description = 'New description for credit'
10
+ credit.meta = {
11
+ 'anykey' => 'valuegoeshere',
12
+ 'facebook.id' => '1234567890'
13
+ }
14
+ credit.save
15
+
16
+ % elif mode == 'response':
17
+ #<Balanced::Credit:0x007fdc9e835310
18
+ @attributes=
19
+ {"amount"=>5000,
20
+ "appears_on_statement_as"=>"example.com",
21
+ "created_at"=>"2014-01-27T22:57:19.073817Z",
22
+ "currency"=>"USD",
23
+ "description"=>"New description for credit",
24
+ "failure_reason"=>nil,
25
+ "failure_reason_code"=>nil,
26
+ "href"=>"/credits/CR2UtQgq6L3FPd1YoOc8eyOC",
27
+ "id"=>"CR2UtQgq6L3FPd1YoOc8eyOC",
28
+ "links"=>
29
+ {"customer"=>"CU2N5goX8AQJE0CCPeapHUsM",
30
+ "destination"=>"BA2QAksIxlLt60lqKc1wwgJy",
31
+ "order"=>nil},
32
+ "meta"=>{"anykey"=>"valuegoeshere", "facebook.id"=>"1234567890"},
33
+ "status"=>"succeeded",
34
+ "transaction_number"=>"CR408-633-3169",
35
+ "updated_at"=>"2014-01-27T22:57:25.832930Z"},
36
+ @hyperlinks=
37
+ {"customer"=>
38
+ #<Proc:0x007fdc9e83f450/lib/balanced/resources/resource.rb:60 (lambda)>,
39
+ "destination"=>
40
+ #<Proc:0x007fdc9e83dad8/lib/balanced/resources/resource.rb:60 (lambda)>,
41
+ "events"=>
42
+ #<Proc:0x007fdc9e83c890/lib/balanced/utils.rb:6 (lambda)>,
43
+ "order"=>
44
+ #<Proc:0x007fdc9e83ea78/lib/balanced/utils.rb:6 (lambda)>,
45
+ "reversals"=>
46
+ #<Proc:0x007fdc9e83d880/lib/balanced/utils.rb:6 (lambda)>}>
47
+
48
+ % endif