payjpv2 1.0.2

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 (430) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +33 -0
  3. data/.github/workflows/release.yml +46 -0
  4. data/.gitignore +39 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +111 -0
  7. data/Gemfile +9 -0
  8. data/Gemfile.lock +94 -0
  9. data/README.md +399 -0
  10. data/Rakefile +10 -0
  11. data/docs/ApplePayConfigRequest.md +18 -0
  12. data/docs/BalanceListResponse.md +24 -0
  13. data/docs/BalanceResponse.md +40 -0
  14. data/docs/BalanceState.md +15 -0
  15. data/docs/BalanceURLResponse.md +22 -0
  16. data/docs/BalancesApi.md +235 -0
  17. data/docs/BankInfoResponse.md +28 -0
  18. data/docs/CaptureMethod.md +15 -0
  19. data/docs/CardConfigRequest.md +18 -0
  20. data/docs/CheckoutSessionCreateRequest.md +52 -0
  21. data/docs/CheckoutSessionCustomerDetailsAddressResponse.md +28 -0
  22. data/docs/CheckoutSessionCustomerDetailsResponse.md +24 -0
  23. data/docs/CheckoutSessionDetailsResponse.md +66 -0
  24. data/docs/CheckoutSessionLineItemDataResponse.md +34 -0
  25. data/docs/CheckoutSessionLineItemListResponse.md +24 -0
  26. data/docs/CheckoutSessionListResponse.md +24 -0
  27. data/docs/CheckoutSessionMode.md +15 -0
  28. data/docs/CheckoutSessionPaymentMethodOptionsCardRequest.md +20 -0
  29. data/docs/CheckoutSessionPaymentMethodOptionsRequest.md +18 -0
  30. data/docs/CheckoutSessionStatus.md +15 -0
  31. data/docs/CheckoutSessionSubmitType.md +15 -0
  32. data/docs/CheckoutSessionUIMode.md +15 -0
  33. data/docs/CheckoutSessionUpdateRequest.md +18 -0
  34. data/docs/CheckoutSessionsApi.md +373 -0
  35. data/docs/Country.md +15 -0
  36. data/docs/Currency.md +15 -0
  37. data/docs/CustomerCreateRequest.md +26 -0
  38. data/docs/CustomerCreation.md +15 -0
  39. data/docs/CustomerListResponse.md +24 -0
  40. data/docs/CustomerResponse.md +34 -0
  41. data/docs/CustomerUpdateRequest.md +24 -0
  42. data/docs/CustomersApi.md +443 -0
  43. data/docs/DisplayPreferenceRequest.md +18 -0
  44. data/docs/ErrorResponse.md +28 -0
  45. data/docs/EventListResponse.md +24 -0
  46. data/docs/EventResponse.md +32 -0
  47. data/docs/EventsApi.md +159 -0
  48. data/docs/LineItemRequest.md +22 -0
  49. data/docs/Locale.md +15 -0
  50. data/docs/MetadataValue.md +15 -0
  51. data/docs/PayPayConfigRequest.md +18 -0
  52. data/docs/PaymentDisputeListResponse.md +24 -0
  53. data/docs/PaymentDisputeReason.md +15 -0
  54. data/docs/PaymentDisputeResponse.md +42 -0
  55. data/docs/PaymentDisputeStatus.md +15 -0
  56. data/docs/PaymentDisputesApi.md +157 -0
  57. data/docs/PaymentFlowCancelRequest.md +18 -0
  58. data/docs/PaymentFlowCancellationReason.md +15 -0
  59. data/docs/PaymentFlowCaptureRequest.md +18 -0
  60. data/docs/PaymentFlowConfirmRequest.md +28 -0
  61. data/docs/PaymentFlowCreateRequest.md +38 -0
  62. data/docs/PaymentFlowDataRequest.md +22 -0
  63. data/docs/PaymentFlowListResponse.md +24 -0
  64. data/docs/PaymentFlowPaymentMethodOptionsCardRequest.md +20 -0
  65. data/docs/PaymentFlowPaymentMethodOptionsRequest.md +18 -0
  66. data/docs/PaymentFlowResponse.md +62 -0
  67. data/docs/PaymentFlowStatus.md +15 -0
  68. data/docs/PaymentFlowUpdateRequest.md +32 -0
  69. data/docs/PaymentFlowsApi.md +599 -0
  70. data/docs/PaymentMethodApplePayCreateRequest.md +26 -0
  71. data/docs/PaymentMethodApplePayUpdateRequest.md +22 -0
  72. data/docs/PaymentMethodAttachRequest.md +18 -0
  73. data/docs/PaymentMethodBillingAddressRequest.md +28 -0
  74. data/docs/PaymentMethodBillingAddressResponse.md +28 -0
  75. data/docs/PaymentMethodBillingDetailsRequest.md +24 -0
  76. data/docs/PaymentMethodBillingDetailsResponse.md +24 -0
  77. data/docs/PaymentMethodCardBillingDetailsRequest.md +24 -0
  78. data/docs/PaymentMethodCardCreateRequest.md +26 -0
  79. data/docs/PaymentMethodCardDetailsResponse.md +28 -0
  80. data/docs/PaymentMethodCardResponse.md +38 -0
  81. data/docs/PaymentMethodCardUpdateRequest.md +22 -0
  82. data/docs/PaymentMethodConfigurationDetailsResponse.md +32 -0
  83. data/docs/PaymentMethodConfigurationDisplayPreference.md +20 -0
  84. data/docs/PaymentMethodConfigurationListResponse.md +24 -0
  85. data/docs/PaymentMethodConfigurationSettingResponse.md +20 -0
  86. data/docs/PaymentMethodConfigurationUpdateRequest.md +26 -0
  87. data/docs/PaymentMethodConfigurationsApi.md +225 -0
  88. data/docs/PaymentMethodCreateCardDetailsRequest.md +24 -0
  89. data/docs/PaymentMethodCreateRequest.md +82 -0
  90. data/docs/PaymentMethodListResponse.md +24 -0
  91. data/docs/PaymentMethodPayPayCreateRequest.md +24 -0
  92. data/docs/PaymentMethodPayPayResponse.md +36 -0
  93. data/docs/PaymentMethodPayPayUpdateRequest.md +22 -0
  94. data/docs/PaymentMethodResponse.md +38 -0
  95. data/docs/PaymentMethodTypes.md +15 -0
  96. data/docs/PaymentMethodUpdateRequest.md +82 -0
  97. data/docs/PaymentMethodsApi.md +507 -0
  98. data/docs/PaymentRefundCreateRequest.md +24 -0
  99. data/docs/PaymentRefundListResponse.md +24 -0
  100. data/docs/PaymentRefundReason.md +15 -0
  101. data/docs/PaymentRefundResponse.md +36 -0
  102. data/docs/PaymentRefundStatus.md +15 -0
  103. data/docs/PaymentRefundUpdateRequest.md +18 -0
  104. data/docs/PaymentRefundsApi.md +295 -0
  105. data/docs/PaymentTransactionListResponse.md +24 -0
  106. data/docs/PaymentTransactionResponse.md +42 -0
  107. data/docs/PaymentTransactionType.md +15 -0
  108. data/docs/PaymentTransactionsApi.md +159 -0
  109. data/docs/PriceCreateRequest.md +32 -0
  110. data/docs/PriceDetailsResponse.md +42 -0
  111. data/docs/PriceListResponse.md +24 -0
  112. data/docs/PriceType.md +15 -0
  113. data/docs/PriceUpdateRequest.md +24 -0
  114. data/docs/PricesApi.md +297 -0
  115. data/docs/ProductCreateRequest.md +28 -0
  116. data/docs/ProductDeletedResponse.md +22 -0
  117. data/docs/ProductDetailsResponse.md +32 -0
  118. data/docs/ProductListResponse.md +24 -0
  119. data/docs/ProductUpdateRequest.md +28 -0
  120. data/docs/ProductsApi.md +365 -0
  121. data/docs/SetupFlowCancelRequest.md +18 -0
  122. data/docs/SetupFlowCancellationReason.md +15 -0
  123. data/docs/SetupFlowCreateRequest.md +28 -0
  124. data/docs/SetupFlowDataRequest.md +20 -0
  125. data/docs/SetupFlowListResponse.md +24 -0
  126. data/docs/SetupFlowPaymentMethodOptionsCardRequest.md +18 -0
  127. data/docs/SetupFlowPaymentMethodOptionsRequest.md +18 -0
  128. data/docs/SetupFlowResponse.md +50 -0
  129. data/docs/SetupFlowStatus.md +15 -0
  130. data/docs/SetupFlowUpdateRequest.md +26 -0
  131. data/docs/SetupFlowsApi.md +371 -0
  132. data/docs/StatementItemResponse.md +24 -0
  133. data/docs/StatementListResponse.md +24 -0
  134. data/docs/StatementResponse.md +38 -0
  135. data/docs/StatementSubject.md +15 -0
  136. data/docs/StatementType.md +15 -0
  137. data/docs/StatementURLResponse.md +22 -0
  138. data/docs/StatementsApi.md +231 -0
  139. data/docs/TaxRateCreateRequest.md +30 -0
  140. data/docs/TaxRateDetailsResponse.md +34 -0
  141. data/docs/TaxRateListResponse.md +24 -0
  142. data/docs/TaxRateUpdateRequest.md +26 -0
  143. data/docs/TaxRatesApi.md +295 -0
  144. data/docs/TermListResponse.md +24 -0
  145. data/docs/TermResponse.md +28 -0
  146. data/docs/TermsApi.md +157 -0
  147. data/docs/Usage.md +15 -0
  148. data/example.rb +157 -0
  149. data/lib/payjpv2/api/balances_api.rb +223 -0
  150. data/lib/payjpv2/api/checkout_sessions_api.rb +360 -0
  151. data/lib/payjpv2/api/customers_api.rb +420 -0
  152. data/lib/payjpv2/api/events_api.rb +157 -0
  153. data/lib/payjpv2/api/payment_disputes_api.rb +155 -0
  154. data/lib/payjpv2/api/payment_flows_api.rb +561 -0
  155. data/lib/payjpv2/api/payment_method_configurations_api.rb +221 -0
  156. data/lib/payjpv2/api/payment_methods_api.rb +476 -0
  157. data/lib/payjpv2/api/payment_refunds_api.rb +286 -0
  158. data/lib/payjpv2/api/payment_transactions_api.rb +157 -0
  159. data/lib/payjpv2/api/prices_api.rb +288 -0
  160. data/lib/payjpv2/api/products_api.rb +346 -0
  161. data/lib/payjpv2/api/setup_flows_api.rb +348 -0
  162. data/lib/payjpv2/api/statements_api.rb +219 -0
  163. data/lib/payjpv2/api/tax_rates_api.rb +286 -0
  164. data/lib/payjpv2/api/terms_api.rb +155 -0
  165. data/lib/payjpv2/api_client.rb +410 -0
  166. data/lib/payjpv2/api_error.rb +58 -0
  167. data/lib/payjpv2/configuration.rb +315 -0
  168. data/lib/payjpv2/models/apple_pay_config_request.rb +206 -0
  169. data/lib/payjpv2/models/balance_list_response.rb +306 -0
  170. data/lib/payjpv2/models/balance_response.rb +453 -0
  171. data/lib/payjpv2/models/balance_state.rb +41 -0
  172. data/lib/payjpv2/models/balance_url_response.rb +283 -0
  173. data/lib/payjpv2/models/bank_info_response.rb +328 -0
  174. data/lib/payjpv2/models/capture_method.rb +40 -0
  175. data/lib/payjpv2/models/card_config_request.rb +206 -0
  176. data/lib/payjpv2/models/checkout_session_create_request.rb +430 -0
  177. data/lib/payjpv2/models/checkout_session_customer_details_address_response.rb +269 -0
  178. data/lib/payjpv2/models/checkout_session_customer_details_response.rb +245 -0
  179. data/lib/payjpv2/models/checkout_session_details_response.rb +627 -0
  180. data/lib/payjpv2/models/checkout_session_line_item_data_response.rb +405 -0
  181. data/lib/payjpv2/models/checkout_session_line_item_list_response.rb +306 -0
  182. data/lib/payjpv2/models/checkout_session_list_response.rb +306 -0
  183. data/lib/payjpv2/models/checkout_session_mode.rb +40 -0
  184. data/lib/payjpv2/models/checkout_session_payment_method_options_card_request.rb +258 -0
  185. data/lib/payjpv2/models/checkout_session_payment_method_options_request.rb +206 -0
  186. data/lib/payjpv2/models/checkout_session_status.rb +41 -0
  187. data/lib/payjpv2/models/checkout_session_submit_type.rb +42 -0
  188. data/lib/payjpv2/models/checkout_session_ui_mode.rb +39 -0
  189. data/lib/payjpv2/models/checkout_session_update_request.rb +208 -0
  190. data/lib/payjpv2/models/country.rb +39 -0
  191. data/lib/payjpv2/models/currency.rb +39 -0
  192. data/lib/payjpv2/models/customer_create_request.rb +295 -0
  193. data/lib/payjpv2/models/customer_creation.rb +40 -0
  194. data/lib/payjpv2/models/customer_list_response.rb +306 -0
  195. data/lib/payjpv2/models/customer_response.rb +387 -0
  196. data/lib/payjpv2/models/customer_update_request.rb +266 -0
  197. data/lib/payjpv2/models/display_preference_request.rb +240 -0
  198. data/lib/payjpv2/models/error_response.rb +291 -0
  199. data/lib/payjpv2/models/event_list_response.rb +307 -0
  200. data/lib/payjpv2/models/event_response.rb +395 -0
  201. data/lib/payjpv2/models/line_item_request.rb +252 -0
  202. data/lib/payjpv2/models/locale.rb +40 -0
  203. data/lib/payjpv2/models/metadata_value.rb +105 -0
  204. data/lib/payjpv2/models/pay_pay_config_request.rb +206 -0
  205. data/lib/payjpv2/models/payment_dispute_list_response.rb +307 -0
  206. data/lib/payjpv2/models/payment_dispute_reason.rb +53 -0
  207. data/lib/payjpv2/models/payment_dispute_response.rb +485 -0
  208. data/lib/payjpv2/models/payment_dispute_status.rb +46 -0
  209. data/lib/payjpv2/models/payment_flow_cancel_request.rb +238 -0
  210. data/lib/payjpv2/models/payment_flow_cancellation_reason.rb +46 -0
  211. data/lib/payjpv2/models/payment_flow_capture_request.rb +224 -0
  212. data/lib/payjpv2/models/payment_flow_confirm_request.rb +280 -0
  213. data/lib/payjpv2/models/payment_flow_create_request.rb +366 -0
  214. data/lib/payjpv2/models/payment_flow_data_request.rb +250 -0
  215. data/lib/payjpv2/models/payment_flow_list_response.rb +307 -0
  216. data/lib/payjpv2/models/payment_flow_payment_method_options_card_request.rb +258 -0
  217. data/lib/payjpv2/models/payment_flow_payment_method_options_request.rb +206 -0
  218. data/lib/payjpv2/models/payment_flow_response.rb +623 -0
  219. data/lib/payjpv2/models/payment_flow_status.rb +45 -0
  220. data/lib/payjpv2/models/payment_flow_update_request.rb +298 -0
  221. data/lib/payjpv2/models/payment_method_apple_pay_create_request.rb +294 -0
  222. data/lib/payjpv2/models/payment_method_apple_pay_update_request.rb +262 -0
  223. data/lib/payjpv2/models/payment_method_attach_request.rb +218 -0
  224. data/lib/payjpv2/models/payment_method_billing_address_request.rb +256 -0
  225. data/lib/payjpv2/models/payment_method_billing_address_response.rb +268 -0
  226. data/lib/payjpv2/models/payment_method_billing_details_request.rb +236 -0
  227. data/lib/payjpv2/models/payment_method_billing_details_response.rb +254 -0
  228. data/lib/payjpv2/models/payment_method_card_billing_details_request.rb +237 -0
  229. data/lib/payjpv2/models/payment_method_card_create_request.rb +306 -0
  230. data/lib/payjpv2/models/payment_method_card_details_response.rb +318 -0
  231. data/lib/payjpv2/models/payment_method_card_response.rb +440 -0
  232. data/lib/payjpv2/models/payment_method_card_update_request.rb +262 -0
  233. data/lib/payjpv2/models/payment_method_configuration_details_response.rb +383 -0
  234. data/lib/payjpv2/models/payment_method_configuration_display_preference.rb +258 -0
  235. data/lib/payjpv2/models/payment_method_configuration_list_response.rb +306 -0
  236. data/lib/payjpv2/models/payment_method_configuration_setting_response.rb +216 -0
  237. data/lib/payjpv2/models/payment_method_configuration_update_request.rb +246 -0
  238. data/lib/payjpv2/models/payment_method_create_card_details_request.rb +310 -0
  239. data/lib/payjpv2/models/payment_method_create_request.rb +57 -0
  240. data/lib/payjpv2/models/payment_method_list_response.rb +306 -0
  241. data/lib/payjpv2/models/payment_method_pay_pay_create_request.rb +272 -0
  242. data/lib/payjpv2/models/payment_method_pay_pay_response.rb +418 -0
  243. data/lib/payjpv2/models/payment_method_pay_pay_update_request.rb +262 -0
  244. data/lib/payjpv2/models/payment_method_response.rb +104 -0
  245. data/lib/payjpv2/models/payment_method_types.rb +41 -0
  246. data/lib/payjpv2/models/payment_method_update_request.rb +57 -0
  247. data/lib/payjpv2/models/payment_refund_create_request.rb +286 -0
  248. data/lib/payjpv2/models/payment_refund_list_response.rb +307 -0
  249. data/lib/payjpv2/models/payment_refund_reason.rb +41 -0
  250. data/lib/payjpv2/models/payment_refund_response.rb +429 -0
  251. data/lib/payjpv2/models/payment_refund_status.rb +43 -0
  252. data/lib/payjpv2/models/payment_refund_update_request.rb +208 -0
  253. data/lib/payjpv2/models/payment_transaction_list_response.rb +307 -0
  254. data/lib/payjpv2/models/payment_transaction_response.rb +508 -0
  255. data/lib/payjpv2/models/payment_transaction_type.rb +42 -0
  256. data/lib/payjpv2/models/price_create_request.rb +342 -0
  257. data/lib/payjpv2/models/price_details_response.rb +485 -0
  258. data/lib/payjpv2/models/price_list_response.rb +306 -0
  259. data/lib/payjpv2/models/price_type.rb +39 -0
  260. data/lib/payjpv2/models/price_update_request.rb +238 -0
  261. data/lib/payjpv2/models/product_create_request.rb +270 -0
  262. data/lib/payjpv2/models/product_deleted_response.rb +273 -0
  263. data/lib/payjpv2/models/product_details_response.rb +353 -0
  264. data/lib/payjpv2/models/product_list_response.rb +306 -0
  265. data/lib/payjpv2/models/product_update_request.rb +256 -0
  266. data/lib/payjpv2/models/setup_flow_cancel_request.rb +228 -0
  267. data/lib/payjpv2/models/setup_flow_cancellation_reason.rb +41 -0
  268. data/lib/payjpv2/models/setup_flow_create_request.rb +282 -0
  269. data/lib/payjpv2/models/setup_flow_data_request.rb +218 -0
  270. data/lib/payjpv2/models/setup_flow_list_response.rb +306 -0
  271. data/lib/payjpv2/models/setup_flow_payment_method_options_card_request.rb +238 -0
  272. data/lib/payjpv2/models/setup_flow_payment_method_options_request.rb +206 -0
  273. data/lib/payjpv2/models/setup_flow_response.rb +521 -0
  274. data/lib/payjpv2/models/setup_flow_status.rb +44 -0
  275. data/lib/payjpv2/models/setup_flow_update_request.rb +272 -0
  276. data/lib/payjpv2/models/statement_item_response.rb +297 -0
  277. data/lib/payjpv2/models/statement_list_response.rb +306 -0
  278. data/lib/payjpv2/models/statement_response.rb +431 -0
  279. data/lib/payjpv2/models/statement_subject.rb +55 -0
  280. data/lib/payjpv2/models/statement_type.rb +43 -0
  281. data/lib/payjpv2/models/statement_url_response.rb +283 -0
  282. data/lib/payjpv2/models/tax_rate_create_request.rb +336 -0
  283. data/lib/payjpv2/models/tax_rate_details_response.rb +397 -0
  284. data/lib/payjpv2/models/tax_rate_list_response.rb +306 -0
  285. data/lib/payjpv2/models/tax_rate_update_request.rb +270 -0
  286. data/lib/payjpv2/models/term_list_response.rb +306 -0
  287. data/lib/payjpv2/models/term_response.rb +349 -0
  288. data/lib/payjpv2/models/usage.rb +40 -0
  289. data/lib/payjpv2/version.rb +15 -0
  290. data/lib/payjpv2.rb +176 -0
  291. data/payjpv2.gemspec +45 -0
  292. data/spec/api/balances_api_spec.rb +142 -0
  293. data/spec/api/checkout_sessions_api_spec.rb +206 -0
  294. data/spec/api/customers_api_spec.rb +239 -0
  295. data/spec/api/events_api_spec.rb +106 -0
  296. data/spec/api/payment_disputes_api_spec.rb +105 -0
  297. data/spec/api/payment_flows_api_spec.rb +310 -0
  298. data/spec/api/payment_method_configurations_api_spec.rb +137 -0
  299. data/spec/api/payment_methods_api_spec.rb +270 -0
  300. data/spec/api/payment_refunds_api_spec.rb +170 -0
  301. data/spec/api/payment_transactions_api_spec.rb +106 -0
  302. data/spec/api/prices_api_spec.rb +171 -0
  303. data/spec/api/products_api_spec.rb +203 -0
  304. data/spec/api/setup_flows_api_spec.rb +204 -0
  305. data/spec/api/statements_api_spec.rb +140 -0
  306. data/spec/api/tax_rates_api_spec.rb +170 -0
  307. data/spec/api/terms_api_spec.rb +105 -0
  308. data/spec/models/apple_pay_config_request_spec.rb +36 -0
  309. data/spec/models/balance_list_response_spec.rb +58 -0
  310. data/spec/models/balance_response_spec.rb +106 -0
  311. data/spec/models/balance_state_spec.rb +30 -0
  312. data/spec/models/balance_url_response_spec.rb +52 -0
  313. data/spec/models/bank_info_response_spec.rb +66 -0
  314. data/spec/models/capture_method_spec.rb +30 -0
  315. data/spec/models/card_config_request_spec.rb +36 -0
  316. data/spec/models/checkout_session_create_request_spec.rb +138 -0
  317. data/spec/models/checkout_session_customer_details_address_response_spec.rb +66 -0
  318. data/spec/models/checkout_session_customer_details_response_spec.rb +54 -0
  319. data/spec/models/checkout_session_details_response_spec.rb +184 -0
  320. data/spec/models/checkout_session_line_item_data_response_spec.rb +88 -0
  321. data/spec/models/checkout_session_line_item_list_response_spec.rb +58 -0
  322. data/spec/models/checkout_session_list_response_spec.rb +58 -0
  323. data/spec/models/checkout_session_mode_spec.rb +30 -0
  324. data/spec/models/checkout_session_payment_method_options_card_request_spec.rb +50 -0
  325. data/spec/models/checkout_session_payment_method_options_request_spec.rb +36 -0
  326. data/spec/models/checkout_session_status_spec.rb +30 -0
  327. data/spec/models/checkout_session_submit_type_spec.rb +30 -0
  328. data/spec/models/checkout_session_ui_mode_spec.rb +30 -0
  329. data/spec/models/checkout_session_update_request_spec.rb +36 -0
  330. data/spec/models/country_spec.rb +30 -0
  331. data/spec/models/currency_spec.rb +30 -0
  332. data/spec/models/customer_create_request_spec.rb +60 -0
  333. data/spec/models/customer_creation_spec.rb +30 -0
  334. data/spec/models/customer_list_response_spec.rb +58 -0
  335. data/spec/models/customer_response_spec.rb +88 -0
  336. data/spec/models/customer_update_request_spec.rb +54 -0
  337. data/spec/models/display_preference_request_spec.rb +40 -0
  338. data/spec/models/error_response_spec.rb +66 -0
  339. data/spec/models/event_list_response_spec.rb +58 -0
  340. data/spec/models/event_response_spec.rb +82 -0
  341. data/spec/models/line_item_request_spec.rb +48 -0
  342. data/spec/models/locale_spec.rb +30 -0
  343. data/spec/models/metadata_value_spec.rb +21 -0
  344. data/spec/models/pay_pay_config_request_spec.rb +36 -0
  345. data/spec/models/payment_dispute_list_response_spec.rb +58 -0
  346. data/spec/models/payment_dispute_reason_spec.rb +30 -0
  347. data/spec/models/payment_dispute_response_spec.rb +112 -0
  348. data/spec/models/payment_dispute_status_spec.rb +30 -0
  349. data/spec/models/payment_flow_cancel_request_spec.rb +40 -0
  350. data/spec/models/payment_flow_cancellation_reason_spec.rb +30 -0
  351. data/spec/models/payment_flow_capture_request_spec.rb +36 -0
  352. data/spec/models/payment_flow_confirm_request_spec.rb +66 -0
  353. data/spec/models/payment_flow_create_request_spec.rb +96 -0
  354. data/spec/models/payment_flow_data_request_spec.rb +48 -0
  355. data/spec/models/payment_flow_list_response_spec.rb +58 -0
  356. data/spec/models/payment_flow_payment_method_options_card_request_spec.rb +50 -0
  357. data/spec/models/payment_flow_payment_method_options_request_spec.rb +36 -0
  358. data/spec/models/payment_flow_response_spec.rb +172 -0
  359. data/spec/models/payment_flow_status_spec.rb +30 -0
  360. data/spec/models/payment_flow_update_request_spec.rb +78 -0
  361. data/spec/models/payment_method_apple_pay_create_request_spec.rb +64 -0
  362. data/spec/models/payment_method_apple_pay_update_request_spec.rb +52 -0
  363. data/spec/models/payment_method_attach_request_spec.rb +36 -0
  364. data/spec/models/payment_method_billing_address_request_spec.rb +66 -0
  365. data/spec/models/payment_method_billing_address_response_spec.rb +66 -0
  366. data/spec/models/payment_method_billing_details_request_spec.rb +54 -0
  367. data/spec/models/payment_method_billing_details_response_spec.rb +54 -0
  368. data/spec/models/payment_method_card_billing_details_request_spec.rb +54 -0
  369. data/spec/models/payment_method_card_create_request_spec.rb +64 -0
  370. data/spec/models/payment_method_card_details_response_spec.rb +66 -0
  371. data/spec/models/payment_method_card_response_spec.rb +104 -0
  372. data/spec/models/payment_method_card_update_request_spec.rb +52 -0
  373. data/spec/models/payment_method_configuration_details_response_spec.rb +82 -0
  374. data/spec/models/payment_method_configuration_display_preference_spec.rb +50 -0
  375. data/spec/models/payment_method_configuration_list_response_spec.rb +58 -0
  376. data/spec/models/payment_method_configuration_setting_response_spec.rb +42 -0
  377. data/spec/models/payment_method_configuration_update_request_spec.rb +60 -0
  378. data/spec/models/payment_method_create_card_details_request_spec.rb +54 -0
  379. data/spec/models/payment_method_create_request_spec.rb +44 -0
  380. data/spec/models/payment_method_list_response_spec.rb +58 -0
  381. data/spec/models/payment_method_pay_pay_create_request_spec.rb +58 -0
  382. data/spec/models/payment_method_pay_pay_response_spec.rb +98 -0
  383. data/spec/models/payment_method_pay_pay_update_request_spec.rb +52 -0
  384. data/spec/models/payment_method_response_spec.rb +21 -0
  385. data/spec/models/payment_method_types_spec.rb +30 -0
  386. data/spec/models/payment_method_update_request_spec.rb +44 -0
  387. data/spec/models/payment_refund_create_request_spec.rb +54 -0
  388. data/spec/models/payment_refund_list_response_spec.rb +58 -0
  389. data/spec/models/payment_refund_reason_spec.rb +30 -0
  390. data/spec/models/payment_refund_response_spec.rb +94 -0
  391. data/spec/models/payment_refund_status_spec.rb +30 -0
  392. data/spec/models/payment_refund_update_request_spec.rb +36 -0
  393. data/spec/models/payment_transaction_list_response_spec.rb +58 -0
  394. data/spec/models/payment_transaction_response_spec.rb +112 -0
  395. data/spec/models/payment_transaction_type_spec.rb +30 -0
  396. data/spec/models/price_create_request_spec.rb +78 -0
  397. data/spec/models/price_details_response_spec.rb +112 -0
  398. data/spec/models/price_list_response_spec.rb +58 -0
  399. data/spec/models/price_type_spec.rb +30 -0
  400. data/spec/models/price_update_request_spec.rb +54 -0
  401. data/spec/models/product_create_request_spec.rb +66 -0
  402. data/spec/models/product_deleted_response_spec.rb +52 -0
  403. data/spec/models/product_details_response_spec.rb +82 -0
  404. data/spec/models/product_list_response_spec.rb +58 -0
  405. data/spec/models/product_update_request_spec.rb +66 -0
  406. data/spec/models/setup_flow_cancel_request_spec.rb +36 -0
  407. data/spec/models/setup_flow_cancellation_reason_spec.rb +30 -0
  408. data/spec/models/setup_flow_create_request_spec.rb +70 -0
  409. data/spec/models/setup_flow_data_request_spec.rb +42 -0
  410. data/spec/models/setup_flow_list_response_spec.rb +58 -0
  411. data/spec/models/setup_flow_payment_method_options_card_request_spec.rb +40 -0
  412. data/spec/models/setup_flow_payment_method_options_request_spec.rb +36 -0
  413. data/spec/models/setup_flow_response_spec.rb +136 -0
  414. data/spec/models/setup_flow_status_spec.rb +30 -0
  415. data/spec/models/setup_flow_update_request_spec.rb +64 -0
  416. data/spec/models/statement_item_response_spec.rb +54 -0
  417. data/spec/models/statement_list_response_spec.rb +58 -0
  418. data/spec/models/statement_response_spec.rb +100 -0
  419. data/spec/models/statement_subject_spec.rb +30 -0
  420. data/spec/models/statement_type_spec.rb +30 -0
  421. data/spec/models/statement_url_response_spec.rb +52 -0
  422. data/spec/models/tax_rate_create_request_spec.rb +72 -0
  423. data/spec/models/tax_rate_details_response_spec.rb +88 -0
  424. data/spec/models/tax_rate_list_response_spec.rb +58 -0
  425. data/spec/models/tax_rate_update_request_spec.rb +60 -0
  426. data/spec/models/term_list_response_spec.rb +58 -0
  427. data/spec/models/term_response_spec.rb +70 -0
  428. data/spec/models/usage_spec.rb +30 -0
  429. data/spec/spec_helper.rb +111 -0
  430. metadata +651 -0
@@ -0,0 +1,252 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class LineItemRequest
18
+ # 料金 ID
19
+ attr_accessor :price_id
20
+
21
+ # 購入する商品の数量
22
+ attr_accessor :quantity
23
+
24
+ # 税率 ID
25
+ attr_accessor :tax_rates
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :price_id => :price_id,
31
+ :quantity => :quantity,
32
+ :tax_rates => :tax_rates
33
+ }
34
+ end
35
+
36
+ # Returns attribute mapping this model knows about
37
+ def self.acceptable_attribute_map
38
+ attribute_map
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ acceptable_attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :price_id => :'String',
50
+ :quantity => :'Integer',
51
+ :tax_rates => :'Array<String>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::LineItemRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::LineItemRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:price_id)
78
+ self.price_id = attributes[:price_id]
79
+ else
80
+ self.price_id = nil
81
+ end
82
+
83
+ if attributes.key?(:quantity)
84
+ self.quantity = attributes[:quantity]
85
+ else
86
+ self.quantity = nil
87
+ end
88
+
89
+ if attributes.key?(:tax_rates)
90
+ if (value = attributes[:tax_rates]).is_a?(Array)
91
+ self.tax_rates = value
92
+ end
93
+ end
94
+ end
95
+
96
+ # Custom attribute writer method with validation
97
+ # @param [Object] price_id Value to be assigned
98
+ def price_id=(price_id)
99
+ if price_id.nil?
100
+ raise ArgumentError, 'price_id cannot be nil'
101
+ end
102
+
103
+ @price_id = price_id
104
+ end
105
+
106
+ # Custom attribute writer method with validation
107
+ # @param [Object] quantity Value to be assigned
108
+ def quantity=(quantity)
109
+ if quantity.nil?
110
+ raise ArgumentError, 'quantity cannot be nil'
111
+ end
112
+
113
+ @quantity = quantity
114
+ end
115
+
116
+ # Checks equality by comparing each attribute.
117
+ # @param [Object] Object to be compared
118
+ def ==(o)
119
+ return true if self.equal?(o)
120
+ self.class == o.class &&
121
+ price_id == o.price_id &&
122
+ quantity == o.quantity &&
123
+ tax_rates == o.tax_rates
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [price_id, quantity, tax_rates].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ attributes = attributes.transform_keys(&:to_sym)
144
+ transformed_hash = {}
145
+ openapi_types.each_pair do |key, type|
146
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
147
+ transformed_hash["#{key}"] = nil
148
+ elsif type =~ /\AArray<(.*)>/i
149
+ # check to ensure the input is an array given that the attribute
150
+ # is documented as an array but the input is not
151
+ if attributes[attribute_map[key]].is_a?(Array)
152
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
153
+ end
154
+ elsif !attributes[attribute_map[key]].nil?
155
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
156
+ end
157
+ end
158
+ new(transformed_hash)
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def self._deserialize(type, value)
166
+ case type.to_sym
167
+ when :Time
168
+ Time.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ # models (e.g. Pet) or oneOf
199
+ klass = PAYJPv2.const_get(type)
200
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+
250
+ end
251
+
252
+ end
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class Locale
18
+ AUTO = "auto".freeze
19
+ JA = "ja".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [AUTO, JA].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if Locale.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #Locale"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ module MetadataValue
18
+ class << self
19
+ # List of class defined in anyOf (OpenAPI v3)
20
+ def openapi_any_of
21
+ [
22
+ :'Boolean',
23
+ :'Integer',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = PAYJPv2.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,206 @@
1
+ =begin
2
+ #PAY.JP API v2
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.14.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module PAYJPv2
17
+ class PayPayConfigRequest
18
+ attr_accessor :display_preference
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :display_preference => :display_preference
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :display_preference => :'DisplayPreferenceRequest'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ :display_preference
48
+ ])
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ if (!attributes.is_a?(Hash))
55
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::PayPayConfigRequest` initialize method"
56
+ end
57
+
58
+ # check to see if the attribute exists and convert string to symbol for hash key
59
+ acceptable_attribute_map = self.class.acceptable_attribute_map
60
+ attributes = attributes.each_with_object({}) { |(k, v), h|
61
+ if (!acceptable_attribute_map.key?(k.to_sym))
62
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::PayPayConfigRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ end
64
+ h[k.to_sym] = v
65
+ }
66
+
67
+ if attributes.key?(:display_preference)
68
+ self.display_preference = attributes[:display_preference]
69
+ end
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ display_preference == o.display_preference
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Integer] Hash code
88
+ def hash
89
+ [display_preference].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ attributes = attributes.transform_keys(&:to_sym)
98
+ transformed_hash = {}
99
+ openapi_types.each_pair do |key, type|
100
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
101
+ transformed_hash["#{key}"] = nil
102
+ elsif type =~ /\AArray<(.*)>/i
103
+ # check to ensure the input is an array given that the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[attribute_map[key]].is_a?(Array)
106
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
107
+ end
108
+ elsif !attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
110
+ end
111
+ end
112
+ new(transformed_hash)
113
+ end
114
+
115
+ # Deserializes the data based on type
116
+ # @param string type Data type
117
+ # @param string value Value to be deserialized
118
+ # @return [Object] Deserialized data
119
+ def self._deserialize(type, value)
120
+ case type.to_sym
121
+ when :Time
122
+ Time.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :Boolean
132
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when :Object
138
+ # generic object (usually a Hash), return directly
139
+ value
140
+ when /\AArray<(?<inner_type>.+)>\z/
141
+ inner_type = Regexp.last_match[:inner_type]
142
+ value.map { |v| _deserialize(inner_type, v) }
143
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
+ k_type = Regexp.last_match[:k_type]
145
+ v_type = Regexp.last_match[:v_type]
146
+ {}.tap do |hash|
147
+ value.each do |k, v|
148
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
+ end
150
+ end
151
+ else # model
152
+ # models (e.g. Pet) or oneOf
153
+ klass = PAYJPv2.const_get(type)
154
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
155
+ end
156
+ end
157
+
158
+ # Returns the string representation of the object
159
+ # @return [String] String presentation of the object
160
+ def to_s
161
+ to_hash.to_s
162
+ end
163
+
164
+ # to_body is an alias to to_hash (backward compatibility)
165
+ # @return [Hash] Returns the object in the form of hash
166
+ def to_body
167
+ to_hash
168
+ end
169
+
170
+ # Returns the object in the form of hash
171
+ # @return [Hash] Returns the object in the form of hash
172
+ def to_hash
173
+ hash = {}
174
+ self.class.attribute_map.each_pair do |attr, param|
175
+ value = self.send(attr)
176
+ if value.nil?
177
+ is_nullable = self.class.openapi_nullable.include?(attr)
178
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
179
+ end
180
+
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ end