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,353 @@
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 ProductDetailsResponse
18
+ attr_accessor :object
19
+
20
+ # 商品 ID
21
+ attr_accessor :id
22
+
23
+ # Checkout などで顧客に表示される商品名
24
+ attr_accessor :name
25
+
26
+ # 商品が購入可能かどうか
27
+ attr_accessor :active
28
+
29
+ attr_accessor :default_price_id
30
+
31
+ attr_accessor :description
32
+
33
+ attr_accessor :unit_label
34
+
35
+ attr_accessor :url
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :object => :object,
63
+ :id => :id,
64
+ :name => :name,
65
+ :active => :active,
66
+ :default_price_id => :default_price_id,
67
+ :description => :description,
68
+ :unit_label => :unit_label,
69
+ :url => :url
70
+ }
71
+ end
72
+
73
+ # Returns attribute mapping this model knows about
74
+ def self.acceptable_attribute_map
75
+ attribute_map
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ acceptable_attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :object => :'String',
87
+ :id => :'String',
88
+ :name => :'String',
89
+ :active => :'Boolean',
90
+ :default_price_id => :'String',
91
+ :description => :'String',
92
+ :unit_label => :'String',
93
+ :url => :'String'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ :default_price_id,
101
+ :description,
102
+ :unit_label,
103
+ :url
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::ProductDetailsResponse` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ acceptable_attribute_map = self.class.acceptable_attribute_map
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!acceptable_attribute_map.key?(k.to_sym))
118
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::ProductDetailsResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:object)
124
+ self.object = attributes[:object]
125
+ else
126
+ self.object = 'product'
127
+ end
128
+
129
+ if attributes.key?(:id)
130
+ self.id = attributes[:id]
131
+ else
132
+ self.id = nil
133
+ end
134
+
135
+ if attributes.key?(:name)
136
+ self.name = attributes[:name]
137
+ else
138
+ self.name = nil
139
+ end
140
+
141
+ if attributes.key?(:active)
142
+ self.active = attributes[:active]
143
+ else
144
+ self.active = nil
145
+ end
146
+
147
+ if attributes.key?(:default_price_id)
148
+ self.default_price_id = attributes[:default_price_id]
149
+ else
150
+ self.default_price_id = nil
151
+ end
152
+
153
+ if attributes.key?(:description)
154
+ self.description = attributes[:description]
155
+ else
156
+ self.description = nil
157
+ end
158
+
159
+ if attributes.key?(:unit_label)
160
+ self.unit_label = attributes[:unit_label]
161
+ else
162
+ self.unit_label = nil
163
+ end
164
+
165
+ if attributes.key?(:url)
166
+ self.url = attributes[:url]
167
+ else
168
+ self.url = nil
169
+ end
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] object Object to be assigned
174
+ def object=(object)
175
+ validator = EnumAttributeValidator.new('String', ["product"])
176
+ unless validator.valid?(object)
177
+ raise ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
178
+ end
179
+ @object = object
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] id Value to be assigned
184
+ def id=(id)
185
+ if id.nil?
186
+ raise ArgumentError, 'id cannot be nil'
187
+ end
188
+
189
+ @id = id
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] name Value to be assigned
194
+ def name=(name)
195
+ if name.nil?
196
+ raise ArgumentError, 'name cannot be nil'
197
+ end
198
+
199
+ @name = name
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] active Value to be assigned
204
+ def active=(active)
205
+ if active.nil?
206
+ raise ArgumentError, 'active cannot be nil'
207
+ end
208
+
209
+ @active = active
210
+ end
211
+
212
+ # Checks equality by comparing each attribute.
213
+ # @param [Object] Object to be compared
214
+ def ==(o)
215
+ return true if self.equal?(o)
216
+ self.class == o.class &&
217
+ object == o.object &&
218
+ id == o.id &&
219
+ name == o.name &&
220
+ active == o.active &&
221
+ default_price_id == o.default_price_id &&
222
+ description == o.description &&
223
+ unit_label == o.unit_label &&
224
+ url == o.url
225
+ end
226
+
227
+ # @see the `==` method
228
+ # @param [Object] Object to be compared
229
+ def eql?(o)
230
+ self == o
231
+ end
232
+
233
+ # Calculates hash code according to all attributes.
234
+ # @return [Integer] Hash code
235
+ def hash
236
+ [object, id, name, active, default_price_id, description, unit_label, url].hash
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def self.build_from_hash(attributes)
243
+ return nil unless attributes.is_a?(Hash)
244
+ attributes = attributes.transform_keys(&:to_sym)
245
+ transformed_hash = {}
246
+ openapi_types.each_pair do |key, type|
247
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
248
+ transformed_hash["#{key}"] = nil
249
+ elsif type =~ /\AArray<(.*)>/i
250
+ # check to ensure the input is an array given that the attribute
251
+ # is documented as an array but the input is not
252
+ if attributes[attribute_map[key]].is_a?(Array)
253
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
254
+ end
255
+ elsif !attributes[attribute_map[key]].nil?
256
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
257
+ end
258
+ end
259
+ new(transformed_hash)
260
+ end
261
+
262
+ # Deserializes the data based on type
263
+ # @param string type Data type
264
+ # @param string value Value to be deserialized
265
+ # @return [Object] Deserialized data
266
+ def self._deserialize(type, value)
267
+ case type.to_sym
268
+ when :Time
269
+ Time.parse(value)
270
+ when :Date
271
+ Date.parse(value)
272
+ when :String
273
+ value.to_s
274
+ when :Integer
275
+ value.to_i
276
+ when :Float
277
+ value.to_f
278
+ when :Boolean
279
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
280
+ true
281
+ else
282
+ false
283
+ end
284
+ when :Object
285
+ # generic object (usually a Hash), return directly
286
+ value
287
+ when /\AArray<(?<inner_type>.+)>\z/
288
+ inner_type = Regexp.last_match[:inner_type]
289
+ value.map { |v| _deserialize(inner_type, v) }
290
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
291
+ k_type = Regexp.last_match[:k_type]
292
+ v_type = Regexp.last_match[:v_type]
293
+ {}.tap do |hash|
294
+ value.each do |k, v|
295
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
296
+ end
297
+ end
298
+ else # model
299
+ # models (e.g. Pet) or oneOf
300
+ klass = PAYJPv2.const_get(type)
301
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
302
+ end
303
+ end
304
+
305
+ # Returns the string representation of the object
306
+ # @return [String] String presentation of the object
307
+ def to_s
308
+ to_hash.to_s
309
+ end
310
+
311
+ # to_body is an alias to to_hash (backward compatibility)
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_body
314
+ to_hash
315
+ end
316
+
317
+ # Returns the object in the form of hash
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_hash
320
+ hash = {}
321
+ self.class.attribute_map.each_pair do |attr, param|
322
+ value = self.send(attr)
323
+ if value.nil?
324
+ is_nullable = self.class.openapi_nullable.include?(attr)
325
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
326
+ end
327
+
328
+ hash[param] = _to_hash(value)
329
+ end
330
+ hash
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value)
338
+ if value.is_a?(Array)
339
+ value.compact.map { |v| _to_hash(v) }
340
+ elsif value.is_a?(Hash)
341
+ {}.tap do |hash|
342
+ value.each { |k, v| hash[k] = _to_hash(v) }
343
+ end
344
+ elsif value.respond_to? :to_hash
345
+ value.to_hash
346
+ else
347
+ value
348
+ end
349
+ end
350
+
351
+ end
352
+
353
+ end
@@ -0,0 +1,306 @@
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 ProductListResponse
18
+ attr_accessor :object
19
+
20
+ # リスト取得URL
21
+ attr_accessor :url
22
+
23
+ # 次のページがあるかどうか
24
+ attr_accessor :has_more
25
+
26
+ attr_accessor :data
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :object => :object,
54
+ :url => :url,
55
+ :has_more => :has_more,
56
+ :data => :data
57
+ }
58
+ end
59
+
60
+ # Returns attribute mapping this model knows about
61
+ def self.acceptable_attribute_map
62
+ attribute_map
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ acceptable_attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :object => :'String',
74
+ :url => :'String',
75
+ :has_more => :'Boolean',
76
+ :data => :'Array<ProductDetailsResponse>'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::ProductListResponse` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ acceptable_attribute_map = self.class.acceptable_attribute_map
95
+ attributes = attributes.each_with_object({}) { |(k, v), h|
96
+ if (!acceptable_attribute_map.key?(k.to_sym))
97
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::ProductListResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
98
+ end
99
+ h[k.to_sym] = v
100
+ }
101
+
102
+ if attributes.key?(:object)
103
+ self.object = attributes[:object]
104
+ else
105
+ self.object = 'list'
106
+ end
107
+
108
+ if attributes.key?(:url)
109
+ self.url = attributes[:url]
110
+ else
111
+ self.url = nil
112
+ end
113
+
114
+ if attributes.key?(:has_more)
115
+ self.has_more = attributes[:has_more]
116
+ else
117
+ self.has_more = nil
118
+ end
119
+
120
+ if attributes.key?(:data)
121
+ if (value = attributes[:data]).is_a?(Array)
122
+ self.data = value
123
+ end
124
+ else
125
+ self.data = nil
126
+ end
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ # @param [Object] object Object to be assigned
131
+ def object=(object)
132
+ validator = EnumAttributeValidator.new('String', ["list"])
133
+ unless validator.valid?(object)
134
+ raise ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
135
+ end
136
+ @object = object
137
+ end
138
+
139
+ # Custom attribute writer method with validation
140
+ # @param [Object] url Value to be assigned
141
+ def url=(url)
142
+ if url.nil?
143
+ raise ArgumentError, 'url cannot be nil'
144
+ end
145
+
146
+ @url = url
147
+ end
148
+
149
+ # Custom attribute writer method with validation
150
+ # @param [Object] has_more Value to be assigned
151
+ def has_more=(has_more)
152
+ if has_more.nil?
153
+ raise ArgumentError, 'has_more cannot be nil'
154
+ end
155
+
156
+ @has_more = has_more
157
+ end
158
+
159
+ # Custom attribute writer method with validation
160
+ # @param [Object] data Value to be assigned
161
+ def data=(data)
162
+ if data.nil?
163
+ raise ArgumentError, 'data cannot be nil'
164
+ end
165
+
166
+ @data = data
167
+ end
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] Object to be compared
171
+ def ==(o)
172
+ return true if self.equal?(o)
173
+ self.class == o.class &&
174
+ object == o.object &&
175
+ url == o.url &&
176
+ has_more == o.has_more &&
177
+ data == o.data
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Integer] Hash code
188
+ def hash
189
+ [object, url, has_more, data].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ attributes = attributes.transform_keys(&:to_sym)
198
+ transformed_hash = {}
199
+ openapi_types.each_pair do |key, type|
200
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
201
+ transformed_hash["#{key}"] = nil
202
+ elsif type =~ /\AArray<(.*)>/i
203
+ # check to ensure the input is an array given that the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[attribute_map[key]].is_a?(Array)
206
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
207
+ end
208
+ elsif !attributes[attribute_map[key]].nil?
209
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
210
+ end
211
+ end
212
+ new(transformed_hash)
213
+ end
214
+
215
+ # Deserializes the data based on type
216
+ # @param string type Data type
217
+ # @param string value Value to be deserialized
218
+ # @return [Object] Deserialized data
219
+ def self._deserialize(type, value)
220
+ case type.to_sym
221
+ when :Time
222
+ Time.parse(value)
223
+ when :Date
224
+ Date.parse(value)
225
+ when :String
226
+ value.to_s
227
+ when :Integer
228
+ value.to_i
229
+ when :Float
230
+ value.to_f
231
+ when :Boolean
232
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
233
+ true
234
+ else
235
+ false
236
+ end
237
+ when :Object
238
+ # generic object (usually a Hash), return directly
239
+ value
240
+ when /\AArray<(?<inner_type>.+)>\z/
241
+ inner_type = Regexp.last_match[:inner_type]
242
+ value.map { |v| _deserialize(inner_type, v) }
243
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
244
+ k_type = Regexp.last_match[:k_type]
245
+ v_type = Regexp.last_match[:v_type]
246
+ {}.tap do |hash|
247
+ value.each do |k, v|
248
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
249
+ end
250
+ end
251
+ else # model
252
+ # models (e.g. Pet) or oneOf
253
+ klass = PAYJPv2.const_get(type)
254
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
255
+ end
256
+ end
257
+
258
+ # Returns the string representation of the object
259
+ # @return [String] String presentation of the object
260
+ def to_s
261
+ to_hash.to_s
262
+ end
263
+
264
+ # to_body is an alias to to_hash (backward compatibility)
265
+ # @return [Hash] Returns the object in the form of hash
266
+ def to_body
267
+ to_hash
268
+ end
269
+
270
+ # Returns the object in the form of hash
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_hash
273
+ hash = {}
274
+ self.class.attribute_map.each_pair do |attr, param|
275
+ value = self.send(attr)
276
+ if value.nil?
277
+ is_nullable = self.class.openapi_nullable.include?(attr)
278
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
279
+ end
280
+
281
+ hash[param] = _to_hash(value)
282
+ end
283
+ hash
284
+ end
285
+
286
+ # Outputs non-array value in the form of hash
287
+ # For object, use to_hash. Otherwise, just return the value
288
+ # @param [Object] value Any valid value
289
+ # @return [Hash] Returns the value in the form of hash
290
+ def _to_hash(value)
291
+ if value.is_a?(Array)
292
+ value.compact.map { |v| _to_hash(v) }
293
+ elsif value.is_a?(Hash)
294
+ {}.tap do |hash|
295
+ value.each { |k, v| hash[k] = _to_hash(v) }
296
+ end
297
+ elsif value.respond_to? :to_hash
298
+ value.to_hash
299
+ else
300
+ value
301
+ end
302
+ end
303
+
304
+ end
305
+
306
+ end