apimaticcalculatortest 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (366) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +14717 -0
  4. data/lib/beaver.rb +384 -0
  5. data/lib/beaver/api_helper.rb +289 -0
  6. data/lib/beaver/client.rb +31 -0
  7. data/lib/beaver/configuration.rb +115 -0
  8. data/lib/beaver/controllers/api_controller.rb +5756 -0
  9. data/lib/beaver/controllers/base_controller.rb +49 -0
  10. data/lib/beaver/exceptions/api_exception.rb +20 -0
  11. data/lib/beaver/http/auth/custom_header_auth.rb +16 -0
  12. data/lib/beaver/http/faraday_client.rb +67 -0
  13. data/lib/beaver/http/http_call_back.rb +24 -0
  14. data/lib/beaver/http/http_client.rb +104 -0
  15. data/lib/beaver/http/http_method_enum.rb +13 -0
  16. data/lib/beaver/http/http_request.rb +50 -0
  17. data/lib/beaver/http/http_response.rb +29 -0
  18. data/lib/beaver/models/account_resp.rb +193 -0
  19. data/lib/beaver/models/account_type_enum.rb +17 -0
  20. data/lib/beaver/models/accounts_capabilities_request.rb +44 -0
  21. data/lib/beaver/models/accounts_request.rb +144 -0
  22. data/lib/beaver/models/accounts_request1.rb +135 -0
  23. data/lib/beaver/models/accounts_response.rb +69 -0
  24. data/lib/beaver/models/additional_representative_req.rb +121 -0
  25. data/lib/beaver/models/additional_representative_resp.rb +120 -0
  26. data/lib/beaver/models/additional_representatives.rb +66 -0
  27. data/lib/beaver/models/additional_representatives1.rb +66 -0
  28. data/lib/beaver/models/additional_representatives_req.rb +70 -0
  29. data/lib/beaver/models/additional_representatives_resp.rb +70 -0
  30. data/lib/beaver/models/address_legal_entities_nullable.rb +80 -0
  31. data/lib/beaver/models/address_nullable.rb +80 -0
  32. data/lib/beaver/models/address_payments_req.rb +80 -0
  33. data/lib/beaver/models/address_payments_resp.rb +80 -0
  34. data/lib/beaver/models/address_rbit.rb +73 -0
  35. data/lib/beaver/models/address_rbits.rb +80 -0
  36. data/lib/beaver/models/address_terminals_req.rb +80 -0
  37. data/lib/beaver/models/address_terminals_resp.rb +80 -0
  38. data/lib/beaver/models/address_type_enum.rb +26 -0
  39. data/lib/beaver/models/adjustments.rb +136 -0
  40. data/lib/beaver/models/adjustments_request.rb +51 -0
  41. data/lib/beaver/models/adjustments_response.rb +69 -0
  42. data/lib/beaver/models/amount_guide_type_enum.rb +21 -0
  43. data/lib/beaver/models/application_block.rb +35 -0
  44. data/lib/beaver/models/application_block4.rb +44 -0
  45. data/lib/beaver/models/associated_phone.rb +44 -0
  46. data/lib/beaver/models/associated_resource.rb +44 -0
  47. data/lib/beaver/models/auto_billing.rb +71 -0
  48. data/lib/beaver/models/balances.rb +36 -0
  49. data/lib/beaver/models/base_model.rb +36 -0
  50. data/lib/beaver/models/billing_statement.rb +116 -0
  51. data/lib/beaver/models/billing_statements_interchange_fees_response.rb +69 -0
  52. data/lib/beaver/models/billing_statements_response.rb +69 -0
  53. data/lib/beaver/models/billing_statements_transactions_summary_response.rb +69 -0
  54. data/lib/beaver/models/business_description.rb +53 -0
  55. data/lib/beaver/models/business_name.rb +44 -0
  56. data/lib/beaver/models/buyer.rb +54 -0
  57. data/lib/beaver/models/ca.rb +35 -0
  58. data/lib/beaver/models/ca1.rb +37 -0
  59. data/lib/beaver/models/ca4.rb +44 -0
  60. data/lib/beaver/models/cad.rb +53 -0
  61. data/lib/beaver/models/cad1.rb +62 -0
  62. data/lib/beaver/models/cad2.rb +44 -0
  63. data/lib/beaver/models/capabilities_resp.rb +89 -0
  64. data/lib/beaver/models/capture_amounts.rb +53 -0
  65. data/lib/beaver/models/card_brand2_enum.rb +23 -0
  66. data/lib/beaver/models/card_brand_enum.rb +29 -0
  67. data/lib/beaver/models/card_entry_type_enum.rb +14 -0
  68. data/lib/beaver/models/code_type_enum.rb +21 -0
  69. data/lib/beaver/models/contactless_payments.rb +47 -0
  70. data/lib/beaver/models/contactless_payments_req.rb +48 -0
  71. data/lib/beaver/models/controller.rb +37 -0
  72. data/lib/beaver/models/controller1.rb +37 -0
  73. data/lib/beaver/models/controller_req.rb +112 -0
  74. data/lib/beaver/models/controller_resp.rb +111 -0
  75. data/lib/beaver/models/countries_opted_out_methods.rb +35 -0
  76. data/lib/beaver/models/country_code_enum.rb +758 -0
  77. data/lib/beaver/models/country_opted_out_methods.rb +35 -0
  78. data/lib/beaver/models/credit_card.rb +47 -0
  79. data/lib/beaver/models/credit_card1.rb +153 -0
  80. data/lib/beaver/models/credit_card2.rb +117 -0
  81. data/lib/beaver/models/credit_card4.rb +44 -0
  82. data/lib/beaver/models/credit_debit_preference1_enum.rb +23 -0
  83. data/lib/beaver/models/credit_debit_preference_enum.rb +20 -0
  84. data/lib/beaver/models/currencies.rb +53 -0
  85. data/lib/beaver/models/currencies1.rb +53 -0
  86. data/lib/beaver/models/currencies2.rb +53 -0
  87. data/lib/beaver/models/currencies3.rb +53 -0
  88. data/lib/beaver/models/currency_enum.rb +20 -0
  89. data/lib/beaver/models/currency_nullable_enum.rb +20 -0
  90. data/lib/beaver/models/current_issue.rb +83 -0
  91. data/lib/beaver/models/current_issue2.rb +72 -0
  92. data/lib/beaver/models/date_of_birth.rb +53 -0
  93. data/lib/beaver/models/deferred_authorization.rb +87 -0
  94. data/lib/beaver/models/delivery_type_enum.rb +35 -0
  95. data/lib/beaver/models/detail.rb +44 -0
  96. data/lib/beaver/models/detail1.rb +44 -0
  97. data/lib/beaver/models/detail10.rb +44 -0
  98. data/lib/beaver/models/detail2.rb +44 -0
  99. data/lib/beaver/models/detail3.rb +44 -0
  100. data/lib/beaver/models/detail4.rb +44 -0
  101. data/lib/beaver/models/detail5.rb +44 -0
  102. data/lib/beaver/models/detail6.rb +44 -0
  103. data/lib/beaver/models/detail7.rb +44 -0
  104. data/lib/beaver/models/detail8.rb +44 -0
  105. data/lib/beaver/models/detail9.rb +44 -0
  106. data/lib/beaver/models/detail_code10_enum.rb +26 -0
  107. data/lib/beaver/models/detail_code1_enum.rb +20 -0
  108. data/lib/beaver/models/detail_code2_enum.rb +29 -0
  109. data/lib/beaver/models/detail_code3_enum.rb +17 -0
  110. data/lib/beaver/models/detail_code4_enum.rb +50 -0
  111. data/lib/beaver/models/detail_code5_enum.rb +329 -0
  112. data/lib/beaver/models/detail_code6_enum.rb +17 -0
  113. data/lib/beaver/models/detail_code7_enum.rb +272 -0
  114. data/lib/beaver/models/detail_code8_enum.rb +17 -0
  115. data/lib/beaver/models/detail_code9_enum.rb +59 -0
  116. data/lib/beaver/models/detail_code_enum.rb +17 -0
  117. data/lib/beaver/models/dispute_reason.rb +60 -0
  118. data/lib/beaver/models/disputes.rb +239 -0
  119. data/lib/beaver/models/disputes_request.rb +61 -0
  120. data/lib/beaver/models/disputes_response.rb +69 -0
  121. data/lib/beaver/models/document.rb +99 -0
  122. data/lib/beaver/models/documentation.rb +44 -0
  123. data/lib/beaver/models/documentation1.rb +44 -0
  124. data/lib/beaver/models/embedded_rbit.rb +183 -0
  125. data/lib/beaver/models/entity_country_info.rb +53 -0
  126. data/lib/beaver/models/entity_verification.rb +35 -0
  127. data/lib/beaver/models/entity_verification1.rb +67 -0
  128. data/lib/beaver/models/errant_field_enum.rb +20 -0
  129. data/lib/beaver/models/external_account.rb +135 -0
  130. data/lib/beaver/models/fee_type_enum.rb +32 -0
  131. data/lib/beaver/models/flat_guide.rb +53 -0
  132. data/lib/beaver/models/fundraising_event.rb +116 -0
  133. data/lib/beaver/models/fundraising_update.rb +44 -0
  134. data/lib/beaver/models/gb.rb +44 -0
  135. data/lib/beaver/models/gbp.rb +53 -0
  136. data/lib/beaver/models/gbp1.rb +62 -0
  137. data/lib/beaver/models/gbp2.rb +44 -0
  138. data/lib/beaver/models/holder_req.rb +67 -0
  139. data/lib/beaver/models/holder_resp.rb +63 -0
  140. data/lib/beaver/models/human_name_full_nullable.rb +71 -0
  141. data/lib/beaver/models/incoming_payments_req.rb +37 -0
  142. data/lib/beaver/models/incoming_payments_resp.rb +46 -0
  143. data/lib/beaver/models/industry.rb +44 -0
  144. data/lib/beaver/models/industry_code.rb +53 -0
  145. data/lib/beaver/models/initiated_by_req_enum.rb +17 -0
  146. data/lib/beaver/models/initiated_by_resp_enum.rb +20 -0
  147. data/lib/beaver/models/interchange_fee.rb +137 -0
  148. data/lib/beaver/models/interchange_plus.rb +45 -0
  149. data/lib/beaver/models/issue_type4_enum.rb +20 -0
  150. data/lib/beaver/models/issue_type_enum.rb +47 -0
  151. data/lib/beaver/models/item_nullable_req.rb +159 -0
  152. data/lib/beaver/models/item_nullable_resp.rb +188 -0
  153. data/lib/beaver/models/item_req.rb +159 -0
  154. data/lib/beaver/models/item_resp.rb +197 -0
  155. data/lib/beaver/models/itemized_receipt.rb +89 -0
  156. data/lib/beaver/models/items_response.rb +69 -0
  157. data/lib/beaver/models/legal_entities_request.rb +158 -0
  158. data/lib/beaver/models/legal_entities_response.rb +69 -0
  159. data/lib/beaver/models/legal_entities_verifications_request.rb +58 -0
  160. data/lib/beaver/models/legal_entities_verifications_response.rb +103 -0
  161. data/lib/beaver/models/legal_entity.rb +167 -0
  162. data/lib/beaver/models/legal_entity_resp.rb +196 -0
  163. data/lib/beaver/models/legal_form1_enum.rb +32 -0
  164. data/lib/beaver/models/legal_form_enum.rb +41 -0
  165. data/lib/beaver/models/line_item.rb +152 -0
  166. data/lib/beaver/models/line_item1.rb +152 -0
  167. data/lib/beaver/models/mfa_action_enum.rb +20 -0
  168. data/lib/beaver/models/mfa_rbit.rb +45 -0
  169. data/lib/beaver/models/mode_enum.rb +23 -0
  170. data/lib/beaver/models/model1_enum.rb +17 -0
  171. data/lib/beaver/models/model_enum.rb +17 -0
  172. data/lib/beaver/models/name.rb +44 -0
  173. data/lib/beaver/models/name_type_enum.rb +17 -0
  174. data/lib/beaver/models/notification_preferences_request.rb +44 -0
  175. data/lib/beaver/models/notification_preferences_request1.rb +35 -0
  176. data/lib/beaver/models/notification_preferences_response.rb +69 -0
  177. data/lib/beaver/models/notification_preferences_response1.rb +107 -0
  178. data/lib/beaver/models/notification_preferences_response2.rb +107 -0
  179. data/lib/beaver/models/notifications_response.rb +69 -0
  180. data/lib/beaver/models/notifications_response1.rb +98 -0
  181. data/lib/beaver/models/opted_out_methods.rb +36 -0
  182. data/lib/beaver/models/order_non_expanded.rb +53 -0
  183. data/lib/beaver/models/order_req.rb +288 -0
  184. data/lib/beaver/models/order_resp.rb +327 -0
  185. data/lib/beaver/models/orders_response.rb +69 -0
  186. data/lib/beaver/models/owner16.rb +53 -0
  187. data/lib/beaver/models/owner20.rb +53 -0
  188. data/lib/beaver/models/owner3.rb +53 -0
  189. data/lib/beaver/models/owner_accounts.rb +53 -0
  190. data/lib/beaver/models/owner_applications.rb +53 -0
  191. data/lib/beaver/models/owner_is_account.rb +53 -0
  192. data/lib/beaver/models/owner_legal_entities.rb +53 -0
  193. data/lib/beaver/models/owner_legal_entities_nullable.rb +53 -0
  194. data/lib/beaver/models/owner_of_items.rb +53 -0
  195. data/lib/beaver/models/partner_service.rb +53 -0
  196. data/lib/beaver/models/partner_service_rbit.rb +69 -0
  197. data/lib/beaver/models/payment_bank.rb +44 -0
  198. data/lib/beaver/models/payment_bank_us.rb +54 -0
  199. data/lib/beaver/models/payment_bank_us_req.rb +63 -0
  200. data/lib/beaver/models/payment_failure_reason.rb +60 -0
  201. data/lib/beaver/models/payment_method_for_payments.rb +93 -0
  202. data/lib/beaver/models/payment_method_non_expanded.rb +53 -0
  203. data/lib/beaver/models/payment_method_req.rb +89 -0
  204. data/lib/beaver/models/payment_method_resp.rb +127 -0
  205. data/lib/beaver/models/payment_method_type_enum.rb +17 -0
  206. data/lib/beaver/models/payment_methods_request.rb +83 -0
  207. data/lib/beaver/models/payment_methods_response.rb +69 -0
  208. data/lib/beaver/models/payment_methods_verify_bank_deposits_request.rb +35 -0
  209. data/lib/beaver/models/payment_non_expanded.rb +53 -0
  210. data/lib/beaver/models/payment_pending_reason.rb +60 -0
  211. data/lib/beaver/models/payments.rb +60 -0
  212. data/lib/beaver/models/payments1.rb +37 -0
  213. data/lib/beaver/models/payments_cancel_request.rb +51 -0
  214. data/lib/beaver/models/payments_capture_request.rb +35 -0
  215. data/lib/beaver/models/payments_request.rb +143 -0
  216. data/lib/beaver/models/payments_request1.rb +69 -0
  217. data/lib/beaver/models/payments_response.rb +69 -0
  218. data/lib/beaver/models/payments_v30.rb +247 -0
  219. data/lib/beaver/models/payout.rb +184 -0
  220. data/lib/beaver/models/payout_bank_ca.rb +44 -0
  221. data/lib/beaver/models/payout_bank_ca1.rb +62 -0
  222. data/lib/beaver/models/payout_bank_gb.rb +35 -0
  223. data/lib/beaver/models/payout_bank_gb1.rb +44 -0
  224. data/lib/beaver/models/payout_bank_us.rb +44 -0
  225. data/lib/beaver/models/payout_bank_us1.rb +53 -0
  226. data/lib/beaver/models/payout_failure_reason.rb +60 -0
  227. data/lib/beaver/models/payout_method_non_expanded.rb +53 -0
  228. data/lib/beaver/models/payout_method_req.rb +117 -0
  229. data/lib/beaver/models/payout_method_resp.rb +137 -0
  230. data/lib/beaver/models/payout_method_type_enum.rb +20 -0
  231. data/lib/beaver/models/payout_methods_request.rb +51 -0
  232. data/lib/beaver/models/payout_methods_response.rb +69 -0
  233. data/lib/beaver/models/payout_pending_reason.rb +60 -0
  234. data/lib/beaver/models/payout_req.rb +45 -0
  235. data/lib/beaver/models/payout_resp.rb +45 -0
  236. data/lib/beaver/models/payouts.rb +60 -0
  237. data/lib/beaver/models/payouts1.rb +37 -0
  238. data/lib/beaver/models/payouts_request.rb +51 -0
  239. data/lib/beaver/models/payouts_response.rb +69 -0
  240. data/lib/beaver/models/percentage_guide.rb +64 -0
  241. data/lib/beaver/models/period_enum.rb +20 -0
  242. data/lib/beaver/models/person_rbit.rb +54 -0
  243. data/lib/beaver/models/personal_country_info.rb +53 -0
  244. data/lib/beaver/models/personal_country_info1.rb +53 -0
  245. data/lib/beaver/models/personal_verification.rb +35 -0
  246. data/lib/beaver/models/personal_verification5.rb +67 -0
  247. data/lib/beaver/models/phone.rb +53 -0
  248. data/lib/beaver/models/phone1.rb +53 -0
  249. data/lib/beaver/models/phone_legal_entities_nullable.rb +44 -0
  250. data/lib/beaver/models/phone_rbit.rb +53 -0
  251. data/lib/beaver/models/phone_type_enum.rb +20 -0
  252. data/lib/beaver/models/pricing.rb +36 -0
  253. data/lib/beaver/models/pricing_by_currency.rb +46 -0
  254. data/lib/beaver/models/quick_chip.rb +35 -0
  255. data/lib/beaver/models/rbit_source_enum.rb +47 -0
  256. data/lib/beaver/models/rbit_types_enum.rb +50 -0
  257. data/lib/beaver/models/rbits_request.rb +194 -0
  258. data/lib/beaver/models/rbits_response.rb +246 -0
  259. data/lib/beaver/models/rbits_response1.rb +69 -0
  260. data/lib/beaver/models/reason.rb +60 -0
  261. data/lib/beaver/models/reason_code1_enum.rb +20 -0
  262. data/lib/beaver/models/reason_code2_enum.rb +29 -0
  263. data/lib/beaver/models/reason_code3_enum.rb +17 -0
  264. data/lib/beaver/models/reason_code4_enum.rb +23 -0
  265. data/lib/beaver/models/reason_code5_enum.rb +32 -0
  266. data/lib/beaver/models/reason_code6_enum.rb +17 -0
  267. data/lib/beaver/models/reason_code7_enum.rb +32 -0
  268. data/lib/beaver/models/reason_code8_enum.rb +17 -0
  269. data/lib/beaver/models/reason_code9_enum.rb +29 -0
  270. data/lib/beaver/models/reason_code_enum.rb +17 -0
  271. data/lib/beaver/models/recoveries.rb +185 -0
  272. data/lib/beaver/models/recoveries_request.rb +51 -0
  273. data/lib/beaver/models/recoveries_response.rb +69 -0
  274. data/lib/beaver/models/recovery_failure_reason.rb +60 -0
  275. data/lib/beaver/models/recovery_pending_reason.rb +60 -0
  276. data/lib/beaver/models/refund_amounts.rb +53 -0
  277. data/lib/beaver/models/refund_failure_reason.rb +60 -0
  278. data/lib/beaver/models/refund_pending_reason.rb +60 -0
  279. data/lib/beaver/models/refund_req.rb +96 -0
  280. data/lib/beaver/models/refund_resp.rb +203 -0
  281. data/lib/beaver/models/refunds_request.rb +60 -0
  282. data/lib/beaver/models/refunds_response.rb +69 -0
  283. data/lib/beaver/models/reject_reason.rb +60 -0
  284. data/lib/beaver/models/representative0.rb +37 -0
  285. data/lib/beaver/models/representative01.rb +37 -0
  286. data/lib/beaver/models/resolution.rb +44 -0
  287. data/lib/beaver/models/resource1_enum.rb +29 -0
  288. data/lib/beaver/models/resource2_enum.rb +20 -0
  289. data/lib/beaver/models/resource_accounts_enum.rb +14 -0
  290. data/lib/beaver/models/resource_capabilities_enum.rb +14 -0
  291. data/lib/beaver/models/resource_enum.rb +14 -0
  292. data/lib/beaver/models/resource_legal_entities_enum.rb +14 -0
  293. data/lib/beaver/models/resource_notifications_enum.rb +14 -0
  294. data/lib/beaver/models/resource_payments_enum.rb +14 -0
  295. data/lib/beaver/models/resource_types_rbit_enum.rb +35 -0
  296. data/lib/beaver/models/resource_verifications_enum.rb +14 -0
  297. data/lib/beaver/models/result.rb +98 -0
  298. data/lib/beaver/models/result1.rb +107 -0
  299. data/lib/beaver/models/result2.rb +246 -0
  300. data/lib/beaver/models/role_enum.rb +23 -0
  301. data/lib/beaver/models/service_billing_method_enum.rb +35 -0
  302. data/lib/beaver/models/setup_by_enum.rb +17 -0
  303. data/lib/beaver/models/shipping_info.rb +80 -0
  304. data/lib/beaver/models/shipping_status.rb +80 -0
  305. data/lib/beaver/models/shipping_status1.rb +80 -0
  306. data/lib/beaver/models/standard.rb +62 -0
  307. data/lib/beaver/models/state_enum.rb +17 -0
  308. data/lib/beaver/models/status20_enum.rb +20 -0
  309. data/lib/beaver/models/status2_enum.rb +23 -0
  310. data/lib/beaver/models/status3_enum.rb +23 -0
  311. data/lib/beaver/models/status4_enum.rb +20 -0
  312. data/lib/beaver/models/status5_enum.rb +23 -0
  313. data/lib/beaver/models/status8_enum.rb +20 -0
  314. data/lib/beaver/models/status_enum.rb +20 -0
  315. data/lib/beaver/models/supported_card_entry_mode_enum.rb +23 -0
  316. data/lib/beaver/models/target.rb +53 -0
  317. data/lib/beaver/models/terminal_configuration.rb +137 -0
  318. data/lib/beaver/models/terminal_configuration1.rb +138 -0
  319. data/lib/beaver/models/terminal_configuration2.rb +138 -0
  320. data/lib/beaver/models/terminal_display.rb +62 -0
  321. data/lib/beaver/models/terminal_resp.rb +148 -0
  322. data/lib/beaver/models/terminals_request.rb +75 -0
  323. data/lib/beaver/models/terminals_request1.rb +48 -0
  324. data/lib/beaver/models/terminals_response.rb +69 -0
  325. data/lib/beaver/models/terminals_status_enum.rb +23 -0
  326. data/lib/beaver/models/terminals_supported_card_brand_enum.rb +23 -0
  327. data/lib/beaver/models/terminals_tip.rb +51 -0
  328. data/lib/beaver/models/terms.rb +44 -0
  329. data/lib/beaver/models/terms_nullable.rb +44 -0
  330. data/lib/beaver/models/terms_of_service.rb +44 -0
  331. data/lib/beaver/models/timezone_enum.rb +50 -0
  332. data/lib/beaver/models/token.rb +44 -0
  333. data/lib/beaver/models/tokens_request.rb +65 -0
  334. data/lib/beaver/models/tokens_response.rb +93 -0
  335. data/lib/beaver/models/topic1_enum.rb +115 -0
  336. data/lib/beaver/models/topic_enum.rb +151 -0
  337. data/lib/beaver/models/transaction_details.rb +132 -0
  338. data/lib/beaver/models/transaction_record.rb +125 -0
  339. data/lib/beaver/models/transaction_record_non_expanded.rb +53 -0
  340. data/lib/beaver/models/transaction_records_response.rb +69 -0
  341. data/lib/beaver/models/transactions_summary.rb +96 -0
  342. data/lib/beaver/models/transactions_summary_summaries.rb +62 -0
  343. data/lib/beaver/models/type12_enum.rb +17 -0
  344. data/lib/beaver/models/type15_enum.rb +74 -0
  345. data/lib/beaver/models/type27_enum.rb +14 -0
  346. data/lib/beaver/models/type2_enum.rb +20 -0
  347. data/lib/beaver/models/type3_enum.rb +17 -0
  348. data/lib/beaver/models/type4_enum.rb +26 -0
  349. data/lib/beaver/models/type5_enum.rb +20 -0
  350. data/lib/beaver/models/type6_enum.rb +17 -0
  351. data/lib/beaver/models/type7_enum.rb +17 -0
  352. data/lib/beaver/models/type8_enum.rb +53 -0
  353. data/lib/beaver/models/type9_enum.rb +23 -0
  354. data/lib/beaver/models/type_enum.rb +20 -0
  355. data/lib/beaver/models/units_enum.rb +17 -0
  356. data/lib/beaver/models/upcoming_issue.rb +83 -0
  357. data/lib/beaver/models/us.rb +46 -0
  358. data/lib/beaver/models/us1.rb +49 -0
  359. data/lib/beaver/models/us4.rb +45 -0
  360. data/lib/beaver/models/usd.rb +53 -0
  361. data/lib/beaver/models/usd1.rb +62 -0
  362. data/lib/beaver/models/usd2.rb +44 -0
  363. data/lib/beaver/models/virtual_terminal_mode_enum.rb +17 -0
  364. data/lib/beaver/models/weight.rb +44 -0
  365. data/lib/beaver/utilities/file_wrapper.rb +17 -0
  366. metadata +489 -0
data/lib/beaver.rb ADDED
@@ -0,0 +1,384 @@
1
+ # beaver
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'date'
7
+ require 'json'
8
+ require 'faraday'
9
+ require 'certifi'
10
+ require 'logging'
11
+
12
+ require_relative 'beaver/api_helper.rb'
13
+ require_relative 'beaver/client.rb'
14
+
15
+ # Utilities
16
+ require_relative 'beaver/utilities/file_wrapper.rb'
17
+
18
+ # Http
19
+ require_relative 'beaver/http/http_call_back.rb'
20
+ require_relative 'beaver/http/http_client.rb'
21
+ require_relative 'beaver/http/faraday_client.rb'
22
+ require_relative 'beaver/http/http_method_enum.rb'
23
+ require_relative 'beaver/http/http_request.rb'
24
+ require_relative 'beaver/http/http_response.rb'
25
+ require_relative 'beaver/http/auth/custom_header_auth.rb'
26
+
27
+ # Models
28
+ require_relative 'beaver/models/base_model.rb'
29
+ require_relative 'beaver/models/partner_service.rb'
30
+ require_relative 'beaver/models/address_rbits.rb'
31
+ require_relative 'beaver/models/country_opted_out_methods.rb'
32
+ require_relative 'beaver/models/owner_of_items.rb'
33
+ require_relative 'beaver/models/terms.rb'
34
+ require_relative 'beaver/models/weight.rb'
35
+ require_relative 'beaver/models/phone_legal_entities_nullable.rb'
36
+ require_relative 'beaver/models/human_name_full_nullable.rb'
37
+ require_relative 'beaver/models/address_legal_entities_nullable.rb'
38
+ require_relative 'beaver/models/mfa_rbit.rb'
39
+ require_relative 'beaver/models/phone_rbit.rb'
40
+ require_relative 'beaver/models/person_rbit.rb'
41
+ require_relative 'beaver/models/partner_service_rbit.rb'
42
+ require_relative 'beaver/models/industry_code.rb'
43
+ require_relative 'beaver/models/fundraising_update.rb'
44
+ require_relative 'beaver/models/address_rbit.rb'
45
+ require_relative 'beaver/models/auto_billing.rb'
46
+ require_relative 'beaver/models/business_description.rb'
47
+ require_relative 'beaver/models/business_name.rb'
48
+ require_relative 'beaver/models/external_account.rb'
49
+ require_relative 'beaver/models/fundraising_event.rb'
50
+ require_relative 'beaver/models/transaction_details.rb'
51
+ require_relative 'beaver/models/address_payments_resp.rb'
52
+ require_relative 'beaver/models/pricing_by_currency.rb'
53
+ require_relative 'beaver/models/countries_opted_out_methods.rb'
54
+ require_relative 'beaver/models/item_nullable_resp.rb'
55
+ require_relative 'beaver/models/additional_representative_req.rb'
56
+ require_relative 'beaver/models/address_payments_req.rb'
57
+ require_relative 'beaver/models/address_terminals_resp.rb'
58
+ require_relative 'beaver/models/terminals_tip.rb'
59
+ require_relative 'beaver/models/quick_chip.rb'
60
+ require_relative 'beaver/models/additional_representative_resp.rb'
61
+ require_relative 'beaver/models/deferred_authorization.rb'
62
+ require_relative 'beaver/models/holder_resp.rb'
63
+ require_relative 'beaver/models/opted_out_methods.rb'
64
+ require_relative 'beaver/models/transactions_summary_summaries.rb'
65
+ require_relative 'beaver/models/recovery_pending_reason.rb'
66
+ require_relative 'beaver/models/refund_pending_reason.rb'
67
+ require_relative 'beaver/models/payment_pending_reason.rb'
68
+ require_relative 'beaver/models/payout_pending_reason.rb'
69
+ require_relative 'beaver/models/transaction_record_non_expanded.rb'
70
+ require_relative 'beaver/models/payout_failure_reason.rb'
71
+ require_relative 'beaver/models/owner_is_account.rb'
72
+ require_relative 'beaver/models/payout_method_non_expanded.rb'
73
+ require_relative 'beaver/models/payment_method_non_expanded.rb'
74
+ require_relative 'beaver/models/order_non_expanded.rb'
75
+ require_relative 'beaver/models/payment_failure_reason.rb'
76
+ require_relative 'beaver/models/holder_req.rb'
77
+ require_relative 'beaver/models/token.rb'
78
+ require_relative 'beaver/models/controller_req.rb'
79
+ require_relative 'beaver/models/additional_representatives_req.rb'
80
+ require_relative 'beaver/models/terms_nullable.rb'
81
+ require_relative 'beaver/models/address_nullable.rb'
82
+ require_relative 'beaver/models/owner_legal_entities_nullable.rb'
83
+ require_relative 'beaver/models/owner_applications.rb'
84
+ require_relative 'beaver/models/controller_resp.rb'
85
+ require_relative 'beaver/models/additional_representatives_resp.rb'
86
+ require_relative 'beaver/models/recovery_failure_reason.rb'
87
+ require_relative 'beaver/models/dispute_reason.rb'
88
+ require_relative 'beaver/models/payment_non_expanded.rb'
89
+ require_relative 'beaver/models/pricing.rb'
90
+ require_relative 'beaver/models/refund_amounts.rb'
91
+ require_relative 'beaver/models/payout_resp.rb'
92
+ require_relative 'beaver/models/refund_failure_reason.rb'
93
+ require_relative 'beaver/models/owner_legal_entities.rb'
94
+ require_relative 'beaver/models/incoming_payments_resp.rb'
95
+ require_relative 'beaver/models/item_nullable_req.rb'
96
+ require_relative 'beaver/models/refund_resp.rb'
97
+ require_relative 'beaver/models/recoveries.rb'
98
+ require_relative 'beaver/models/payout_method_resp.rb'
99
+ require_relative 'beaver/models/payout.rb'
100
+ require_relative 'beaver/models/payment_method_resp.rb'
101
+ require_relative 'beaver/models/payments_v30.rb'
102
+ require_relative 'beaver/models/payment_bank_us_req.rb'
103
+ require_relative 'beaver/models/legal_entity.rb'
104
+ require_relative 'beaver/models/order_resp.rb'
105
+ require_relative 'beaver/models/address_terminals_req.rb'
106
+ require_relative 'beaver/models/contactless_payments_req.rb'
107
+ require_relative 'beaver/models/terminal_resp.rb'
108
+ require_relative 'beaver/models/legal_entity_resp.rb'
109
+ require_relative 'beaver/models/item_resp.rb'
110
+ require_relative 'beaver/models/disputes.rb'
111
+ require_relative 'beaver/models/transactions_summary.rb'
112
+ require_relative 'beaver/models/interchange_fee.rb'
113
+ require_relative 'beaver/models/billing_statement.rb'
114
+ require_relative 'beaver/models/adjustments.rb'
115
+ require_relative 'beaver/models/account_resp.rb'
116
+ require_relative 'beaver/models/transaction_record.rb'
117
+ require_relative 'beaver/models/owner_accounts.rb'
118
+ require_relative 'beaver/models/incoming_payments_req.rb'
119
+ require_relative 'beaver/models/capture_amounts.rb'
120
+ require_relative 'beaver/models/payment_method_for_payments.rb'
121
+ require_relative 'beaver/models/payment_method_req.rb'
122
+ require_relative 'beaver/models/payout_req.rb'
123
+ require_relative 'beaver/models/payout_method_req.rb'
124
+ require_relative 'beaver/models/capabilities_resp.rb'
125
+ require_relative 'beaver/models/item_req.rb'
126
+ require_relative 'beaver/models/refund_req.rb'
127
+ require_relative 'beaver/models/order_req.rb'
128
+ require_relative 'beaver/models/accounts_capabilities_request.rb'
129
+ require_relative 'beaver/models/accounts_request.rb'
130
+ require_relative 'beaver/models/accounts_request1.rb'
131
+ require_relative 'beaver/models/accounts_response.rb'
132
+ require_relative 'beaver/models/additional_representatives.rb'
133
+ require_relative 'beaver/models/additional_representatives1.rb'
134
+ require_relative 'beaver/models/adjustments_request.rb'
135
+ require_relative 'beaver/models/adjustments_response.rb'
136
+ require_relative 'beaver/models/application_block.rb'
137
+ require_relative 'beaver/models/application_block4.rb'
138
+ require_relative 'beaver/models/associated_phone.rb'
139
+ require_relative 'beaver/models/associated_resource.rb'
140
+ require_relative 'beaver/models/balances.rb'
141
+ require_relative 'beaver/models/billing_statements_interchange_fees_response.rb'
142
+ require_relative 'beaver/models/billing_statements_response.rb'
143
+ require_relative 'beaver/models/billing_statements_transactions_summary' \
144
+ '_response.rb'
145
+ require_relative 'beaver/models/buyer.rb'
146
+ require_relative 'beaver/models/ca.rb'
147
+ require_relative 'beaver/models/ca1.rb'
148
+ require_relative 'beaver/models/ca4.rb'
149
+ require_relative 'beaver/models/cad.rb'
150
+ require_relative 'beaver/models/cad1.rb'
151
+ require_relative 'beaver/models/cad2.rb'
152
+ require_relative 'beaver/models/contactless_payments.rb'
153
+ require_relative 'beaver/models/controller.rb'
154
+ require_relative 'beaver/models/controller1.rb'
155
+ require_relative 'beaver/models/credit_card.rb'
156
+ require_relative 'beaver/models/credit_card1.rb'
157
+ require_relative 'beaver/models/credit_card2.rb'
158
+ require_relative 'beaver/models/credit_card4.rb'
159
+ require_relative 'beaver/models/currencies.rb'
160
+ require_relative 'beaver/models/currencies1.rb'
161
+ require_relative 'beaver/models/currencies2.rb'
162
+ require_relative 'beaver/models/currencies3.rb'
163
+ require_relative 'beaver/models/current_issue.rb'
164
+ require_relative 'beaver/models/current_issue2.rb'
165
+ require_relative 'beaver/models/date_of_birth.rb'
166
+ require_relative 'beaver/models/detail.rb'
167
+ require_relative 'beaver/models/detail1.rb'
168
+ require_relative 'beaver/models/detail2.rb'
169
+ require_relative 'beaver/models/detail3.rb'
170
+ require_relative 'beaver/models/detail4.rb'
171
+ require_relative 'beaver/models/detail5.rb'
172
+ require_relative 'beaver/models/detail6.rb'
173
+ require_relative 'beaver/models/detail7.rb'
174
+ require_relative 'beaver/models/detail8.rb'
175
+ require_relative 'beaver/models/detail9.rb'
176
+ require_relative 'beaver/models/detail10.rb'
177
+ require_relative 'beaver/models/disputes_request.rb'
178
+ require_relative 'beaver/models/disputes_response.rb'
179
+ require_relative 'beaver/models/document.rb'
180
+ require_relative 'beaver/models/documentation.rb'
181
+ require_relative 'beaver/models/documentation1.rb'
182
+ require_relative 'beaver/models/embedded_rbit.rb'
183
+ require_relative 'beaver/models/entity_country_info.rb'
184
+ require_relative 'beaver/models/entity_verification.rb'
185
+ require_relative 'beaver/models/entity_verification1.rb'
186
+ require_relative 'beaver/models/flat_guide.rb'
187
+ require_relative 'beaver/models/gb.rb'
188
+ require_relative 'beaver/models/gbp.rb'
189
+ require_relative 'beaver/models/gbp1.rb'
190
+ require_relative 'beaver/models/gbp2.rb'
191
+ require_relative 'beaver/models/industry.rb'
192
+ require_relative 'beaver/models/interchange_plus.rb'
193
+ require_relative 'beaver/models/itemized_receipt.rb'
194
+ require_relative 'beaver/models/items_response.rb'
195
+ require_relative 'beaver/models/legal_entities_request.rb'
196
+ require_relative 'beaver/models/legal_entities_response.rb'
197
+ require_relative 'beaver/models/legal_entities_verifications_request.rb'
198
+ require_relative 'beaver/models/legal_entities_verifications_response.rb'
199
+ require_relative 'beaver/models/line_item.rb'
200
+ require_relative 'beaver/models/line_item1.rb'
201
+ require_relative 'beaver/models/name.rb'
202
+ require_relative 'beaver/models/notification_preferences_request.rb'
203
+ require_relative 'beaver/models/notification_preferences_request1.rb'
204
+ require_relative 'beaver/models/notification_preferences_response.rb'
205
+ require_relative 'beaver/models/notification_preferences_response1.rb'
206
+ require_relative 'beaver/models/notification_preferences_response2.rb'
207
+ require_relative 'beaver/models/notifications_response.rb'
208
+ require_relative 'beaver/models/notifications_response1.rb'
209
+ require_relative 'beaver/models/orders_response.rb'
210
+ require_relative 'beaver/models/owner3.rb'
211
+ require_relative 'beaver/models/owner16.rb'
212
+ require_relative 'beaver/models/owner20.rb'
213
+ require_relative 'beaver/models/payment_methods_request.rb'
214
+ require_relative 'beaver/models/payment_methods_response.rb'
215
+ require_relative 'beaver/models/payment_methods_verify_bank_deposits_request.rb'
216
+ require_relative 'beaver/models/payment_bank.rb'
217
+ require_relative 'beaver/models/payment_bank_us.rb'
218
+ require_relative 'beaver/models/payments.rb'
219
+ require_relative 'beaver/models/payments_cancel_request.rb'
220
+ require_relative 'beaver/models/payments_capture_request.rb'
221
+ require_relative 'beaver/models/payments_request.rb'
222
+ require_relative 'beaver/models/payments_request1.rb'
223
+ require_relative 'beaver/models/payments_response.rb'
224
+ require_relative 'beaver/models/payments1.rb'
225
+ require_relative 'beaver/models/payout_methods_request.rb'
226
+ require_relative 'beaver/models/payout_methods_response.rb'
227
+ require_relative 'beaver/models/payout_bank_ca.rb'
228
+ require_relative 'beaver/models/payout_bank_ca1.rb'
229
+ require_relative 'beaver/models/payout_bank_gb.rb'
230
+ require_relative 'beaver/models/payout_bank_gb1.rb'
231
+ require_relative 'beaver/models/payout_bank_us.rb'
232
+ require_relative 'beaver/models/payout_bank_us1.rb'
233
+ require_relative 'beaver/models/payouts.rb'
234
+ require_relative 'beaver/models/payouts_request.rb'
235
+ require_relative 'beaver/models/payouts_response.rb'
236
+ require_relative 'beaver/models/payouts1.rb'
237
+ require_relative 'beaver/models/percentage_guide.rb'
238
+ require_relative 'beaver/models/personal_country_info.rb'
239
+ require_relative 'beaver/models/personal_country_info1.rb'
240
+ require_relative 'beaver/models/personal_verification.rb'
241
+ require_relative 'beaver/models/personal_verification5.rb'
242
+ require_relative 'beaver/models/phone.rb'
243
+ require_relative 'beaver/models/phone1.rb'
244
+ require_relative 'beaver/models/rbits_request.rb'
245
+ require_relative 'beaver/models/rbits_response.rb'
246
+ require_relative 'beaver/models/rbits_response1.rb'
247
+ require_relative 'beaver/models/reason.rb'
248
+ require_relative 'beaver/models/recoveries_request.rb'
249
+ require_relative 'beaver/models/recoveries_response.rb'
250
+ require_relative 'beaver/models/refunds_request.rb'
251
+ require_relative 'beaver/models/refunds_response.rb'
252
+ require_relative 'beaver/models/reject_reason.rb'
253
+ require_relative 'beaver/models/representative0.rb'
254
+ require_relative 'beaver/models/representative01.rb'
255
+ require_relative 'beaver/models/resolution.rb'
256
+ require_relative 'beaver/models/result.rb'
257
+ require_relative 'beaver/models/result1.rb'
258
+ require_relative 'beaver/models/result2.rb'
259
+ require_relative 'beaver/models/shipping_info.rb'
260
+ require_relative 'beaver/models/shipping_status.rb'
261
+ require_relative 'beaver/models/shipping_status1.rb'
262
+ require_relative 'beaver/models/standard.rb'
263
+ require_relative 'beaver/models/target.rb'
264
+ require_relative 'beaver/models/terminal_configuration.rb'
265
+ require_relative 'beaver/models/terminal_configuration1.rb'
266
+ require_relative 'beaver/models/terminal_configuration2.rb'
267
+ require_relative 'beaver/models/terminal_display.rb'
268
+ require_relative 'beaver/models/terminals_request.rb'
269
+ require_relative 'beaver/models/terminals_request1.rb'
270
+ require_relative 'beaver/models/terminals_response.rb'
271
+ require_relative 'beaver/models/terms_of_service.rb'
272
+ require_relative 'beaver/models/tokens_request.rb'
273
+ require_relative 'beaver/models/tokens_response.rb'
274
+ require_relative 'beaver/models/transaction_records_response.rb'
275
+ require_relative 'beaver/models/upcoming_issue.rb'
276
+ require_relative 'beaver/models/us.rb'
277
+ require_relative 'beaver/models/us1.rb'
278
+ require_relative 'beaver/models/us4.rb'
279
+ require_relative 'beaver/models/usd.rb'
280
+ require_relative 'beaver/models/usd1.rb'
281
+ require_relative 'beaver/models/usd2.rb'
282
+ require_relative 'beaver/models/currency_enum.rb'
283
+ require_relative 'beaver/models/country_code_enum.rb'
284
+ require_relative 'beaver/models/rbit_types_enum.rb'
285
+ require_relative 'beaver/models/rbit_source_enum.rb'
286
+ require_relative 'beaver/models/fee_type_enum.rb'
287
+ require_relative 'beaver/models/resource_legal_entities_enum.rb'
288
+ require_relative 'beaver/models/resource_types_rbit_enum.rb'
289
+ require_relative 'beaver/models/initiated_by_resp_enum.rb'
290
+ require_relative 'beaver/models/resource_payments_enum.rb'
291
+ require_relative 'beaver/models/currency_nullable_enum.rb'
292
+ require_relative 'beaver/models/resource_notifications_enum.rb'
293
+ require_relative 'beaver/models/terminals_status_enum.rb'
294
+ require_relative 'beaver/models/resource_accounts_enum.rb'
295
+ require_relative 'beaver/models/resource_verifications_enum.rb'
296
+ require_relative 'beaver/models/resource_capabilities_enum.rb'
297
+ require_relative 'beaver/models/initiated_by_req_enum.rb'
298
+ require_relative 'beaver/models/account_type_enum.rb'
299
+ require_relative 'beaver/models/address_type_enum.rb'
300
+ require_relative 'beaver/models/amount_guide_type_enum.rb'
301
+ require_relative 'beaver/models/card_brand2_enum.rb'
302
+ require_relative 'beaver/models/card_brand_enum.rb'
303
+ require_relative 'beaver/models/card_entry_type_enum.rb'
304
+ require_relative 'beaver/models/code_type_enum.rb'
305
+ require_relative 'beaver/models/credit_debit_preference_enum.rb'
306
+ require_relative 'beaver/models/credit_debit_preference1_enum.rb'
307
+ require_relative 'beaver/models/delivery_type_enum.rb'
308
+ require_relative 'beaver/models/detail_code_enum.rb'
309
+ require_relative 'beaver/models/detail_code1_enum.rb'
310
+ require_relative 'beaver/models/detail_code2_enum.rb'
311
+ require_relative 'beaver/models/detail_code3_enum.rb'
312
+ require_relative 'beaver/models/detail_code4_enum.rb'
313
+ require_relative 'beaver/models/detail_code5_enum.rb'
314
+ require_relative 'beaver/models/detail_code6_enum.rb'
315
+ require_relative 'beaver/models/detail_code7_enum.rb'
316
+ require_relative 'beaver/models/detail_code8_enum.rb'
317
+ require_relative 'beaver/models/detail_code9_enum.rb'
318
+ require_relative 'beaver/models/detail_code10_enum.rb'
319
+ require_relative 'beaver/models/errant_field_enum.rb'
320
+ require_relative 'beaver/models/issue_type_enum.rb'
321
+ require_relative 'beaver/models/issue_type4_enum.rb'
322
+ require_relative 'beaver/models/legal_form_enum.rb'
323
+ require_relative 'beaver/models/legal_form1_enum.rb'
324
+ require_relative 'beaver/models/mfa_action_enum.rb'
325
+ require_relative 'beaver/models/mode_enum.rb'
326
+ require_relative 'beaver/models/model_enum.rb'
327
+ require_relative 'beaver/models/model1_enum.rb'
328
+ require_relative 'beaver/models/name_type_enum.rb'
329
+ require_relative 'beaver/models/payment_method_type_enum.rb'
330
+ require_relative 'beaver/models/payout_method_type_enum.rb'
331
+ require_relative 'beaver/models/period_enum.rb'
332
+ require_relative 'beaver/models/phone_type_enum.rb'
333
+ require_relative 'beaver/models/reason_code_enum.rb'
334
+ require_relative 'beaver/models/reason_code1_enum.rb'
335
+ require_relative 'beaver/models/reason_code2_enum.rb'
336
+ require_relative 'beaver/models/reason_code3_enum.rb'
337
+ require_relative 'beaver/models/reason_code4_enum.rb'
338
+ require_relative 'beaver/models/reason_code5_enum.rb'
339
+ require_relative 'beaver/models/reason_code6_enum.rb'
340
+ require_relative 'beaver/models/reason_code7_enum.rb'
341
+ require_relative 'beaver/models/reason_code8_enum.rb'
342
+ require_relative 'beaver/models/reason_code9_enum.rb'
343
+ require_relative 'beaver/models/resource_enum.rb'
344
+ require_relative 'beaver/models/resource1_enum.rb'
345
+ require_relative 'beaver/models/resource2_enum.rb'
346
+ require_relative 'beaver/models/role_enum.rb'
347
+ require_relative 'beaver/models/service_billing_method_enum.rb'
348
+ require_relative 'beaver/models/setup_by_enum.rb'
349
+ require_relative 'beaver/models/state_enum.rb'
350
+ require_relative 'beaver/models/status_enum.rb'
351
+ require_relative 'beaver/models/status2_enum.rb'
352
+ require_relative 'beaver/models/status3_enum.rb'
353
+ require_relative 'beaver/models/status4_enum.rb'
354
+ require_relative 'beaver/models/status5_enum.rb'
355
+ require_relative 'beaver/models/status8_enum.rb'
356
+ require_relative 'beaver/models/status20_enum.rb'
357
+ require_relative 'beaver/models/supported_card_entry_mode_enum.rb'
358
+ require_relative 'beaver/models/terminals_supported_card_brand_enum.rb'
359
+ require_relative 'beaver/models/timezone_enum.rb'
360
+ require_relative 'beaver/models/topic_enum.rb'
361
+ require_relative 'beaver/models/topic1_enum.rb'
362
+ require_relative 'beaver/models/type_enum.rb'
363
+ require_relative 'beaver/models/type2_enum.rb'
364
+ require_relative 'beaver/models/type3_enum.rb'
365
+ require_relative 'beaver/models/type4_enum.rb'
366
+ require_relative 'beaver/models/type5_enum.rb'
367
+ require_relative 'beaver/models/type6_enum.rb'
368
+ require_relative 'beaver/models/type7_enum.rb'
369
+ require_relative 'beaver/models/type8_enum.rb'
370
+ require_relative 'beaver/models/type9_enum.rb'
371
+ require_relative 'beaver/models/type12_enum.rb'
372
+ require_relative 'beaver/models/type15_enum.rb'
373
+ require_relative 'beaver/models/type27_enum.rb'
374
+ require_relative 'beaver/models/units_enum.rb'
375
+ require_relative 'beaver/models/virtual_terminal_mode_enum.rb'
376
+
377
+ # Exceptions
378
+ require_relative 'beaver/exceptions/api_exception.rb'
379
+
380
+ require_relative 'beaver/configuration.rb'
381
+
382
+ # Controllers
383
+ require_relative 'beaver/controllers/base_controller.rb'
384
+ require_relative 'beaver/controllers/api_controller.rb'
@@ -0,0 +1,289 @@
1
+ # beaver
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Beaver
7
+ # API utility class
8
+ class APIHelper
9
+ # Serializes an array parameter (creates key value pairs).
10
+ # @param [String] The name of the parameter.
11
+ # @param [Array] The value of the parameter.
12
+ # @param [String] The format of the serialization.
13
+ def self.serialize_array(key, array, formatting: 'indexed')
14
+ tuples = []
15
+
16
+ if formatting == 'unindexed'
17
+ tuples += array.map { |element| ["#{key}[]", element] }
18
+ elsif formatting == 'indexed'
19
+ tuples += array.map.with_index do |element, index|
20
+ ["#{key}[#{index}]", element]
21
+ end
22
+ elsif formatting == 'plain'
23
+ tuples += array.map { |element| [key, element] }
24
+ else
25
+ raise ArgumentError, 'Invalid format provided.'
26
+ end
27
+ tuples
28
+ end
29
+
30
+ # Replaces template parameters in the given url.
31
+ # @param [String] The query string builder to replace the template
32
+ # parameters.
33
+ # @param [Hash] The parameters to replace in the url.
34
+ def self.append_url_with_template_parameters(query_builder, parameters)
35
+ # perform parameter validation
36
+ unless query_builder.instance_of? String
37
+ raise ArgumentError, 'Given value for parameter \"query_builder\" is
38
+ invalid.'
39
+ end
40
+
41
+ # Return if there are no parameters to replace.
42
+ return query_builder if parameters.nil?
43
+
44
+ parameters.each do |key, val|
45
+ if val.nil?
46
+ replace_value = ''
47
+ elsif val['value'].instance_of? Array
48
+ if val['encode'] == true
49
+ val['value'].map! { |element| CGI.escape(element.to_s) }
50
+ else
51
+ val['value'].map!(&:to_s)
52
+ end
53
+ replace_value = val['value'].join('/')
54
+ else
55
+ replace_value = if val['encode'] == true
56
+ CGI.escape(val['value'].to_s)
57
+ else
58
+ val['value'].to_s
59
+ end
60
+ end
61
+
62
+ # Find the template parameter and replace it with its value.
63
+ query_builder = query_builder.gsub('{' + key.to_s + '}', replace_value)
64
+ end
65
+ query_builder
66
+ end
67
+
68
+ # Appends the given set of parameters to the given query string.
69
+ # @param [String] The query string builder to add the query parameters to.
70
+ # @param [Hash] The parameters to append.
71
+ def self.append_url_with_query_parameters(query_builder, parameters)
72
+ # Perform parameter validation.
73
+ unless query_builder.instance_of? String
74
+ raise ArgumentError, 'Given value for parameter \"query_builder\"
75
+ is invalid.'
76
+ end
77
+
78
+ # Return if there are no parameters to replace.
79
+ return query_builder if parameters.nil?
80
+
81
+ array_serialization = 'indexed'
82
+
83
+ parameters.each do |key, value|
84
+ seperator = query_builder.include?('?') ? '&' : '?'
85
+ unless value.nil?
86
+ if value.instance_of? Array
87
+ value.compact!
88
+ query_builder += if array_serialization == 'csv'
89
+ "#{seperator}#{key}=#{value.map do |element|
90
+ CGI.escape(element.to_s)
91
+ end.join(',')}"
92
+ elsif array_serialization == 'psv'
93
+ "#{seperator}#{key}=#{value.map do |element|
94
+ CGI.escape(element.to_s)
95
+ end.join('|')}"
96
+ elsif array_serialization == 'tsv'
97
+ "#{seperator}#{key}=#{value.map do |element|
98
+ CGI.escape(element.to_s)
99
+ end.join("\t")}"
100
+ else
101
+ "#{seperator}#{APIHelper.serialize_array(
102
+ key, value, formatting: array_serialization
103
+ ).map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }
104
+ .join('&')}"
105
+ end
106
+ else
107
+ query_builder += "#{seperator}#{key}=#{CGI.escape(value.to_s)}"
108
+ end
109
+ end
110
+ end
111
+ query_builder
112
+ end
113
+
114
+ # Validates and processes the given Url.
115
+ # @param [String] The given Url to process.
116
+ # @return [String] Pre-processed Url as string.
117
+ def self.clean_url(url)
118
+ # Perform parameter validation.
119
+ raise ArgumentError, 'Invalid Url.' unless url.instance_of? String
120
+
121
+ # Ensure that the urls are absolute.
122
+ matches = url.match(%r{^(https?:\/\/[^\/]+)})
123
+ raise ArgumentError, 'Invalid Url format.' if matches.nil?
124
+
125
+ # Get the http protocol match.
126
+ protocol = matches[1]
127
+
128
+ # Check if parameters exist.
129
+ index = url.index('?')
130
+
131
+ # Remove redundant forward slashes.
132
+ query = url[protocol.length...(!index.nil? ? index : url.length)]
133
+ query.gsub!(%r{\/\/+}, '/')
134
+
135
+ # Get the parameters.
136
+ parameters = !index.nil? ? url[url.index('?')...url.length] : ''
137
+
138
+ # Return processed url.
139
+ protocol + query + parameters
140
+ end
141
+
142
+ # Parses JSON string.
143
+ # @param [String] A JSON string.
144
+ def self.json_deserialize(json)
145
+ return JSON.parse(json)
146
+ rescue StandardError
147
+ raise TypeError, 'Server responded with invalid JSON.'
148
+ end
149
+
150
+ # Removes elements with empty values from a hash.
151
+ # @param [Hash] The hash to clean.
152
+ def self.clean_hash(hash)
153
+ hash.delete_if { |_key, value| value.to_s.strip.empty? }
154
+ end
155
+
156
+ # Form encodes a hash of parameters.
157
+ # @param [Hash] The hash of parameters to encode.
158
+ # @return [Hash] A hash with the same parameters form encoded.
159
+ def self.form_encode_parameters(form_parameters)
160
+ array_serialization = 'indexed'
161
+ encoded = {}
162
+ form_parameters.each do |key, value|
163
+ encoded.merge!(APIHelper.form_encode(value, key, formatting:
164
+ array_serialization))
165
+ end
166
+ encoded
167
+ end
168
+
169
+ def self.custom_merge(a, b)
170
+ x = {}
171
+ a.each do |key, value_a|
172
+ b.each do |k, value_b|
173
+ next unless key == k
174
+ x[k] = []
175
+ if value_a.instance_of? Array
176
+ value_a.each do |v|
177
+ x[k].push(v)
178
+ end
179
+ else
180
+ x[k].push(value_a)
181
+ end
182
+ if value_b.instance_of? Array
183
+ value_b.each do |v|
184
+ x[k].push(v)
185
+ end
186
+ else
187
+ x[k].push(value_b)
188
+ end
189
+ a.delete(k)
190
+ b.delete(k)
191
+ end
192
+ end
193
+ x.merge!(a)
194
+ x.merge!(b)
195
+ x
196
+ end
197
+
198
+ # Form encodes an object.
199
+ # @param [Dynamic] An object to form encode.
200
+ # @param [String] The name of the object.
201
+ # @return [Hash] A form encoded representation of the object in the form
202
+ # of a hash.
203
+ def self.form_encode(obj, instance_name, formatting: 'indexed')
204
+ retval = {}
205
+
206
+ serializable_types = [String, Numeric, TrueClass,
207
+ FalseClass, Date, DateTime]
208
+
209
+ # If this is a structure, resolve it's field names.
210
+ obj = obj.to_hash if obj.is_a? BaseModel
211
+
212
+ # Create a form encoded hash for this object.
213
+ if obj.nil?
214
+ nil
215
+ elsif obj.instance_of? Array
216
+ if formatting == 'indexed'
217
+ obj.each_with_index do |value, index|
218
+ retval.merge!(APIHelper.form_encode(value, instance_name + '[' +
219
+ index.to_s + ']'))
220
+ end
221
+ elsif serializable_types.map { |x| obj[0].is_a? x }.any?
222
+ obj.each do |value|
223
+ abc = if formatting == 'unindexed'
224
+ APIHelper.form_encode(value, instance_name + '[]',
225
+ formatting: formatting)
226
+ else
227
+ APIHelper.form_encode(value, instance_name,
228
+ formatting: formatting)
229
+ end
230
+ retval = APIHelper.custom_merge(retval, abc)
231
+ end
232
+ else
233
+ obj.each_with_index do |value, index|
234
+ retval.merge!(APIHelper.form_encode(value, instance_name + '[' +
235
+ index.to_s + ']', formatting: formatting))
236
+ end
237
+ end
238
+ elsif obj.instance_of? Hash
239
+ obj.each do |key, value|
240
+ retval.merge!(APIHelper.form_encode(value, instance_name + '[' +
241
+ key.to_s + ']', formatting: formatting))
242
+ end
243
+ elsif obj.instance_of? File
244
+ retval[instance_name] = UploadIO.new(
245
+ obj, 'application/octet-stream', File.basename(obj.path)
246
+ )
247
+ else
248
+ retval[instance_name] = obj
249
+ end
250
+ retval
251
+ end
252
+
253
+ # Retrieves a field from a Hash/Array based on an Array of keys/indexes
254
+ # @param [Hash, Array] The hash to extract data from
255
+ # @param [Array<String, Integer>] The keys/indexes to use
256
+ # @return [Object] The extracted value
257
+ def self.map_response(obj, keys)
258
+ val = obj
259
+ begin
260
+ keys.each do |key|
261
+ val = if val.is_a? Array
262
+ if key.to_i.to_s == key
263
+ val[key.to_i]
264
+ else
265
+ val = nil
266
+ end
267
+ else
268
+ val.fetch(key.to_sym)
269
+ end
270
+ end
271
+ rescue NoMethodError, TypeError, IndexError
272
+ val = nil
273
+ end
274
+ val
275
+ end
276
+
277
+ # Safely converts a string into an rfc3339 DateTime object
278
+ # @param [String] The datetime string
279
+ # @return [DateTime] A DateTime object of rfc3339 format
280
+ def self.rfc3339(date_time)
281
+ # missing timezone information
282
+ if date_time.end_with?('Z') || date_time.index('+')
283
+ DateTime.rfc3339(date_time)
284
+ else
285
+ DateTime.rfc3339(date_time + 'Z')
286
+ end
287
+ end
288
+ end
289
+ end