mt-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +188 -0
  4. data/bin/console +15 -0
  5. data/lib/modern_treasury/api_helper.rb +10 -0
  6. data/lib/modern_treasury/client.rb +275 -0
  7. data/lib/modern_treasury/configuration.rb +206 -0
  8. data/lib/modern_treasury/controllers/account_collection_flow_controller.rb +130 -0
  9. data/lib/modern_treasury/controllers/account_detail_controller.rb +131 -0
  10. data/lib/modern_treasury/controllers/balance_report_controller.rb +76 -0
  11. data/lib/modern_treasury/controllers/base_controller.rb +60 -0
  12. data/lib/modern_treasury/controllers/connection_controller.rb +40 -0
  13. data/lib/modern_treasury/controllers/counterparty_controller.rb +188 -0
  14. data/lib/modern_treasury/controllers/document_controller.rb +285 -0
  15. data/lib/modern_treasury/controllers/event_controller.rb +72 -0
  16. data/lib/modern_treasury/controllers/expected_payment_controller.rb +162 -0
  17. data/lib/modern_treasury/controllers/external_account_controller.rb +202 -0
  18. data/lib/modern_treasury/controllers/incoming_payment_detail_controller.rb +150 -0
  19. data/lib/modern_treasury/controllers/internal_account_controller.rb +134 -0
  20. data/lib/modern_treasury/controllers/invoice_controller.rb +98 -0
  21. data/lib/modern_treasury/controllers/invoice_line_item_controller.rb +136 -0
  22. data/lib/modern_treasury/controllers/ledger_account_category_controller.rb +292 -0
  23. data/lib/modern_treasury/controllers/ledger_account_controller.rb +202 -0
  24. data/lib/modern_treasury/controllers/ledger_account_payout_controller.rb +126 -0
  25. data/lib/modern_treasury/controllers/ledger_account_statement_controller.rb +60 -0
  26. data/lib/modern_treasury/controllers/ledger_controller.rb +152 -0
  27. data/lib/modern_treasury/controllers/ledger_entry_controller.rb +148 -0
  28. data/lib/modern_treasury/controllers/ledger_event_handler_controller.rb +119 -0
  29. data/lib/modern_treasury/controllers/ledger_transaction_controller.rb +328 -0
  30. data/lib/modern_treasury/controllers/ledgerable_event_controller.rb +61 -0
  31. data/lib/modern_treasury/controllers/line_item_controller.rb +107 -0
  32. data/lib/modern_treasury/controllers/paper_item_controller.rb +69 -0
  33. data/lib/modern_treasury/controllers/payment_flow_controller.rb +138 -0
  34. data/lib/modern_treasury/controllers/payment_order_controller.rb +368 -0
  35. data/lib/modern_treasury/controllers/payment_reference_controller.rb +64 -0
  36. data/lib/modern_treasury/controllers/ping_controller.rb +34 -0
  37. data/lib/modern_treasury/controllers/return_controller.rb +105 -0
  38. data/lib/modern_treasury/controllers/reversal_controller.rb +99 -0
  39. data/lib/modern_treasury/controllers/routing_detail_controller.rb +131 -0
  40. data/lib/modern_treasury/controllers/transaction_controller.rb +133 -0
  41. data/lib/modern_treasury/controllers/transaction_line_item_controller.rb +39 -0
  42. data/lib/modern_treasury/controllers/validation_controller.rb +41 -0
  43. data/lib/modern_treasury/controllers/virtual_account_controller.rb +142 -0
  44. data/lib/modern_treasury/exceptions/api_exception.rb +21 -0
  45. data/lib/modern_treasury/exceptions/error_message_exception.rb +46 -0
  46. data/lib/modern_treasury/http/auth/basic_auth.rb +62 -0
  47. data/lib/modern_treasury/http/http_call_back.rb +10 -0
  48. data/lib/modern_treasury/http/http_method_enum.rb +10 -0
  49. data/lib/modern_treasury/http/http_request.rb +10 -0
  50. data/lib/modern_treasury/http/http_response.rb +10 -0
  51. data/lib/modern_treasury/http/proxy_settings.rb +22 -0
  52. data/lib/modern_treasury/models/account.rb +304 -0
  53. data/lib/modern_treasury/models/account1.rb +217 -0
  54. data/lib/modern_treasury/models/account_collection_flow.rb +178 -0
  55. data/lib/modern_treasury/models/account_collection_flow_create_request.rb +70 -0
  56. data/lib/modern_treasury/models/account_collection_flow_update_request.rb +61 -0
  57. data/lib/modern_treasury/models/account_detail.rb +211 -0
  58. data/lib/modern_treasury/models/account_detail1.rb +74 -0
  59. data/lib/modern_treasury/models/account_detail_create_request.rb +75 -0
  60. data/lib/modern_treasury/models/account_number_type2_enum.rb +48 -0
  61. data/lib/modern_treasury/models/account_number_type_enum.rb +49 -0
  62. data/lib/modern_treasury/models/account_type5_enum.rb +56 -0
  63. data/lib/modern_treasury/models/account_type_enum.rb +56 -0
  64. data/lib/modern_treasury/models/accounting.rb +88 -0
  65. data/lib/modern_treasury/models/accounting1.rb +63 -0
  66. data/lib/modern_treasury/models/accounts_type1_enum.rb +26 -0
  67. data/lib/modern_treasury/models/accounts_type_enum.rb +36 -0
  68. data/lib/modern_treasury/models/address.rb +231 -0
  69. data/lib/modern_treasury/models/address_request.rb +118 -0
  70. data/lib/modern_treasury/models/async_response.rb +68 -0
  71. data/lib/modern_treasury/models/balance.rb +164 -0
  72. data/lib/modern_treasury/models/balance_report.rb +178 -0
  73. data/lib/modern_treasury/models/balance_report_type1_enum.rb +44 -0
  74. data/lib/modern_treasury/models/balance_report_type_enum.rb +45 -0
  75. data/lib/modern_treasury/models/balance_type_enum.rb +63 -0
  76. data/lib/modern_treasury/models/balances.rb +71 -0
  77. data/lib/modern_treasury/models/balances1.rb +81 -0
  78. data/lib/modern_treasury/models/balances2.rb +120 -0
  79. data/lib/modern_treasury/models/balances3.rb +130 -0
  80. data/lib/modern_treasury/models/base_model.rb +110 -0
  81. data/lib/modern_treasury/models/charge_bearer_enum.rb +42 -0
  82. data/lib/modern_treasury/models/code1_enum.rb +200 -0
  83. data/lib/modern_treasury/models/code_enum.rb +68 -0
  84. data/lib/modern_treasury/models/connection.rb +209 -0
  85. data/lib/modern_treasury/models/contact_detail.rb +200 -0
  86. data/lib/modern_treasury/models/contact_detail_create_request.rb +75 -0
  87. data/lib/modern_treasury/models/contact_identifier_type_enum.rb +40 -0
  88. data/lib/modern_treasury/models/content_type_enum.rb +36 -0
  89. data/lib/modern_treasury/models/counterparty.rb +200 -0
  90. data/lib/modern_treasury/models/counterparty_billing_address.rb +106 -0
  91. data/lib/modern_treasury/models/counterparty_collect_account_request.rb +104 -0
  92. data/lib/modern_treasury/models/counterparty_collect_account_response.rb +82 -0
  93. data/lib/modern_treasury/models/counterparty_create_request.rb +161 -0
  94. data/lib/modern_treasury/models/counterparty_shipping_address.rb +107 -0
  95. data/lib/modern_treasury/models/counterparty_update_request.rb +107 -0
  96. data/lib/modern_treasury/models/created_at_enum.rb +36 -0
  97. data/lib/modern_treasury/models/currency1_enum.rb +37 -0
  98. data/lib/modern_treasury/models/currency_enum.rb +784 -0
  99. data/lib/modern_treasury/models/direction10_enum.rb +38 -0
  100. data/lib/modern_treasury/models/direction14_enum.rb +36 -0
  101. data/lib/modern_treasury/models/direction15_enum.rb +36 -0
  102. data/lib/modern_treasury/models/direction1_enum.rb +37 -0
  103. data/lib/modern_treasury/models/direction4_enum.rb +36 -0
  104. data/lib/modern_treasury/models/direction5_enum.rb +39 -0
  105. data/lib/modern_treasury/models/direction9_enum.rb +37 -0
  106. data/lib/modern_treasury/models/direction_enum.rb +38 -0
  107. data/lib/modern_treasury/models/document.rb +207 -0
  108. data/lib/modern_treasury/models/document_create_request.rb +92 -0
  109. data/lib/modern_treasury/models/document_detail.rb +154 -0
  110. data/lib/modern_treasury/models/documentable_type1_enum.rb +72 -0
  111. data/lib/modern_treasury/models/documentable_type2_enum.rb +72 -0
  112. data/lib/modern_treasury/models/documentable_type_enum.rb +75 -0
  113. data/lib/modern_treasury/models/effective_at_enum.rb +36 -0
  114. data/lib/modern_treasury/models/errors.rb +81 -0
  115. data/lib/modern_treasury/models/event.rb +162 -0
  116. data/lib/modern_treasury/models/expected_payment.rb +343 -0
  117. data/lib/modern_treasury/models/expected_payment_create_request.rb +254 -0
  118. data/lib/modern_treasury/models/expected_payment_update_request.rb +239 -0
  119. data/lib/modern_treasury/models/external_account.rb +283 -0
  120. data/lib/modern_treasury/models/external_account_complete_verification_request.rb +62 -0
  121. data/lib/modern_treasury/models/external_account_create_request.rb +230 -0
  122. data/lib/modern_treasury/models/external_account_update_request.rb +132 -0
  123. data/lib/modern_treasury/models/external_account_verify_request.rb +83 -0
  124. data/lib/modern_treasury/models/fallback_type_enum.rb +28 -0
  125. data/lib/modern_treasury/models/field_enum.rb +112 -0
  126. data/lib/modern_treasury/models/file.rb +81 -0
  127. data/lib/modern_treasury/models/foreign_exchange_indicator_enum.rb +38 -0
  128. data/lib/modern_treasury/models/incoming_payment_detail.rb +348 -0
  129. data/lib/modern_treasury/models/incoming_payment_detail_create_request.rb +141 -0
  130. data/lib/modern_treasury/models/incoming_payment_detail_update_request.rb +63 -0
  131. data/lib/modern_treasury/models/internal_account.rb +361 -0
  132. data/lib/modern_treasury/models/internal_account_create_request.rb +135 -0
  133. data/lib/modern_treasury/models/internal_account_update_request.rb +95 -0
  134. data/lib/modern_treasury/models/invoice.rb +342 -0
  135. data/lib/modern_treasury/models/invoice_create_request.rb +235 -0
  136. data/lib/modern_treasury/models/invoice_line_item.rb +171 -0
  137. data/lib/modern_treasury/models/invoice_line_item_create_request.rb +104 -0
  138. data/lib/modern_treasury/models/invoice_line_item_update_request.rb +240 -0
  139. data/lib/modern_treasury/models/invoice_update_request.rb +251 -0
  140. data/lib/modern_treasury/models/invoicer_address.rb +106 -0
  141. data/lib/modern_treasury/models/itemizable_type1_enum.rb +36 -0
  142. data/lib/modern_treasury/models/itemizable_type_enum.rb +36 -0
  143. data/lib/modern_treasury/models/ledger.rb +158 -0
  144. data/lib/modern_treasury/models/ledger_account.rb +220 -0
  145. data/lib/modern_treasury/models/ledger_account_category.rb +187 -0
  146. data/lib/modern_treasury/models/ledger_account_category_create_request.rb +125 -0
  147. data/lib/modern_treasury/models/ledger_account_category_update_request.rb +84 -0
  148. data/lib/modern_treasury/models/ledger_account_create_request.rb +150 -0
  149. data/lib/modern_treasury/models/ledger_account_normal_balance_enum.rb +36 -0
  150. data/lib/modern_treasury/models/ledger_account_payout.rb +238 -0
  151. data/lib/modern_treasury/models/ledger_account_payout_create_request.rb +152 -0
  152. data/lib/modern_treasury/models/ledger_account_payout_update_request.rb +85 -0
  153. data/lib/modern_treasury/models/ledger_account_statement.rb +233 -0
  154. data/lib/modern_treasury/models/ledger_account_statement_create_request.rb +122 -0
  155. data/lib/modern_treasury/models/ledger_account_update_request.rb +84 -0
  156. data/lib/modern_treasury/models/ledger_balance.rb +97 -0
  157. data/lib/modern_treasury/models/ledger_balances.rb +81 -0
  158. data/lib/modern_treasury/models/ledger_balances_with_effective_at.rb +123 -0
  159. data/lib/modern_treasury/models/ledger_create_request.rb +83 -0
  160. data/lib/modern_treasury/models/ledger_entry.rb +247 -0
  161. data/lib/modern_treasury/models/ledger_entry_create_request.rb +177 -0
  162. data/lib/modern_treasury/models/ledger_entry_of_transaction_version.rb +214 -0
  163. data/lib/modern_treasury/models/ledger_event_handler.rb +182 -0
  164. data/lib/modern_treasury/models/ledger_event_handler_conditions.rb +78 -0
  165. data/lib/modern_treasury/models/ledger_event_handler_create_request.rb +119 -0
  166. data/lib/modern_treasury/models/ledger_event_handler_ledger_entries.rb +80 -0
  167. data/lib/modern_treasury/models/ledger_event_handler_ledger_transaction_template.rb +103 -0
  168. data/lib/modern_treasury/models/ledger_transaction.rb +259 -0
  169. data/lib/modern_treasury/models/ledger_transaction_create_request.rb +164 -0
  170. data/lib/modern_treasury/models/ledger_transaction_reversal_create_request.rb +142 -0
  171. data/lib/modern_treasury/models/ledger_transaction_update_request.rb +115 -0
  172. data/lib/modern_treasury/models/ledger_transaction_version.rb +254 -0
  173. data/lib/modern_treasury/models/ledger_type_enum.rb +37 -0
  174. data/lib/modern_treasury/models/ledger_update_request.rb +84 -0
  175. data/lib/modern_treasury/models/ledgerable_event.rb +206 -0
  176. data/lib/modern_treasury/models/ledgerable_event_create_request.rb +140 -0
  177. data/lib/modern_treasury/models/ledgerable_type2_enum.rb +71 -0
  178. data/lib/modern_treasury/models/ledgerable_type5_enum.rb +69 -0
  179. data/lib/modern_treasury/models/ledgerable_type6_enum.rb +68 -0
  180. data/lib/modern_treasury/models/ledgerable_type_enum.rb +38 -0
  181. data/lib/modern_treasury/models/legacy_document_create_request.rb +70 -0
  182. data/lib/modern_treasury/models/line_item.rb +200 -0
  183. data/lib/modern_treasury/models/line_item_request.rb +98 -0
  184. data/lib/modern_treasury/models/line_item_update_request.rb +63 -0
  185. data/lib/modern_treasury/models/mreturn.rb +425 -0
  186. data/lib/modern_treasury/models/normal_balance2_enum.rb +36 -0
  187. data/lib/modern_treasury/models/normal_balance_enum.rb +36 -0
  188. data/lib/modern_treasury/models/order_by.rb +72 -0
  189. data/lib/modern_treasury/models/originating_account_number_type_enum.rb +48 -0
  190. data/lib/modern_treasury/models/originating_routing_number_type_enum.rb +68 -0
  191. data/lib/modern_treasury/models/paper_item.rb +249 -0
  192. data/lib/modern_treasury/models/party_address.rb +106 -0
  193. data/lib/modern_treasury/models/party_type5_enum.rb +36 -0
  194. data/lib/modern_treasury/models/party_type_enum.rb +36 -0
  195. data/lib/modern_treasury/models/payment_direction_enum.rb +36 -0
  196. data/lib/modern_treasury/models/payment_flow.rb +230 -0
  197. data/lib/modern_treasury/models/payment_flow_create_request.rb +103 -0
  198. data/lib/modern_treasury/models/payment_flow_update_request.rb +61 -0
  199. data/lib/modern_treasury/models/payment_method1_enum.rb +46 -0
  200. data/lib/modern_treasury/models/payment_method_enum.rb +42 -0
  201. data/lib/modern_treasury/models/payment_order.rb +820 -0
  202. data/lib/modern_treasury/models/payment_order_async_create_request.rb +536 -0
  203. data/lib/modern_treasury/models/payment_order_create_request.rb +556 -0
  204. data/lib/modern_treasury/models/payment_order_update_request.rb +543 -0
  205. data/lib/modern_treasury/models/payment_reference.rb +175 -0
  206. data/lib/modern_treasury/models/payment_reference_object.rb +156 -0
  207. data/lib/modern_treasury/models/payment_type13_enum.rb +96 -0
  208. data/lib/modern_treasury/models/payment_type1_enum.rb +97 -0
  209. data/lib/modern_treasury/models/payment_type2_enum.rb +96 -0
  210. data/lib/modern_treasury/models/payment_type4_enum.rb +96 -0
  211. data/lib/modern_treasury/models/payment_type5_enum.rb +36 -0
  212. data/lib/modern_treasury/models/payment_type6_enum.rb +97 -0
  213. data/lib/modern_treasury/models/payment_type_enum.rb +37 -0
  214. data/lib/modern_treasury/models/ping_response.rb +60 -0
  215. data/lib/modern_treasury/models/priority4_enum.rb +36 -0
  216. data/lib/modern_treasury/models/priority_enum.rb +38 -0
  217. data/lib/modern_treasury/models/reason1_enum.rb +50 -0
  218. data/lib/modern_treasury/models/reason_enum.rb +48 -0
  219. data/lib/modern_treasury/models/receiving_account.rb +304 -0
  220. data/lib/modern_treasury/models/receiving_account1.rb +219 -0
  221. data/lib/modern_treasury/models/receiving_account_type_enum.rb +36 -0
  222. data/lib/modern_treasury/models/reconciliation_method_enum.rb +38 -0
  223. data/lib/modern_treasury/models/reference_number_type1_enum.rb +248 -0
  224. data/lib/modern_treasury/models/reference_number_type_enum.rb +248 -0
  225. data/lib/modern_treasury/models/referenceable_type1_enum.rb +40 -0
  226. data/lib/modern_treasury/models/referenceable_type_enum.rb +41 -0
  227. data/lib/modern_treasury/models/return_create_request.rb +119 -0
  228. data/lib/modern_treasury/models/returnable_type1_enum.rb +48 -0
  229. data/lib/modern_treasury/models/returnable_type_enum.rb +48 -0
  230. data/lib/modern_treasury/models/reversal.rb +151 -0
  231. data/lib/modern_treasury/models/reversal_create_request.rb +86 -0
  232. data/lib/modern_treasury/models/role_enum.rb +36 -0
  233. data/lib/modern_treasury/models/routing_detail.rb +242 -0
  234. data/lib/modern_treasury/models/routing_detail1.rb +83 -0
  235. data/lib/modern_treasury/models/routing_detail_create_request.rb +87 -0
  236. data/lib/modern_treasury/models/routing_number_lookup_request.rb +124 -0
  237. data/lib/modern_treasury/models/routing_number_type1_enum.rb +68 -0
  238. data/lib/modern_treasury/models/routing_number_type7_enum.rb +55 -0
  239. data/lib/modern_treasury/models/routing_number_type8_enum.rb +68 -0
  240. data/lib/modern_treasury/models/routing_number_type_enum.rb +69 -0
  241. data/lib/modern_treasury/models/status11_enum.rb +40 -0
  242. data/lib/modern_treasury/models/status12_enum.rb +40 -0
  243. data/lib/modern_treasury/models/status15_enum.rb +41 -0
  244. data/lib/modern_treasury/models/status16_enum.rb +41 -0
  245. data/lib/modern_treasury/models/status17_enum.rb +45 -0
  246. data/lib/modern_treasury/models/status18_enum.rb +74 -0
  247. data/lib/modern_treasury/models/status19_enum.rb +52 -0
  248. data/lib/modern_treasury/models/status1_enum.rb +40 -0
  249. data/lib/modern_treasury/models/status20_enum.rb +40 -0
  250. data/lib/modern_treasury/models/status21_enum.rb +40 -0
  251. data/lib/modern_treasury/models/status22_enum.rb +40 -0
  252. data/lib/modern_treasury/models/status24_enum.rb +72 -0
  253. data/lib/modern_treasury/models/status2_enum.rb +41 -0
  254. data/lib/modern_treasury/models/status3_enum.rb +72 -0
  255. data/lib/modern_treasury/models/status4_enum.rb +52 -0
  256. data/lib/modern_treasury/models/status5_enum.rb +48 -0
  257. data/lib/modern_treasury/models/status6_enum.rb +49 -0
  258. data/lib/modern_treasury/models/status7_enum.rb +37 -0
  259. data/lib/modern_treasury/models/status8_enum.rb +37 -0
  260. data/lib/modern_treasury/models/status9_enum.rb +41 -0
  261. data/lib/modern_treasury/models/status_enum.rb +45 -0
  262. data/lib/modern_treasury/models/subtype_enum.rb +71 -0
  263. data/lib/modern_treasury/models/supported_payment_type_enum.rb +96 -0
  264. data/lib/modern_treasury/models/transactable_type_enum.rb +53 -0
  265. data/lib/modern_treasury/models/transaction.rb +311 -0
  266. data/lib/modern_treasury/models/transaction_line_item.rb +211 -0
  267. data/lib/modern_treasury/models/type10_enum.rb +64 -0
  268. data/lib/modern_treasury/models/type11_enum.rb +97 -0
  269. data/lib/modern_treasury/models/type12_enum.rb +37 -0
  270. data/lib/modern_treasury/models/type13_enum.rb +96 -0
  271. data/lib/modern_treasury/models/type14_enum.rb +64 -0
  272. data/lib/modern_treasury/models/type16_enum.rb +36 -0
  273. data/lib/modern_treasury/models/type1_enum.rb +97 -0
  274. data/lib/modern_treasury/models/type4_enum.rb +65 -0
  275. data/lib/modern_treasury/models/type5_enum.rb +97 -0
  276. data/lib/modern_treasury/models/type6_enum.rb +77 -0
  277. data/lib/modern_treasury/models/type_enum.rb +37 -0
  278. data/lib/modern_treasury/models/vendor_code_type1_enum.rb +111 -0
  279. data/lib/modern_treasury/models/vendor_code_type_enum.rb +108 -0
  280. data/lib/modern_treasury/models/verification_status1_enum.rb +44 -0
  281. data/lib/modern_treasury/models/verification_status_enum.rb +40 -0
  282. data/lib/modern_treasury/models/virtual_account.rb +247 -0
  283. data/lib/modern_treasury/models/virtual_account_create_request.rb +172 -0
  284. data/lib/modern_treasury/models/virtual_account_update_request.rb +85 -0
  285. data/lib/modern_treasury/utilities/date_time_helper.rb +11 -0
  286. data/lib/modern_treasury/utilities/file_wrapper.rb +28 -0
  287. data/lib/modern_treasury/utilities/union_type_lookup.rb +32 -0
  288. data/lib/modern_treasury.rb +316 -0
  289. data/test/controllers/controller_test_base.rb +23 -0
  290. data/test/controllers/test_account_collection_flow_controller.rb +64 -0
  291. data/test/controllers/test_connection_controller.rb +41 -0
  292. data/test/controllers/test_counterparty_controller.rb +65 -0
  293. data/test/controllers/test_document_controller.rb +41 -0
  294. data/test/controllers/test_event_controller.rb +46 -0
  295. data/test/controllers/test_expected_payment_controller.rb +71 -0
  296. data/test/controllers/test_external_account_controller.rb +63 -0
  297. data/test/controllers/test_incoming_payment_detail_controller.rb +68 -0
  298. data/test/controllers/test_internal_account_controller.rb +65 -0
  299. data/test/controllers/test_invoice_controller.rb +56 -0
  300. data/test/controllers/test_ledger_account_category_controller.rb +67 -0
  301. data/test/controllers/test_ledger_account_controller.rb +70 -0
  302. data/test/controllers/test_ledger_account_payout_controller.rb +62 -0
  303. data/test/controllers/test_ledger_account_statement_controller.rb +36 -0
  304. data/test/controllers/test_ledger_controller.rb +59 -0
  305. data/test/controllers/test_ledger_entry_controller.rb +65 -0
  306. data/test/controllers/test_ledger_event_handler_controller.rb +63 -0
  307. data/test/controllers/test_ledger_transaction_controller.rb +112 -0
  308. data/test/controllers/test_ledgerable_event_controller.rb +36 -0
  309. data/test/controllers/test_paper_item_controller.rb +43 -0
  310. data/test/controllers/test_payment_flow_controller.rb +67 -0
  311. data/test/controllers/test_payment_order_controller.rb +76 -0
  312. data/test/controllers/test_payment_reference_controller.rb +43 -0
  313. data/test/controllers/test_ping_controller.rb +31 -0
  314. data/test/controllers/test_return_controller.rb +64 -0
  315. data/test/controllers/test_transaction_controller.rb +56 -0
  316. data/test/controllers/test_virtual_account_controller.rb +63 -0
  317. data/test/http_response_catcher.rb +19 -0
  318. metadata +429 -0
@@ -0,0 +1,214 @@
1
+ # modern_treasury
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module ModernTreasury
8
+ # LedgerEntryOfTransactionVersion Model.
9
+ class LedgerEntryOfTransactionVersion < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [UUID | String]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :object
20
+
21
+ # This field will be true if this object exists in the live environment or
22
+ # false if it exists in the test environment.
23
+ # @return [TrueClass | FalseClass]
24
+ attr_accessor :live_mode
25
+
26
+ # This field will be true if this object exists in the live environment or
27
+ # false if it exists in the test environment.
28
+ # @return [DateTime]
29
+ attr_accessor :created_at
30
+
31
+ # Value in specified currency's smallest unit. e.g. $10 would be represented
32
+ # as 1000. Can be any integer up to 36 digits.
33
+ # @return [Integer]
34
+ attr_accessor :amount
35
+
36
+ # One of `credit`, `debit`. Describes the direction money is flowing in the
37
+ # transaction. A `credit` moves money from your account to someone else's. A
38
+ # `debit` pulls money from someone else's account to your own. Note that
39
+ # wire, rtp, and check payments will always be `credit`.
40
+ # @return [Direction5Enum]
41
+ attr_accessor :direction
42
+
43
+ # Equal to the state of the ledger transaction when the ledger entry was
44
+ # created. One of `pending`, `posted`, or `archived`.
45
+ # @return [Status9Enum]
46
+ attr_accessor :status
47
+
48
+ # The ledger account that this ledger entry is associated with.
49
+ # @return [UUID | String]
50
+ attr_accessor :ledger_account_id
51
+
52
+ # Lock version of the ledger account. This can be passed when creating a
53
+ # ledger transaction to only succeed if no ledger transactions have posted
54
+ # since the given version. See our post about Designing the Ledgers API with
55
+ # Optimistic Locking for more details.
56
+ # @return [Integer]
57
+ attr_accessor :ledger_account_lock_version
58
+
59
+ # The currency of the ledger account.
60
+ # @return [String]
61
+ attr_accessor :ledger_account_currency
62
+
63
+ # The currency exponent of the ledger account.
64
+ # @return [Integer]
65
+ attr_accessor :ledger_account_currency_exponent
66
+
67
+ # The ledger transaction that this ledger entry is associated with.
68
+ # @return [String]
69
+ attr_accessor :ledger_transaction_id
70
+
71
+ # Additional data represented as key-value pairs. Both the key and value
72
+ # must be strings.
73
+ # @return [Hash[String, String]]
74
+ attr_accessor :metadata
75
+
76
+ # Additional data represented as key-value pairs. Both the key and value
77
+ # must be strings.
78
+ # @return [LedgerBalances]
79
+ attr_accessor :resulting_ledger_account_balances
80
+
81
+ # A mapping from model property names to API property names.
82
+ def self.names
83
+ @_hash = {} if @_hash.nil?
84
+ @_hash['id'] = 'id'
85
+ @_hash['object'] = 'object'
86
+ @_hash['live_mode'] = 'live_mode'
87
+ @_hash['created_at'] = 'created_at'
88
+ @_hash['amount'] = 'amount'
89
+ @_hash['direction'] = 'direction'
90
+ @_hash['status'] = 'status'
91
+ @_hash['ledger_account_id'] = 'ledger_account_id'
92
+ @_hash['ledger_account_lock_version'] = 'ledger_account_lock_version'
93
+ @_hash['ledger_account_currency'] = 'ledger_account_currency'
94
+ @_hash['ledger_account_currency_exponent'] =
95
+ 'ledger_account_currency_exponent'
96
+ @_hash['ledger_transaction_id'] = 'ledger_transaction_id'
97
+ @_hash['metadata'] = 'metadata'
98
+ @_hash['resulting_ledger_account_balances'] =
99
+ 'resulting_ledger_account_balances'
100
+ @_hash
101
+ end
102
+
103
+ # An array for optional fields
104
+ def self.optionals
105
+ []
106
+ end
107
+
108
+ # An array for nullable fields
109
+ def self.nullables
110
+ %w[
111
+ ledger_account_lock_version
112
+ ]
113
+ end
114
+
115
+ def initialize(id = nil, object = nil, live_mode = nil, created_at = nil,
116
+ amount = nil, direction = nil, status = nil,
117
+ ledger_account_id = nil, ledger_account_lock_version = nil,
118
+ ledger_account_currency = nil,
119
+ ledger_account_currency_exponent = nil,
120
+ ledger_transaction_id = nil, metadata = nil,
121
+ resulting_ledger_account_balances = nil)
122
+ @id = id
123
+ @object = object
124
+ @live_mode = live_mode
125
+ @created_at = created_at
126
+ @amount = amount
127
+ @direction = direction
128
+ @status = status
129
+ @ledger_account_id = ledger_account_id
130
+ @ledger_account_lock_version = ledger_account_lock_version
131
+ @ledger_account_currency = ledger_account_currency
132
+ @ledger_account_currency_exponent = ledger_account_currency_exponent
133
+ @ledger_transaction_id = ledger_transaction_id
134
+ @metadata = metadata
135
+ @resulting_ledger_account_balances = resulting_ledger_account_balances
136
+ end
137
+
138
+ # Creates an instance of the object from a hash.
139
+ def self.from_hash(hash)
140
+ return nil unless hash
141
+
142
+ # Extract variables from the hash.
143
+ id = hash.key?('id') ? hash['id'] : nil
144
+ object = hash.key?('object') ? hash['object'] : nil
145
+ live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil
146
+ created_at = if hash.key?('created_at')
147
+ (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
148
+ end
149
+ amount = hash.key?('amount') ? hash['amount'] : nil
150
+ direction = hash.key?('direction') ? hash['direction'] : nil
151
+ status = hash.key?('status') ? hash['status'] : nil
152
+ ledger_account_id =
153
+ hash.key?('ledger_account_id') ? hash['ledger_account_id'] : nil
154
+ ledger_account_lock_version =
155
+ hash.key?('ledger_account_lock_version') ? hash['ledger_account_lock_version'] : nil
156
+ ledger_account_currency =
157
+ hash.key?('ledger_account_currency') ? hash['ledger_account_currency'] : nil
158
+ ledger_account_currency_exponent =
159
+ hash.key?('ledger_account_currency_exponent') ? hash['ledger_account_currency_exponent'] : nil
160
+ ledger_transaction_id =
161
+ hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : nil
162
+ metadata = hash.key?('metadata') ? hash['metadata'] : nil
163
+ if hash['resulting_ledger_account_balances']
164
+ resulting_ledger_account_balances = LedgerBalances.from_hash(hash['resulting_ledger_account_balances'])
165
+ end
166
+
167
+ # Create object from extracted values.
168
+ LedgerEntryOfTransactionVersion.new(id,
169
+ object,
170
+ live_mode,
171
+ created_at,
172
+ amount,
173
+ direction,
174
+ status,
175
+ ledger_account_id,
176
+ ledger_account_lock_version,
177
+ ledger_account_currency,
178
+ ledger_account_currency_exponent,
179
+ ledger_transaction_id,
180
+ metadata,
181
+ resulting_ledger_account_balances)
182
+ end
183
+
184
+ def to_custom_created_at
185
+ DateTimeHelper.to_rfc3339(created_at)
186
+ end
187
+
188
+ # Provides a human-readable string representation of the object.
189
+ def to_s
190
+ class_name = self.class.name.split('::').last
191
+ "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\
192
+ " #{@created_at}, amount: #{@amount}, direction: #{@direction}, status: #{@status},"\
193
+ " ledger_account_id: #{@ledger_account_id}, ledger_account_lock_version:"\
194
+ " #{@ledger_account_lock_version}, ledger_account_currency: #{@ledger_account_currency},"\
195
+ " ledger_account_currency_exponent: #{@ledger_account_currency_exponent},"\
196
+ " ledger_transaction_id: #{@ledger_transaction_id}, metadata: #{@metadata},"\
197
+ " resulting_ledger_account_balances: #{@resulting_ledger_account_balances}>"
198
+ end
199
+
200
+ # Provides a debugging-friendly string with detailed object information.
201
+ def inspect
202
+ class_name = self.class.name.split('::').last
203
+ "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\
204
+ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, amount: #{@amount.inspect},"\
205
+ " direction: #{@direction.inspect}, status: #{@status.inspect}, ledger_account_id:"\
206
+ " #{@ledger_account_id.inspect}, ledger_account_lock_version:"\
207
+ " #{@ledger_account_lock_version.inspect}, ledger_account_currency:"\
208
+ " #{@ledger_account_currency.inspect}, ledger_account_currency_exponent:"\
209
+ " #{@ledger_account_currency_exponent.inspect}, ledger_transaction_id:"\
210
+ " #{@ledger_transaction_id.inspect}, metadata: #{@metadata.inspect},"\
211
+ " resulting_ledger_account_balances: #{@resulting_ledger_account_balances.inspect}>"
212
+ end
213
+ end
214
+ end
@@ -0,0 +1,182 @@
1
+ # modern_treasury
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ require 'date'
7
+ module ModernTreasury
8
+ # LedgerEventHandler Model.
9
+ class LedgerEventHandler < BaseModel
10
+ SKIP = Object.new
11
+ private_constant :SKIP
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [UUID | String]
15
+ attr_accessor :id
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :object
20
+
21
+ # This field will be true if this object exists in the live environment or
22
+ # false if it exists in the test environment.
23
+ # @return [TrueClass | FalseClass]
24
+ attr_accessor :live_mode
25
+
26
+ # This field will be true if this object exists in the live environment or
27
+ # false if it exists in the test environment.
28
+ # @return [DateTime]
29
+ attr_accessor :created_at
30
+
31
+ # This field will be true if this object exists in the live environment or
32
+ # false if it exists in the test environment.
33
+ # @return [DateTime]
34
+ attr_accessor :updated_at
35
+
36
+ # This field will be true if this object exists in the live environment or
37
+ # false if it exists in the test environment.
38
+ # @return [DateTime]
39
+ attr_accessor :discarded_at
40
+
41
+ # Name of the ledger event handler.
42
+ # @return [String]
43
+ attr_accessor :name
44
+
45
+ # An optional description.
46
+ # @return [String]
47
+ attr_accessor :description
48
+
49
+ # An optional description.
50
+ # @return [LedgerEventHandlerLedgerTransactionTemplate]
51
+ attr_accessor :ledger_transaction_template
52
+
53
+ # An optional description.
54
+ # @return [LedgerEventHandlerConditions]
55
+ attr_accessor :conditions
56
+
57
+ # Additional data represented as key-value pairs. Both the key and value
58
+ # must be strings.
59
+ # @return [Hash[String, String]]
60
+ attr_accessor :metadata
61
+
62
+ # A mapping from model property names to API property names.
63
+ def self.names
64
+ @_hash = {} if @_hash.nil?
65
+ @_hash['id'] = 'id'
66
+ @_hash['object'] = 'object'
67
+ @_hash['live_mode'] = 'live_mode'
68
+ @_hash['created_at'] = 'created_at'
69
+ @_hash['updated_at'] = 'updated_at'
70
+ @_hash['discarded_at'] = 'discarded_at'
71
+ @_hash['name'] = 'name'
72
+ @_hash['description'] = 'description'
73
+ @_hash['ledger_transaction_template'] = 'ledger_transaction_template'
74
+ @_hash['conditions'] = 'conditions'
75
+ @_hash['metadata'] = 'metadata'
76
+ @_hash
77
+ end
78
+
79
+ # An array for optional fields
80
+ def self.optionals
81
+ []
82
+ end
83
+
84
+ # An array for nullable fields
85
+ def self.nullables
86
+ %w[
87
+ discarded_at
88
+ description
89
+ metadata
90
+ ]
91
+ end
92
+
93
+ def initialize(id = nil, object = nil, live_mode = nil, created_at = nil,
94
+ updated_at = nil, discarded_at = nil, name = nil,
95
+ description = nil, ledger_transaction_template = nil,
96
+ conditions = nil, metadata = nil)
97
+ @id = id
98
+ @object = object
99
+ @live_mode = live_mode
100
+ @created_at = created_at
101
+ @updated_at = updated_at
102
+ @discarded_at = discarded_at
103
+ @name = name
104
+ @description = description
105
+ @ledger_transaction_template = ledger_transaction_template
106
+ @conditions = conditions
107
+ @metadata = metadata
108
+ end
109
+
110
+ # Creates an instance of the object from a hash.
111
+ def self.from_hash(hash)
112
+ return nil unless hash
113
+
114
+ # Extract variables from the hash.
115
+ id = hash.key?('id') ? hash['id'] : nil
116
+ object = hash.key?('object') ? hash['object'] : nil
117
+ live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil
118
+ created_at = if hash.key?('created_at')
119
+ (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
120
+ end
121
+ updated_at = if hash.key?('updated_at')
122
+ (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
123
+ end
124
+ discarded_at = if hash.key?('discarded_at')
125
+ (DateTimeHelper.from_rfc3339(hash['discarded_at']) if hash['discarded_at'])
126
+ end
127
+ name = hash.key?('name') ? hash['name'] : nil
128
+ description = hash.key?('description') ? hash['description'] : nil
129
+ if hash['ledger_transaction_template']
130
+ ledger_transaction_template = LedgerEventHandlerLedgerTransactionTemplate.from_hash(hash['ledger_transaction_template'])
131
+ end
132
+ conditions = LedgerEventHandlerConditions.from_hash(hash['conditions']) if
133
+ hash['conditions']
134
+ metadata = hash.key?('metadata') ? hash['metadata'] : nil
135
+
136
+ # Create object from extracted values.
137
+ LedgerEventHandler.new(id,
138
+ object,
139
+ live_mode,
140
+ created_at,
141
+ updated_at,
142
+ discarded_at,
143
+ name,
144
+ description,
145
+ ledger_transaction_template,
146
+ conditions,
147
+ metadata)
148
+ end
149
+
150
+ def to_custom_created_at
151
+ DateTimeHelper.to_rfc3339(created_at)
152
+ end
153
+
154
+ def to_custom_updated_at
155
+ DateTimeHelper.to_rfc3339(updated_at)
156
+ end
157
+
158
+ def to_custom_discarded_at
159
+ DateTimeHelper.to_rfc3339(discarded_at)
160
+ end
161
+
162
+ # Provides a human-readable string representation of the object.
163
+ def to_s
164
+ class_name = self.class.name.split('::').last
165
+ "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\
166
+ " #{@created_at}, updated_at: #{@updated_at}, discarded_at: #{@discarded_at}, name:"\
167
+ " #{@name}, description: #{@description}, ledger_transaction_template:"\
168
+ " #{@ledger_transaction_template}, conditions: #{@conditions}, metadata: #{@metadata}>"
169
+ end
170
+
171
+ # Provides a debugging-friendly string with detailed object information.
172
+ def inspect
173
+ class_name = self.class.name.split('::').last
174
+ "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\
175
+ " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
176
+ " #{@updated_at.inspect}, discarded_at: #{@discarded_at.inspect}, name: #{@name.inspect},"\
177
+ " description: #{@description.inspect}, ledger_transaction_template:"\
178
+ " #{@ledger_transaction_template.inspect}, conditions: #{@conditions.inspect}, metadata:"\
179
+ " #{@metadata.inspect}>"
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,78 @@
1
+ # modern_treasury
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ModernTreasury
7
+ # LedgerEventHandlerConditions Model.
8
+ class LedgerEventHandlerConditions < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The field you're fetching from the `ledgerable_event`.
13
+ # @return [String]
14
+ attr_accessor :field
15
+
16
+ # What the operator between the `field` and `value` is. Currently only
17
+ # supports `equals`.
18
+ # @return [String]
19
+ attr_accessor :operator
20
+
21
+ # What raw string you are comparing the `field` against.
22
+ # @return [String]
23
+ attr_accessor :value
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['field'] = 'field'
29
+ @_hash['operator'] = 'operator'
30
+ @_hash['value'] = 'value'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(field = nil, operator = nil, value = nil)
45
+ @field = field
46
+ @operator = operator
47
+ @value = value
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ field = hash.key?('field') ? hash['field'] : nil
56
+ operator = hash.key?('operator') ? hash['operator'] : nil
57
+ value = hash.key?('value') ? hash['value'] : nil
58
+
59
+ # Create object from extracted values.
60
+ LedgerEventHandlerConditions.new(field,
61
+ operator,
62
+ value)
63
+ end
64
+
65
+ # Provides a human-readable string representation of the object.
66
+ def to_s
67
+ class_name = self.class.name.split('::').last
68
+ "<#{class_name} field: #{@field}, operator: #{@operator}, value: #{@value}>"
69
+ end
70
+
71
+ # Provides a debugging-friendly string with detailed object information.
72
+ def inspect
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} field: #{@field.inspect}, operator: #{@operator.inspect}, value:"\
75
+ " #{@value.inspect}>"
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,119 @@
1
+ # modern_treasury
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ModernTreasury
7
+ # LedgerEventHandlerCreateRequest Model.
8
+ class LedgerEventHandlerCreateRequest < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Name of the ledger event handler.
13
+ # @return [String]
14
+ attr_accessor :name
15
+
16
+ # An optional description.
17
+ # @return [String]
18
+ attr_accessor :description
19
+
20
+ # The id of the ledger that this account belongs to.
21
+ # @return [UUID | String]
22
+ attr_accessor :ledger_id
23
+
24
+ # The id of the ledger that this account belongs to.
25
+ # @return [LedgerEventHandlerLedgerTransactionTemplate]
26
+ attr_accessor :ledger_transaction_template
27
+
28
+ # The id of the ledger that this account belongs to.
29
+ # @return [LedgerEventHandlerConditions]
30
+ attr_accessor :conditions
31
+
32
+ # Additional data represented as key-value pairs. Both the key and value
33
+ # must be strings.
34
+ # @return [Hash[String, String]]
35
+ attr_accessor :metadata
36
+
37
+ # A mapping from model property names to API property names.
38
+ def self.names
39
+ @_hash = {} if @_hash.nil?
40
+ @_hash['name'] = 'name'
41
+ @_hash['description'] = 'description'
42
+ @_hash['ledger_id'] = 'ledger_id'
43
+ @_hash['ledger_transaction_template'] = 'ledger_transaction_template'
44
+ @_hash['conditions'] = 'conditions'
45
+ @_hash['metadata'] = 'metadata'
46
+ @_hash
47
+ end
48
+
49
+ # An array for optional fields
50
+ def self.optionals
51
+ %w[
52
+ description
53
+ ledger_id
54
+ conditions
55
+ metadata
56
+ ]
57
+ end
58
+
59
+ # An array for nullable fields
60
+ def self.nullables
61
+ %w[
62
+ description
63
+ metadata
64
+ ]
65
+ end
66
+
67
+ def initialize(name = nil, ledger_transaction_template = nil,
68
+ description = SKIP, ledger_id = SKIP, conditions = SKIP,
69
+ metadata = SKIP)
70
+ @name = name
71
+ @description = description unless description == SKIP
72
+ @ledger_id = ledger_id unless ledger_id == SKIP
73
+ @ledger_transaction_template = ledger_transaction_template
74
+ @conditions = conditions unless conditions == SKIP
75
+ @metadata = metadata unless metadata == SKIP
76
+ end
77
+
78
+ # Creates an instance of the object from a hash.
79
+ def self.from_hash(hash)
80
+ return nil unless hash
81
+
82
+ # Extract variables from the hash.
83
+ name = hash.key?('name') ? hash['name'] : nil
84
+ if hash['ledger_transaction_template']
85
+ ledger_transaction_template = LedgerEventHandlerLedgerTransactionTemplate.from_hash(hash['ledger_transaction_template'])
86
+ end
87
+ description = hash.key?('description') ? hash['description'] : SKIP
88
+ ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : SKIP
89
+ conditions = LedgerEventHandlerConditions.from_hash(hash['conditions']) if
90
+ hash['conditions']
91
+ metadata = hash.key?('metadata') ? hash['metadata'] : SKIP
92
+
93
+ # Create object from extracted values.
94
+ LedgerEventHandlerCreateRequest.new(name,
95
+ ledger_transaction_template,
96
+ description,
97
+ ledger_id,
98
+ conditions,
99
+ metadata)
100
+ end
101
+
102
+ # Provides a human-readable string representation of the object.
103
+ def to_s
104
+ class_name = self.class.name.split('::').last
105
+ "<#{class_name} name: #{@name}, description: #{@description}, ledger_id: #{@ledger_id},"\
106
+ " ledger_transaction_template: #{@ledger_transaction_template}, conditions: #{@conditions},"\
107
+ " metadata: #{@metadata}>"
108
+ end
109
+
110
+ # Provides a debugging-friendly string with detailed object information.
111
+ def inspect
112
+ class_name = self.class.name.split('::').last
113
+ "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, ledger_id:"\
114
+ " #{@ledger_id.inspect}, ledger_transaction_template:"\
115
+ " #{@ledger_transaction_template.inspect}, conditions: #{@conditions.inspect}, metadata:"\
116
+ " #{@metadata.inspect}>"
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,80 @@
1
+ # modern_treasury
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module ModernTreasury
7
+ # LedgerEventHandlerLedgerEntries Model.
8
+ class LedgerEventHandlerLedgerEntries < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # The field you're fetching from the `ledgerable_event`.
13
+ # @return [String]
14
+ attr_accessor :amount
15
+
16
+ # What the operator between the `field` and `value` is. Currently only
17
+ # supports `equals`.
18
+ # @return [String]
19
+ attr_accessor :direction
20
+
21
+ # What raw string you are comparing the `field` against.
22
+ # @return [String]
23
+ attr_accessor :ledger_account_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['amount'] = 'amount'
29
+ @_hash['direction'] = 'direction'
30
+ @_hash['ledger_account_id'] = 'ledger_account_id'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(amount = nil, direction = nil, ledger_account_id = nil)
45
+ @amount = amount
46
+ @direction = direction
47
+ @ledger_account_id = ledger_account_id
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ amount = hash.key?('amount') ? hash['amount'] : nil
56
+ direction = hash.key?('direction') ? hash['direction'] : nil
57
+ ledger_account_id =
58
+ hash.key?('ledger_account_id') ? hash['ledger_account_id'] : nil
59
+
60
+ # Create object from extracted values.
61
+ LedgerEventHandlerLedgerEntries.new(amount,
62
+ direction,
63
+ ledger_account_id)
64
+ end
65
+
66
+ # Provides a human-readable string representation of the object.
67
+ def to_s
68
+ class_name = self.class.name.split('::').last
69
+ "<#{class_name} amount: #{@amount}, direction: #{@direction}, ledger_account_id:"\
70
+ " #{@ledger_account_id}>"
71
+ end
72
+
73
+ # Provides a debugging-friendly string with detailed object information.
74
+ def inspect
75
+ class_name = self.class.name.split('::').last
76
+ "<#{class_name} amount: #{@amount.inspect}, direction: #{@direction.inspect},"\
77
+ " ledger_account_id: #{@ledger_account_id.inspect}>"
78
+ end
79
+ end
80
+ end