digital_femsa 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (359) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +77 -0
  3. data/CONTRIBUTING.md +19 -0
  4. data/Gemfile +9 -0
  5. data/LICENSE +22 -0
  6. data/Makefile +11 -0
  7. data/README.md +320 -0
  8. data/Rakefile +10 -0
  9. data/VERSION +1 -0
  10. data/config-ruby.json +30 -0
  11. data/digital_femsa.gemspec +41 -0
  12. data/docs/ApiKeyCreateResponse.md +40 -0
  13. data/docs/ApiKeyRequest.md +20 -0
  14. data/docs/ApiKeyResponse.md +38 -0
  15. data/docs/ApiKeyResponseOnDelete.md +34 -0
  16. data/docs/ApiKeyUpdateRequest.md +20 -0
  17. data/docs/ApiKeysApi.md +391 -0
  18. data/docs/BalanceCommonField.md +20 -0
  19. data/docs/BalanceResponse.md +36 -0
  20. data/docs/BalancesApi.md +79 -0
  21. data/docs/ChargeOrderResponse.md +52 -0
  22. data/docs/ChargeOrderResponsePaymentMethod.md +76 -0
  23. data/docs/ChargeRequest.md +22 -0
  24. data/docs/ChargeRequestPaymentMethod.md +22 -0
  25. data/docs/ChargeResponse.md +52 -0
  26. data/docs/ChargeResponseChannel.md +24 -0
  27. data/docs/ChargeResponsePaymentMethod.md +76 -0
  28. data/docs/ChargeResponseRefunds.md +26 -0
  29. data/docs/ChargeResponseRefundsData.md +30 -0
  30. data/docs/ChargeUpdateRequest.md +18 -0
  31. data/docs/ChargesApi.md +241 -0
  32. data/docs/ChargesDataResponse.md +52 -0
  33. data/docs/Checkout.md +34 -0
  34. data/docs/CheckoutOrderTemplate.md +24 -0
  35. data/docs/CheckoutOrderTemplateCustomerInfo.md +49 -0
  36. data/docs/CheckoutRequest.md +30 -0
  37. data/docs/CheckoutResponse.md +58 -0
  38. data/docs/CheckoutsResponse.md +26 -0
  39. data/docs/CompaniesApi.md +159 -0
  40. data/docs/CompanyFiscalInfoAddressResponse.md +34 -0
  41. data/docs/CompanyFiscalInfoResponse.md +30 -0
  42. data/docs/CompanyPayoutDestinationResponse.md +28 -0
  43. data/docs/CompanyResponse.md +32 -0
  44. data/docs/CreateCustomerFiscalEntitiesResponse.md +38 -0
  45. data/docs/CreateCustomerPaymentMethodsRequest.md +47 -0
  46. data/docs/CreateCustomerPaymentMethodsResponse.md +77 -0
  47. data/docs/Customer.md +40 -0
  48. data/docs/CustomerAddress.md +32 -0
  49. data/docs/CustomerAntifraudInfo.md +20 -0
  50. data/docs/CustomerAntifraudInfoResponse.md +20 -0
  51. data/docs/CustomerFiscalEntitiesDataResponse.md +38 -0
  52. data/docs/CustomerFiscalEntitiesRequest.md +28 -0
  53. data/docs/CustomerFiscalEntitiesResponse.md +22 -0
  54. data/docs/CustomerInfo.md +26 -0
  55. data/docs/CustomerInfoJustCustomerId.md +18 -0
  56. data/docs/CustomerInfoJustCustomerIdResponse.md +18 -0
  57. data/docs/CustomerPaymentMethodRequest.md +18 -0
  58. data/docs/CustomerPaymentMethodsData.md +77 -0
  59. data/docs/CustomerPaymentMethodsRequest.md +47 -0
  60. data/docs/CustomerPaymentMethodsResponse.md +26 -0
  61. data/docs/CustomerResponse.md +50 -0
  62. data/docs/CustomerResponseShippingContacts.md +22 -0
  63. data/docs/CustomerShippingContacts.md +32 -0
  64. data/docs/CustomerShippingContactsAddress.md +30 -0
  65. data/docs/CustomerShippingContactsDataResponse.md +38 -0
  66. data/docs/CustomerShippingContactsResponse.md +38 -0
  67. data/docs/CustomerShippingContactsResponseAddress.md +32 -0
  68. data/docs/CustomerUpdateFiscalEntitiesRequest.md +28 -0
  69. data/docs/CustomerUpdateShippingContacts.md +30 -0
  70. data/docs/CustomersApi.md +553 -0
  71. data/docs/CustomersResponse.md +26 -0
  72. data/docs/DeleteApiKeysResponse.md +34 -0
  73. data/docs/Details.md +18 -0
  74. data/docs/DetailsError.md +24 -0
  75. data/docs/DiscountLinesDataResponse.md +28 -0
  76. data/docs/DiscountLinesResponse.md +28 -0
  77. data/docs/DiscountsApi.md +405 -0
  78. data/docs/EmailCheckoutRequest.md +18 -0
  79. data/docs/Error.md +24 -0
  80. data/docs/EventResponse.md +32 -0
  81. data/docs/EventsApi.md +239 -0
  82. data/docs/EventsResendResponse.md +28 -0
  83. data/docs/FiscalEntityAddress.md +30 -0
  84. data/docs/GetApiKeysResponse.md +26 -0
  85. data/docs/GetChargesResponse.md +26 -0
  86. data/docs/GetCompaniesResponse.md +26 -0
  87. data/docs/GetCustomerPaymentMethodDataResponse.md +77 -0
  88. data/docs/GetEventsResponse.md +26 -0
  89. data/docs/GetOrderDiscountLinesResponse.md +26 -0
  90. data/docs/GetOrdersResponse.md +26 -0
  91. data/docs/GetPaymentMethodResponse.md +26 -0
  92. data/docs/GetTransactionsResponse.md +26 -0
  93. data/docs/GetTransfersResponse.md +26 -0
  94. data/docs/GetWebhookKeysResponse.md +26 -0
  95. data/docs/GetWebhooksResponse.md +26 -0
  96. data/docs/LogResponse.md +56 -0
  97. data/docs/LogsApi.md +165 -0
  98. data/docs/LogsResponse.md +26 -0
  99. data/docs/LogsResponseData.md +56 -0
  100. data/docs/OrderCaptureRequest.md +18 -0
  101. data/docs/OrderCustomerInfoResponse.md +28 -0
  102. data/docs/OrderDiscountLinesRequest.md +22 -0
  103. data/docs/OrderFiscalEntityAddressResponse.md +32 -0
  104. data/docs/OrderFiscalEntityRequest.md +28 -0
  105. data/docs/OrderFiscalEntityResponse.md +34 -0
  106. data/docs/OrderNextActionResponse.md +20 -0
  107. data/docs/OrderNextActionResponseRedirectToUrl.md +20 -0
  108. data/docs/OrderRefundRequest.md +22 -0
  109. data/docs/OrderRequest.md +44 -0
  110. data/docs/OrderRequestCustomerInfo.md +49 -0
  111. data/docs/OrderResponse.md +58 -0
  112. data/docs/OrderResponseCharges.md +22 -0
  113. data/docs/OrderResponseCheckout.md +58 -0
  114. data/docs/OrderResponseCustomerInfo.md +30 -0
  115. data/docs/OrderResponseDiscountLines.md +22 -0
  116. data/docs/OrderResponseProducts.md +26 -0
  117. data/docs/OrderResponseShippingContact.md +38 -0
  118. data/docs/OrderTaxRequest.md +22 -0
  119. data/docs/OrderUpdateFiscalEntityRequest.md +28 -0
  120. data/docs/OrderUpdateRequest.md +40 -0
  121. data/docs/OrderUpdateRequestCustomerInfo.md +49 -0
  122. data/docs/OrdersApi.md +627 -0
  123. data/docs/OrdersResponse.md +18 -0
  124. data/docs/Page.md +20 -0
  125. data/docs/Pagination.md +20 -0
  126. data/docs/PaymentLinkApi.md +463 -0
  127. data/docs/PaymentMethod.md +20 -0
  128. data/docs/PaymentMethodCash.md +36 -0
  129. data/docs/PaymentMethodCashRequest.md +20 -0
  130. data/docs/PaymentMethodCashResponse.md +36 -0
  131. data/docs/PaymentMethodResponse.md +26 -0
  132. data/docs/PaymentMethodsApi.md +327 -0
  133. data/docs/Product.md +34 -0
  134. data/docs/ProductDataResponse.md +40 -0
  135. data/docs/ProductOrderResponse.md +40 -0
  136. data/docs/ProductsApi.md +243 -0
  137. data/docs/ShippingContactsApi.md +243 -0
  138. data/docs/ShippingOrderResponse.md +32 -0
  139. data/docs/ShippingRequest.md +26 -0
  140. data/docs/ShippingsApi.md +243 -0
  141. data/docs/SmsCheckoutRequest.md +18 -0
  142. data/docs/TaxesApi.md +243 -0
  143. data/docs/TransactionResponse.md +38 -0
  144. data/docs/TransactionsApi.md +171 -0
  145. data/docs/TransferDestinationResponse.md +32 -0
  146. data/docs/TransferMethodResponse.md +32 -0
  147. data/docs/TransferResponse.md +36 -0
  148. data/docs/TransfersApi.md +165 -0
  149. data/docs/TransfersResponse.md +36 -0
  150. data/docs/UpdateCustomer.md +40 -0
  151. data/docs/UpdateCustomerAntifraudInfo.md +20 -0
  152. data/docs/UpdateCustomerFiscalEntitiesResponse.md +38 -0
  153. data/docs/UpdateCustomerPaymentMethodsResponse.md +77 -0
  154. data/docs/UpdateOrderDiscountLinesRequest.md +22 -0
  155. data/docs/UpdateOrderTaxRequest.md +22 -0
  156. data/docs/UpdateOrderTaxResponse.md +28 -0
  157. data/docs/UpdatePaymentMethods.md +18 -0
  158. data/docs/UpdateProduct.md +34 -0
  159. data/docs/WebhookKeyCreateResponse.md +28 -0
  160. data/docs/WebhookKeyDeleteResponse.md +28 -0
  161. data/docs/WebhookKeyRequest.md +18 -0
  162. data/docs/WebhookKeyResponse.md +30 -0
  163. data/docs/WebhookKeyUpdateRequest.md +18 -0
  164. data/docs/WebhookKeysApi.md +385 -0
  165. data/docs/WebhookLog.md +30 -0
  166. data/docs/WebhookRequest.md +20 -0
  167. data/docs/WebhookResponse.md +36 -0
  168. data/docs/WebhookUpdateRequest.md +22 -0
  169. data/docs/WebhooksApi.md +461 -0
  170. data/gitleaks.toml +0 -0
  171. data/lib/digital_femsa/api/api_keys_api.rb +407 -0
  172. data/lib/digital_femsa/api/balances_api.rb +86 -0
  173. data/lib/digital_femsa/api/charges_api.rb +273 -0
  174. data/lib/digital_femsa/api/companies_api.rb +174 -0
  175. data/lib/digital_femsa/api/customers_api.rb +591 -0
  176. data/lib/digital_femsa/api/discounts_api.rb +447 -0
  177. data/lib/digital_femsa/api/events_api.rb +256 -0
  178. data/lib/digital_femsa/api/logs_api.rb +182 -0
  179. data/lib/digital_femsa/api/orders_api.rb +657 -0
  180. data/lib/digital_femsa/api/payment_link_api.rb +491 -0
  181. data/lib/digital_femsa/api/payment_methods_api.rb +368 -0
  182. data/lib/digital_femsa/api/products_api.rb +275 -0
  183. data/lib/digital_femsa/api/shipping_contacts_api.rb +275 -0
  184. data/lib/digital_femsa/api/shippings_api.rb +275 -0
  185. data/lib/digital_femsa/api/taxes_api.rb +275 -0
  186. data/lib/digital_femsa/api/transactions_api.rb +191 -0
  187. data/lib/digital_femsa/api/transfers_api.rb +182 -0
  188. data/lib/digital_femsa/api/webhook_keys_api.rb +396 -0
  189. data/lib/digital_femsa/api/webhooks_api.rb +477 -0
  190. data/lib/digital_femsa/api_client.rb +442 -0
  191. data/lib/digital_femsa/api_error.rb +58 -0
  192. data/lib/digital_femsa/configuration.rb +382 -0
  193. data/lib/digital_femsa/models/api_key_create_response.rb +333 -0
  194. data/lib/digital_femsa/models/api_key_request.rb +231 -0
  195. data/lib/digital_femsa/models/api_key_response.rb +317 -0
  196. data/lib/digital_femsa/models/api_key_response_on_delete.rb +296 -0
  197. data/lib/digital_femsa/models/api_key_update_request.rb +225 -0
  198. data/lib/digital_femsa/models/balance_common_field.rb +226 -0
  199. data/lib/digital_femsa/models/balance_response.rb +324 -0
  200. data/lib/digital_femsa/models/charge_order_response.rb +373 -0
  201. data/lib/digital_femsa/models/charge_order_response_payment_method.rb +53 -0
  202. data/lib/digital_femsa/models/charge_request.rb +241 -0
  203. data/lib/digital_femsa/models/charge_request_payment_method.rb +241 -0
  204. data/lib/digital_femsa/models/charge_response.rb +371 -0
  205. data/lib/digital_femsa/models/charge_response_channel.rb +241 -0
  206. data/lib/digital_femsa/models/charge_response_payment_method.rb +53 -0
  207. data/lib/digital_femsa/models/charge_response_refunds.rb +281 -0
  208. data/lib/digital_femsa/models/charge_response_refunds_data.rb +298 -0
  209. data/lib/digital_femsa/models/charge_update_request.rb +216 -0
  210. data/lib/digital_femsa/models/charges_data_response.rb +378 -0
  211. data/lib/digital_femsa/models/checkout.rb +340 -0
  212. data/lib/digital_femsa/models/checkout_order_template.rb +301 -0
  213. data/lib/digital_femsa/models/checkout_order_template_customer_info.rb +106 -0
  214. data/lib/digital_femsa/models/checkout_request.rb +284 -0
  215. data/lib/digital_femsa/models/checkout_response.rb +429 -0
  216. data/lib/digital_femsa/models/checkouts_response.rb +280 -0
  217. data/lib/digital_femsa/models/company_fiscal_info_address_response.rb +330 -0
  218. data/lib/digital_femsa/models/company_fiscal_info_response.rb +309 -0
  219. data/lib/digital_femsa/models/company_payout_destination_response.rb +312 -0
  220. data/lib/digital_femsa/models/company_response.rb +318 -0
  221. data/lib/digital_femsa/models/create_customer_fiscal_entities_response.rb +341 -0
  222. data/lib/digital_femsa/models/create_customer_payment_methods_request.rb +105 -0
  223. data/lib/digital_femsa/models/create_customer_payment_methods_response.rb +54 -0
  224. data/lib/digital_femsa/models/customer.rb +374 -0
  225. data/lib/digital_femsa/models/customer_address.rb +301 -0
  226. data/lib/digital_femsa/models/customer_antifraud_info.rb +223 -0
  227. data/lib/digital_femsa/models/customer_antifraud_info_response.rb +223 -0
  228. data/lib/digital_femsa/models/customer_fiscal_entities_data_response.rb +341 -0
  229. data/lib/digital_femsa/models/customer_fiscal_entities_request.rb +268 -0
  230. data/lib/digital_femsa/models/customer_fiscal_entities_response.rb +257 -0
  231. data/lib/digital_femsa/models/customer_info.rb +271 -0
  232. data/lib/digital_femsa/models/customer_info_just_customer_id.rb +221 -0
  233. data/lib/digital_femsa/models/customer_info_just_customer_id_response.rb +214 -0
  234. data/lib/digital_femsa/models/customer_payment_method_request.rb +223 -0
  235. data/lib/digital_femsa/models/customer_payment_methods_data.rb +54 -0
  236. data/lib/digital_femsa/models/customer_payment_methods_request.rb +104 -0
  237. data/lib/digital_femsa/models/customer_payment_methods_response.rb +280 -0
  238. data/lib/digital_femsa/models/customer_response.rb +425 -0
  239. data/lib/digital_femsa/models/customer_response_shipping_contacts.rb +257 -0
  240. data/lib/digital_femsa/models/customer_shipping_contacts.rb +312 -0
  241. data/lib/digital_femsa/models/customer_shipping_contacts_address.rb +271 -0
  242. data/lib/digital_femsa/models/customer_shipping_contacts_data_response.rb +366 -0
  243. data/lib/digital_femsa/models/customer_shipping_contacts_response.rb +328 -0
  244. data/lib/digital_femsa/models/customer_shipping_contacts_response_address.rb +278 -0
  245. data/lib/digital_femsa/models/customer_update_fiscal_entities_request.rb +261 -0
  246. data/lib/digital_femsa/models/customer_update_shipping_contacts.rb +274 -0
  247. data/lib/digital_femsa/models/customers_response.rb +280 -0
  248. data/lib/digital_femsa/models/delete_api_keys_response.rb +301 -0
  249. data/lib/digital_femsa/models/details.rb +216 -0
  250. data/lib/digital_femsa/models/details_error.rb +242 -0
  251. data/lib/digital_femsa/models/discount_lines_data_response.rb +333 -0
  252. data/lib/digital_femsa/models/discount_lines_response.rb +333 -0
  253. data/lib/digital_femsa/models/email_checkout_request.rb +221 -0
  254. data/lib/digital_femsa/models/error.rb +253 -0
  255. data/lib/digital_femsa/models/event_response.rb +301 -0
  256. data/lib/digital_femsa/models/events_resend_response.rb +281 -0
  257. data/lib/digital_femsa/models/fiscal_entity_address.rb +312 -0
  258. data/lib/digital_femsa/models/get_api_keys_response.rb +280 -0
  259. data/lib/digital_femsa/models/get_charges_response.rb +280 -0
  260. data/lib/digital_femsa/models/get_companies_response.rb +280 -0
  261. data/lib/digital_femsa/models/get_customer_payment_method_data_response.rb +54 -0
  262. data/lib/digital_femsa/models/get_events_response.rb +280 -0
  263. data/lib/digital_femsa/models/get_order_discount_lines_response.rb +280 -0
  264. data/lib/digital_femsa/models/get_orders_response.rb +288 -0
  265. data/lib/digital_femsa/models/get_payment_method_response.rb +280 -0
  266. data/lib/digital_femsa/models/get_transactions_response.rb +281 -0
  267. data/lib/digital_femsa/models/get_transfers_response.rb +281 -0
  268. data/lib/digital_femsa/models/get_webhook_keys_response.rb +280 -0
  269. data/lib/digital_femsa/models/get_webhooks_response.rb +280 -0
  270. data/lib/digital_femsa/models/log_response.rb +418 -0
  271. data/lib/digital_femsa/models/logs_response.rb +261 -0
  272. data/lib/digital_femsa/models/logs_response_data.rb +396 -0
  273. data/lib/digital_femsa/models/order_capture_request.rb +241 -0
  274. data/lib/digital_femsa/models/order_customer_info_response.rb +263 -0
  275. data/lib/digital_femsa/models/order_discount_lines_request.rb +276 -0
  276. data/lib/digital_femsa/models/order_fiscal_entity_address_response.rb +328 -0
  277. data/lib/digital_femsa/models/order_fiscal_entity_request.rb +295 -0
  278. data/lib/digital_femsa/models/order_fiscal_entity_response.rb +347 -0
  279. data/lib/digital_femsa/models/order_next_action_response.rb +225 -0
  280. data/lib/digital_femsa/models/order_next_action_response_redirect_to_url.rb +226 -0
  281. data/lib/digital_femsa/models/order_refund_request.rb +247 -0
  282. data/lib/digital_femsa/models/order_request.rb +413 -0
  283. data/lib/digital_femsa/models/order_request_customer_info.rb +106 -0
  284. data/lib/digital_femsa/models/order_response.rb +427 -0
  285. data/lib/digital_femsa/models/order_response_charges.rb +258 -0
  286. data/lib/digital_femsa/models/order_response_checkout.rb +418 -0
  287. data/lib/digital_femsa/models/order_response_customer_info.rb +280 -0
  288. data/lib/digital_femsa/models/order_response_discount_lines.rb +257 -0
  289. data/lib/digital_femsa/models/order_response_products.rb +280 -0
  290. data/lib/digital_femsa/models/order_response_shipping_contact.rb +334 -0
  291. data/lib/digital_femsa/models/order_tax_request.rb +308 -0
  292. data/lib/digital_femsa/models/order_update_fiscal_entity_request.rb +295 -0
  293. data/lib/digital_femsa/models/order_update_request.rb +352 -0
  294. data/lib/digital_femsa/models/order_update_request_customer_info.rb +105 -0
  295. data/lib/digital_femsa/models/orders_response.rb +223 -0
  296. data/lib/digital_femsa/models/page.rb +228 -0
  297. data/lib/digital_femsa/models/pagination.rb +240 -0
  298. data/lib/digital_femsa/models/payment_method.rb +230 -0
  299. data/lib/digital_femsa/models/payment_method_cash.rb +312 -0
  300. data/lib/digital_femsa/models/payment_method_cash_request.rb +238 -0
  301. data/lib/digital_femsa/models/payment_method_cash_response.rb +330 -0
  302. data/lib/digital_femsa/models/payment_method_response.rb +278 -0
  303. data/lib/digital_femsa/models/product.rb +397 -0
  304. data/lib/digital_femsa/models/product_data_response.rb +431 -0
  305. data/lib/digital_femsa/models/product_order_response.rb +431 -0
  306. data/lib/digital_femsa/models/shipping_order_response.rb +336 -0
  307. data/lib/digital_femsa/models/shipping_request.rb +302 -0
  308. data/lib/digital_femsa/models/sms_checkout_request.rb +221 -0
  309. data/lib/digital_femsa/models/transaction_response.rb +412 -0
  310. data/lib/digital_femsa/models/transfer_destination_response.rb +286 -0
  311. data/lib/digital_femsa/models/transfer_method_response.rb +286 -0
  312. data/lib/digital_femsa/models/transfer_response.rb +324 -0
  313. data/lib/digital_femsa/models/transfers_response.rb +324 -0
  314. data/lib/digital_femsa/models/update_customer.rb +353 -0
  315. data/lib/digital_femsa/models/update_customer_antifraud_info.rb +223 -0
  316. data/lib/digital_femsa/models/update_customer_fiscal_entities_response.rb +341 -0
  317. data/lib/digital_femsa/models/update_customer_payment_methods_response.rb +54 -0
  318. data/lib/digital_femsa/models/update_order_discount_lines_request.rb +253 -0
  319. data/lib/digital_femsa/models/update_order_tax_request.rb +294 -0
  320. data/lib/digital_femsa/models/update_order_tax_response.rb +349 -0
  321. data/lib/digital_femsa/models/update_payment_methods.rb +214 -0
  322. data/lib/digital_femsa/models/update_product.rb +349 -0
  323. data/lib/digital_femsa/models/webhook_key_create_response.rb +266 -0
  324. data/lib/digital_femsa/models/webhook_key_delete_response.rb +266 -0
  325. data/lib/digital_femsa/models/webhook_key_request.rb +217 -0
  326. data/lib/digital_femsa/models/webhook_key_response.rb +277 -0
  327. data/lib/digital_femsa/models/webhook_key_update_request.rb +217 -0
  328. data/lib/digital_femsa/models/webhook_log.rb +289 -0
  329. data/lib/digital_femsa/models/webhook_request.rb +261 -0
  330. data/lib/digital_femsa/models/webhook_response.rb +299 -0
  331. data/lib/digital_femsa/models/webhook_update_request.rb +267 -0
  332. data/lib/digital_femsa/version.rb +15 -0
  333. data/lib/digital_femsa.rb +197 -0
  334. data/lib/ssl_data/ca_bundle.crt +4039 -0
  335. data/spec/api/api_keys_api_spec.rb +107 -0
  336. data/spec/api/balances_api_spec.rb +47 -0
  337. data/spec/api/charges_api_spec.rb +80 -0
  338. data/spec/api/companies_api_spec.rb +63 -0
  339. data/spec/api/customers_api_spec.rb +140 -0
  340. data/spec/api/discounts_api_spec.rb +114 -0
  341. data/spec/api/events_api_spec.rb +79 -0
  342. data/spec/api/logs_api_spec.rb +66 -0
  343. data/spec/api/orders_api_spec.rb +153 -0
  344. data/spec/api/payment_link_api_spec.rb +119 -0
  345. data/spec/api/payment_methods_api_spec.rb +99 -0
  346. data/spec/api/products_api_spec.rb +81 -0
  347. data/spec/api/shipping_contacts_api_spec.rb +81 -0
  348. data/spec/api/shippings_api_spec.rb +81 -0
  349. data/spec/api/taxes_api_spec.rb +81 -0
  350. data/spec/api/transactions_api_spec.rb +69 -0
  351. data/spec/api/transfers_api_spec.rb +66 -0
  352. data/spec/api/webhook_keys_api_spec.rb +104 -0
  353. data/spec/api/webhooks_api_spec.rb +118 -0
  354. data/spec/spec_helper.rb +111 -0
  355. data/ssl_data/ca_bundle.crt +4039 -0
  356. data/templates/ruby/CUSTOM_VERSION.mustache +1 -0
  357. data/templates/ruby/api_client.mustache +257 -0
  358. data/templates/ruby/configuration.mustache +481 -0
  359. metadata +488 -0
@@ -0,0 +1,481 @@
1
+ =begin
2
+ {{> api_info}}
3
+ =end
4
+
5
+ module {{moduleName}}
6
+ class Configuration
7
+ # Defines url scheme
8
+ attr_accessor :scheme
9
+
10
+ # Defines url host
11
+ attr_accessor :host
12
+
13
+ # Defines url base path
14
+ attr_accessor :base_path
15
+
16
+ # Define server configuration index
17
+ attr_accessor :server_index
18
+
19
+ # Define server operation configuration index
20
+ attr_accessor :server_operation_index
21
+
22
+ # Default server variables
23
+ attr_accessor :server_variables
24
+
25
+ # Default server operation variables
26
+ attr_accessor :server_operation_variables
27
+
28
+ # Defines API keys used with API Key authentications.
29
+ #
30
+ # @return [Hash] key: parameter name, value: parameter value (API key)
31
+ #
32
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
33
+ # config.api_key['api_key'] = 'xxx'
34
+ attr_accessor :api_key
35
+
36
+ # Defines API key prefixes used with API Key authentications.
37
+ #
38
+ # @return [Hash] key: parameter name, value: API key prefix
39
+ #
40
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
41
+ # config.api_key_prefix['api_key'] = 'Token'
42
+ attr_accessor :api_key_prefix
43
+
44
+ # Defines the username used with HTTP basic authentication.
45
+ #
46
+ # @return [String]
47
+ attr_accessor :username
48
+
49
+ # Defines the password used with HTTP basic authentication.
50
+ #
51
+ # @return [String]
52
+ attr_accessor :password
53
+
54
+ # Defines the access token (Bearer) used with OAuth2.
55
+ attr_accessor :access_token
56
+
57
+ # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2.
58
+ # Overrides the access_token if set
59
+ # @return [Proc]
60
+ attr_accessor :access_token_getter
61
+
62
+ # Set this to return data as binary instead of downloading a temp file. When enabled (set to true)
63
+ # HTTP responses with return type `File` will be returned as a stream of binary data.
64
+ # Default to false.
65
+ attr_accessor :return_binary_data
66
+
67
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
68
+ # details will be logged with `logger.debug` (see the `logger` attribute).
69
+ # Default to false.
70
+ #
71
+ # @return [true, false]
72
+ attr_accessor :debugging
73
+
74
+ # Defines the logger used for debugging.
75
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
76
+ #
77
+ # @return [#debug]
78
+ attr_accessor :logger
79
+
80
+ # Defines the temporary folder to store downloaded files
81
+ # (for API endpoints that have file response).
82
+ # Default to use `Tempfile`.
83
+ #
84
+ # @return [String]
85
+ attr_accessor :temp_folder_path
86
+
87
+ # The time limit for HTTP request in seconds.
88
+ # Default to 0 (never times out).
89
+ attr_accessor :timeout
90
+
91
+ # Set this to false to skip client side validation in the operation.
92
+ # Default to true.
93
+ # @return [true, false]
94
+ attr_accessor :client_side_validation
95
+
96
+ {{#isTyphoeus}}
97
+ {{> configuration_typhoeus_partial}}
98
+ {{/isTyphoeus}}
99
+ {{#isFaraday}}
100
+ {{> configuration_faraday_partial}}
101
+ {{/isFaraday}}
102
+ {{#isHttpx}}
103
+ {{> configuration_httpx_partial}}
104
+ {{/isHttpx}}
105
+
106
+ attr_accessor :inject_format
107
+
108
+ attr_accessor :force_ending_format
109
+
110
+ def initialize
111
+ @scheme = '{{scheme}}'
112
+ @host = '{{host}}{{#port}}:{{{.}}}{{/port}}'
113
+ @base_path = '{{contextPath}}'
114
+ @server_index = nil
115
+ @server_operation_index = {}
116
+ @server_variables = {}
117
+ @server_operation_variables = {}
118
+ @api_key = {}
119
+ @api_key_prefix = {}
120
+ @client_side_validation = true
121
+ {{#isFaraday}}
122
+ @ssl_verify = true
123
+ @ssl_verify_mode = nil
124
+ @ssl_ca_file = File.dirname(__FILE__) + '/../ssl_data/ca_bundle.crt'
125
+ @ssl_client_cert = nil
126
+ @ssl_client_key = nil
127
+ @middlewares = Hash.new { |h, k| h[k] = [] }
128
+ @configure_connection_blocks = []
129
+ @timeout = 60
130
+ # return data as binary instead of file
131
+ @return_binary_data = false
132
+ @params_encoder = nil
133
+ {{/isFaraday}}
134
+ {{#isTyphoeus}}
135
+ @verify_ssl = true
136
+ @verify_ssl_host = true
137
+ @cert_file = nil
138
+ @key_file = nil
139
+ @timeout = 0
140
+ @params_encoding = nil
141
+ {{/isTyphoeus}}
142
+ {{#isHttpx}}
143
+ @ssl = nil
144
+ @proxy = nil
145
+ @timeout = 60
146
+ @configure_session_blocks = []
147
+ {{/isHttpx}}
148
+ @debugging = false
149
+ @inject_format = false
150
+ @force_ending_format = false
151
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
152
+
153
+ yield(self) if block_given?
154
+ end
155
+
156
+ # The default Configuration object.
157
+ def self.default
158
+ @@default ||= Configuration.new
159
+ end
160
+
161
+ def configure
162
+ yield(self) if block_given?
163
+ end
164
+
165
+ def scheme=(scheme)
166
+ # remove :// from scheme
167
+ @scheme = scheme.sub(/:\/\//, '')
168
+ end
169
+
170
+ def host=(host)
171
+ # remove http(s):// and anything after a slash
172
+ @host = host.sub(/https?:\/\//, '').split('/').first
173
+ end
174
+
175
+ def base_path=(base_path)
176
+ # Add leading and trailing slashes to base_path
177
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
178
+ @base_path = '' if @base_path == '/'
179
+ end
180
+
181
+ # Returns base URL for specified operation based on server settings
182
+ def base_url(operation = nil)
183
+ if operation_server_settings.key?(operation) then
184
+ index = server_operation_index.fetch(operation, server_index)
185
+ server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
186
+ else
187
+ server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil)
188
+ end
189
+ end
190
+
191
+ # Gets API key (with prefix if set).
192
+ # @param [String] param_name the parameter name of API key auth
193
+ def api_key_with_prefix(param_name, param_alias = nil)
194
+ key = @api_key[param_name]
195
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
196
+ if @api_key_prefix[param_name]
197
+ "#{@api_key_prefix[param_name]} #{key}"
198
+ else
199
+ key
200
+ end
201
+ end
202
+
203
+ # Gets access_token using access_token_getter or uses the static access_token
204
+ def access_token_with_refresh
205
+ return access_token if access_token_getter.nil?
206
+ access_token_getter.call
207
+ end
208
+
209
+ # Gets Basic Auth token string
210
+ def basic_auth_token
211
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
212
+ end
213
+
214
+ # Returns Auth Settings hash for api client.
215
+ def auth_settings
216
+ {
217
+ {{#authMethods}}
218
+ {{#isApiKey}}
219
+ '{{name}}' =>
220
+ {
221
+ type: 'api_key',
222
+ in: {{#isKeyInHeader}}'header'{{/isKeyInHeader}}{{#isKeyInQuery}}'query'{{/isKeyInQuery}},
223
+ key: '{{keyParamName}}',
224
+ value: api_key_with_prefix('{{name}}'{{#vendorExtensions.x-auth-id-alias}}, '{{.}}'{{/vendorExtensions.x-auth-id-alias}})
225
+ },
226
+ {{/isApiKey}}
227
+ {{#isBasic}}
228
+ {{#isBasicBasic}}
229
+ '{{name}}' =>
230
+ {
231
+ type: 'basic',
232
+ in: 'header',
233
+ key: 'Authorization',
234
+ value: basic_auth_token
235
+ },
236
+ {{/isBasicBasic}}
237
+ {{#isBasicBearer}}
238
+ '{{name}}' =>
239
+ {
240
+ type: 'bearer',
241
+ in: 'header',
242
+ {{#bearerFormat}}
243
+ format: '{{{.}}}',
244
+ {{/bearerFormat}}
245
+ key: 'Authorization',
246
+ value: "Bearer #{access_token_with_refresh}"
247
+ },
248
+ {{/isBasicBearer}}
249
+ {{/isBasic}}
250
+ {{#isOAuth}}
251
+ '{{name}}' =>
252
+ {
253
+ type: 'oauth2',
254
+ in: 'header',
255
+ key: 'Authorization',
256
+ value: "Bearer #{access_token_with_refresh}"
257
+ },
258
+ {{/isOAuth}}
259
+ {{/authMethods}}
260
+ }
261
+ end
262
+
263
+ # Returns an array of Server setting
264
+ def server_settings
265
+ [
266
+ {{#servers}}
267
+ {
268
+ url: "{{{url}}}",
269
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
270
+ {{#variables}}
271
+ {{#-first}}
272
+ variables: {
273
+ {{/-first}}
274
+ {{{name}}}: {
275
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
276
+ default_value: "{{{defaultValue}}}",
277
+ {{#enumValues}}
278
+ {{#-first}}
279
+ enum_values: [
280
+ {{/-first}}
281
+ "{{{.}}}"{{^-last}},{{/-last}}
282
+ {{#-last}}
283
+ ]
284
+ {{/-last}}
285
+ {{/enumValues}}
286
+ }{{^-last}},{{/-last}}
287
+ {{#-last}}
288
+ }
289
+ {{/-last}}
290
+ {{/variables}}
291
+ }{{^-last}},{{/-last}}
292
+ {{/servers}}
293
+ ]
294
+ end
295
+
296
+ def operation_server_settings
297
+ {
298
+ {{#apiInfo}}
299
+ {{#apis}}
300
+ {{#operations}}
301
+ {{#operation}}
302
+ {{#servers}}
303
+ {{#-first}}
304
+ "{{{classname}}}.{{{nickname}}}": [
305
+ {{/-first}}
306
+ {
307
+ url: "{{{url}}}",
308
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
309
+ {{#variables}}
310
+ {{#-first}}
311
+ variables: {
312
+ {{/-first}}
313
+ {{{name}}}: {
314
+ description: "{{{description}}}{{^description}}No description provided{{/description}}",
315
+ default_value: "{{{defaultValue}}}",
316
+ {{#enumValues}}
317
+ {{#-first}}
318
+ enum_values: [
319
+ {{/-first}}
320
+ "{{{.}}}"{{^-last}},{{/-last}}
321
+ {{#-last}}
322
+ ]
323
+ {{/-last}}
324
+ {{/enumValues}}
325
+ }{{^-last}},{{/-last}}
326
+ {{#-last}}
327
+ }
328
+ {{/-last}}
329
+ {{/variables}}
330
+ }{{^-last}},{{/-last}}
331
+ {{#-last}}
332
+ ],
333
+ {{/-last}}
334
+ {{/servers}}
335
+ {{/operation}}
336
+ {{/operations}}
337
+ {{/apis}}
338
+ {{/apiInfo}}
339
+ }
340
+ end
341
+
342
+ # Returns URL based on server settings
343
+ #
344
+ # @param index array index of the server settings
345
+ # @param variables hash of variable and the corresponding value
346
+ def server_url(index, variables = {}, servers = nil)
347
+ servers = server_settings if servers == nil
348
+
349
+ # check array index out of bound
350
+ if (index.nil? || index < 0 || index >= servers.size)
351
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}"
352
+ end
353
+
354
+ server = servers[index]
355
+ url = server[:url]
356
+
357
+ return url unless server.key? :variables
358
+
359
+ # go through variable and assign a value
360
+ server[:variables].each do |name, variable|
361
+ if variables.key?(name)
362
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
363
+ url.gsub! "{" + name.to_s + "}", variables[name]
364
+ else
365
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
366
+ end
367
+ else
368
+ # use default value
369
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
370
+ end
371
+ end
372
+
373
+ url
374
+ end
375
+
376
+ {{#isFaraday}}
377
+ # Configure Faraday connection directly.
378
+ #
379
+ # ```
380
+ # c.configure_faraday_connection do |conn|
381
+ # conn.use Faraday::HttpCache, shared_cache: false, logger: logger
382
+ # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger|
383
+ # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]')
384
+ # end
385
+ # end
386
+ #
387
+ # c.configure_faraday_connection do |conn|
388
+ # conn.adapter :typhoeus
389
+ # end
390
+ # ```
391
+ #
392
+ # @param block [Proc] `#call`able object that takes one arg, the connection
393
+ def configure_faraday_connection(&block)
394
+ @configure_connection_blocks << block
395
+ end
396
+
397
+ def configure_connection(conn)
398
+ @configure_connection_blocks.each do |block|
399
+ block.call(conn)
400
+ end
401
+ end
402
+
403
+ # Adds middleware to the stack
404
+ def use(*middleware)
405
+ set_faraday_middleware(:use, *middleware)
406
+ end
407
+
408
+ # Adds request middleware to the stack
409
+ def request(*middleware)
410
+ set_faraday_middleware(:request, *middleware)
411
+ end
412
+
413
+ # Adds response middleware to the stack
414
+ def response(*middleware)
415
+ set_faraday_middleware(:response, *middleware)
416
+ end
417
+
418
+ # Adds Faraday middleware setting information to the stack
419
+ #
420
+ # @example Use the `set_faraday_middleware` method to set middleware information
421
+ # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503])
422
+ # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug })
423
+ # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false)
424
+ # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 })
425
+ # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger)
426
+ # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware)
427
+ #
428
+ # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143
429
+ def set_faraday_middleware(operation, key, *args, &block)
430
+ unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation)
431
+ fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \
432
+ " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete."
433
+ end
434
+
435
+ @middlewares[operation] << [key, args, block]
436
+ end
437
+ ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true)
438
+
439
+ # Set up middleware on the connection
440
+ def configure_middleware(connection)
441
+ return if @middlewares.empty?
442
+
443
+ [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation|
444
+ next unless @middlewares.key?(operation)
445
+
446
+ @middlewares[operation].each do |key, args, block|
447
+ connection.builder.send(operation, key, *args, &block)
448
+ end
449
+ end
450
+
451
+ if @middlewares.key?(:delete)
452
+ @middlewares[:delete].each do |key, _args, _block|
453
+ connection.builder.delete(key)
454
+ end
455
+ end
456
+ end
457
+ {{/isFaraday}}
458
+
459
+ {{#isHttpx}}
460
+ # Configure Httpx session directly.
461
+ #
462
+ # ```
463
+ # c.configure_session do |http|
464
+ # http.plugin(:follow_redirects).with(debug: STDOUT, debug_level: 1)
465
+ # end
466
+ # ```
467
+ #
468
+ # @param block [Proc] `#call`able object that takes one arg, the connection
469
+ def configure_session(&block)
470
+ @configure_session_blocks << block
471
+ end
472
+
473
+
474
+ def configure(session)
475
+ @configure_session_blocks.reduce(session) do |configured_sess, block|
476
+ block.call(configured_sess)
477
+ end
478
+ end
479
+ {{/isHttpx}}
480
+ end
481
+ end