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,387 @@
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 CustomerResponse
18
+ attr_accessor :object
19
+
20
+ # 顧客 ID
21
+ attr_accessor :id
22
+
23
+ # 本番環境かどうか
24
+ attr_accessor :livemode
25
+
26
+ attr_accessor :email
27
+
28
+ attr_accessor :description
29
+
30
+ attr_accessor :default_payment_method_id
31
+
32
+ # メタデータ
33
+ attr_accessor :metadata
34
+
35
+ # 作成日時 (UTC, ISO 8601 形式)
36
+ attr_accessor :created_at
37
+
38
+ # 更新日時 (UTC, ISO 8601 形式)
39
+ attr_accessor :updated_at
40
+
41
+ class EnumAttributeValidator
42
+ attr_reader :datatype
43
+ attr_reader :allowable_values
44
+
45
+ def initialize(datatype, allowable_values)
46
+ @allowable_values = allowable_values.map do |value|
47
+ case datatype.to_s
48
+ when /Integer/i
49
+ value.to_i
50
+ when /Float/i
51
+ value.to_f
52
+ else
53
+ value
54
+ end
55
+ end
56
+ end
57
+
58
+ def valid?(value)
59
+ !value || allowable_values.include?(value)
60
+ end
61
+ end
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :object => :object,
67
+ :id => :id,
68
+ :livemode => :livemode,
69
+ :email => :email,
70
+ :description => :description,
71
+ :default_payment_method_id => :default_payment_method_id,
72
+ :metadata => :metadata,
73
+ :created_at => :created_at,
74
+ :updated_at => :updated_at
75
+ }
76
+ end
77
+
78
+ # Returns attribute mapping this model knows about
79
+ def self.acceptable_attribute_map
80
+ attribute_map
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ acceptable_attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :object => :'String',
92
+ :id => :'String',
93
+ :livemode => :'Boolean',
94
+ :email => :'String',
95
+ :description => :'String',
96
+ :default_payment_method_id => :'String',
97
+ :metadata => :'Hash<String, MetadataValue>',
98
+ :created_at => :'Time',
99
+ :updated_at => :'Time'
100
+ }
101
+ end
102
+
103
+ # List of attributes with nullable: true
104
+ def self.openapi_nullable
105
+ Set.new([
106
+ :email,
107
+ :description,
108
+ :default_payment_method_id,
109
+ ])
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ if (!attributes.is_a?(Hash))
116
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::CustomerResponse` initialize method"
117
+ end
118
+
119
+ # check to see if the attribute exists and convert string to symbol for hash key
120
+ acceptable_attribute_map = self.class.acceptable_attribute_map
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!acceptable_attribute_map.key?(k.to_sym))
123
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::CustomerResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:object)
129
+ self.object = attributes[:object]
130
+ else
131
+ self.object = 'customer'
132
+ end
133
+
134
+ if attributes.key?(:id)
135
+ self.id = attributes[:id]
136
+ else
137
+ self.id = nil
138
+ end
139
+
140
+ if attributes.key?(:livemode)
141
+ self.livemode = attributes[:livemode]
142
+ else
143
+ self.livemode = nil
144
+ end
145
+
146
+ if attributes.key?(:email)
147
+ self.email = attributes[:email]
148
+ else
149
+ self.email = nil
150
+ end
151
+
152
+ if attributes.key?(:description)
153
+ self.description = attributes[:description]
154
+ else
155
+ self.description = nil
156
+ end
157
+
158
+ if attributes.key?(:default_payment_method_id)
159
+ self.default_payment_method_id = attributes[:default_payment_method_id]
160
+ else
161
+ self.default_payment_method_id = nil
162
+ end
163
+
164
+ if attributes.key?(:metadata)
165
+ if (value = attributes[:metadata]).is_a?(Hash)
166
+ self.metadata = value
167
+ end
168
+ else
169
+ self.metadata = nil
170
+ end
171
+
172
+ if attributes.key?(:created_at)
173
+ self.created_at = attributes[:created_at]
174
+ else
175
+ self.created_at = nil
176
+ end
177
+
178
+ if attributes.key?(:updated_at)
179
+ self.updated_at = attributes[:updated_at]
180
+ else
181
+ self.updated_at = nil
182
+ end
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] object Object to be assigned
187
+ def object=(object)
188
+ validator = EnumAttributeValidator.new('String', ["customer"])
189
+ unless validator.valid?(object)
190
+ raise ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
191
+ end
192
+ @object = object
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] id Value to be assigned
197
+ def id=(id)
198
+ if id.nil?
199
+ raise ArgumentError, 'id cannot be nil'
200
+ end
201
+
202
+ @id = id
203
+ end
204
+
205
+ # Custom attribute writer method with validation
206
+ # @param [Object] livemode Value to be assigned
207
+ def livemode=(livemode)
208
+ if livemode.nil?
209
+ raise ArgumentError, 'livemode cannot be nil'
210
+ end
211
+
212
+ @livemode = livemode
213
+ end
214
+
215
+ # Custom attribute writer method with validation
216
+ # @param [Object] metadata Value to be assigned
217
+ def metadata=(metadata)
218
+ if metadata.nil?
219
+ raise ArgumentError, 'metadata cannot be nil'
220
+ end
221
+
222
+ @metadata = metadata
223
+ end
224
+
225
+ # Custom attribute writer method with validation
226
+ # @param [Object] created_at Value to be assigned
227
+ def created_at=(created_at)
228
+ if created_at.nil?
229
+ raise ArgumentError, 'created_at cannot be nil'
230
+ end
231
+
232
+ @created_at = created_at
233
+ end
234
+
235
+ # Custom attribute writer method with validation
236
+ # @param [Object] updated_at Value to be assigned
237
+ def updated_at=(updated_at)
238
+ if updated_at.nil?
239
+ raise ArgumentError, 'updated_at cannot be nil'
240
+ end
241
+
242
+ @updated_at = updated_at
243
+ end
244
+
245
+ # Checks equality by comparing each attribute.
246
+ # @param [Object] Object to be compared
247
+ def ==(o)
248
+ return true if self.equal?(o)
249
+ self.class == o.class &&
250
+ object == o.object &&
251
+ id == o.id &&
252
+ livemode == o.livemode &&
253
+ email == o.email &&
254
+ description == o.description &&
255
+ default_payment_method_id == o.default_payment_method_id &&
256
+ metadata == o.metadata &&
257
+ created_at == o.created_at &&
258
+ updated_at == o.updated_at
259
+ end
260
+
261
+ # @see the `==` method
262
+ # @param [Object] Object to be compared
263
+ def eql?(o)
264
+ self == o
265
+ end
266
+
267
+ # Calculates hash code according to all attributes.
268
+ # @return [Integer] Hash code
269
+ def hash
270
+ [object, id, livemode, email, description, default_payment_method_id, metadata, created_at, updated_at].hash
271
+ end
272
+
273
+ # Builds the object from hash
274
+ # @param [Hash] attributes Model attributes in the form of hash
275
+ # @return [Object] Returns the model itself
276
+ def self.build_from_hash(attributes)
277
+ return nil unless attributes.is_a?(Hash)
278
+ attributes = attributes.transform_keys(&:to_sym)
279
+ transformed_hash = {}
280
+ openapi_types.each_pair do |key, type|
281
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
282
+ transformed_hash["#{key}"] = nil
283
+ elsif type =~ /\AArray<(.*)>/i
284
+ # check to ensure the input is an array given that the attribute
285
+ # is documented as an array but the input is not
286
+ if attributes[attribute_map[key]].is_a?(Array)
287
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
288
+ end
289
+ elsif !attributes[attribute_map[key]].nil?
290
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
291
+ end
292
+ end
293
+ new(transformed_hash)
294
+ end
295
+
296
+ # Deserializes the data based on type
297
+ # @param string type Data type
298
+ # @param string value Value to be deserialized
299
+ # @return [Object] Deserialized data
300
+ def self._deserialize(type, value)
301
+ case type.to_sym
302
+ when :Time
303
+ Time.parse(value)
304
+ when :Date
305
+ Date.parse(value)
306
+ when :String
307
+ value.to_s
308
+ when :Integer
309
+ value.to_i
310
+ when :Float
311
+ value.to_f
312
+ when :Boolean
313
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
314
+ true
315
+ else
316
+ false
317
+ end
318
+ when :Object
319
+ # generic object (usually a Hash), return directly
320
+ value
321
+ when /\AArray<(?<inner_type>.+)>\z/
322
+ inner_type = Regexp.last_match[:inner_type]
323
+ value.map { |v| _deserialize(inner_type, v) }
324
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
325
+ k_type = Regexp.last_match[:k_type]
326
+ v_type = Regexp.last_match[:v_type]
327
+ {}.tap do |hash|
328
+ value.each do |k, v|
329
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
330
+ end
331
+ end
332
+ else # model
333
+ # models (e.g. Pet) or oneOf
334
+ klass = PAYJPv2.const_get(type)
335
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
336
+ end
337
+ end
338
+
339
+ # Returns the string representation of the object
340
+ # @return [String] String presentation of the object
341
+ def to_s
342
+ to_hash.to_s
343
+ end
344
+
345
+ # to_body is an alias to to_hash (backward compatibility)
346
+ # @return [Hash] Returns the object in the form of hash
347
+ def to_body
348
+ to_hash
349
+ end
350
+
351
+ # Returns the object in the form of hash
352
+ # @return [Hash] Returns the object in the form of hash
353
+ def to_hash
354
+ hash = {}
355
+ self.class.attribute_map.each_pair do |attr, param|
356
+ value = self.send(attr)
357
+ if value.nil?
358
+ is_nullable = self.class.openapi_nullable.include?(attr)
359
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
360
+ end
361
+
362
+ hash[param] = _to_hash(value)
363
+ end
364
+ hash
365
+ end
366
+
367
+ # Outputs non-array value in the form of hash
368
+ # For object, use to_hash. Otherwise, just return the value
369
+ # @param [Object] value Any valid value
370
+ # @return [Hash] Returns the value in the form of hash
371
+ def _to_hash(value)
372
+ if value.is_a?(Array)
373
+ value.compact.map { |v| _to_hash(v) }
374
+ elsif value.is_a?(Hash)
375
+ {}.tap do |hash|
376
+ value.each { |k, v| hash[k] = _to_hash(v) }
377
+ end
378
+ elsif value.respond_to? :to_hash
379
+ value.to_hash
380
+ else
381
+ value
382
+ end
383
+ end
384
+
385
+ end
386
+
387
+ end
@@ -0,0 +1,266 @@
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 CustomerUpdateRequest
18
+ attr_accessor :default_payment_method_id
19
+
20
+ # 顧客のメールアドレス。メールアドレスの形式が正しいかどうかは検証されます。
21
+ attr_accessor :email
22
+
23
+ # 顧客オブジェクトに付加できる任意の文字列です。管理画面で顧客と一緒に表示されます。
24
+ attr_accessor :description
25
+
26
+ # キーバリューの任意のデータを格納できます。20件まで登録可能で、空文字列を指定するとそのキーを削除できます。<a href=\"https://docs.pay.jp/v2/guide/developers/metadata\">詳細はメタデータのドキュメントを参照してください。</a>
27
+ attr_accessor :metadata
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :default_payment_method_id => :default_payment_method_id,
33
+ :email => :email,
34
+ :description => :description,
35
+ :metadata => :metadata
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :default_payment_method_id => :'String',
53
+ :email => :'String',
54
+ :description => :'String',
55
+ :metadata => :'Hash<String, MetadataValue>'
56
+ }
57
+ end
58
+
59
+ # List of attributes with nullable: true
60
+ def self.openapi_nullable
61
+ Set.new([
62
+ :default_payment_method_id,
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ raise ArgumentError, "The input argument (attributes) must be a hash in `PAYJPv2::CustomerUpdateRequest` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ raise ArgumentError, "`#{k}` is not a valid attribute in `PAYJPv2::CustomerUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:default_payment_method_id)
83
+ self.default_payment_method_id = attributes[:default_payment_method_id]
84
+ end
85
+
86
+ if attributes.key?(:email)
87
+ self.email = attributes[:email]
88
+ end
89
+
90
+ if attributes.key?(:description)
91
+ self.description = attributes[:description]
92
+ end
93
+
94
+ if attributes.key?(:metadata)
95
+ if (value = attributes[:metadata]).is_a?(Hash)
96
+ self.metadata = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Custom attribute writer method with validation
102
+ # @param [Object] email Value to be assigned
103
+ def email=(email)
104
+ if email.nil?
105
+ raise ArgumentError, 'email cannot be nil'
106
+ end
107
+
108
+ if email.to_s.length > 255
109
+ raise ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 255.'
110
+ end
111
+
112
+ @email = email
113
+ end
114
+
115
+ # Custom attribute writer method with validation
116
+ # @param [Object] description Value to be assigned
117
+ def description=(description)
118
+ if description.nil?
119
+ raise ArgumentError, 'description cannot be nil'
120
+ end
121
+
122
+ if description.to_s.length > 255
123
+ raise ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 255.'
124
+ end
125
+
126
+ @description = description
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ default_payment_method_id == o.default_payment_method_id &&
135
+ email == o.email &&
136
+ description == o.description &&
137
+ metadata == o.metadata
138
+ end
139
+
140
+ # @see the `==` method
141
+ # @param [Object] Object to be compared
142
+ def eql?(o)
143
+ self == o
144
+ end
145
+
146
+ # Calculates hash code according to all attributes.
147
+ # @return [Integer] Hash code
148
+ def hash
149
+ [default_payment_method_id, email, description, metadata].hash
150
+ end
151
+
152
+ # Builds the object from hash
153
+ # @param [Hash] attributes Model attributes in the form of hash
154
+ # @return [Object] Returns the model itself
155
+ def self.build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ attributes = attributes.transform_keys(&:to_sym)
158
+ transformed_hash = {}
159
+ openapi_types.each_pair do |key, type|
160
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
161
+ transformed_hash["#{key}"] = nil
162
+ elsif type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[attribute_map[key]].is_a?(Array)
166
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
167
+ end
168
+ elsif !attributes[attribute_map[key]].nil?
169
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
170
+ end
171
+ end
172
+ new(transformed_hash)
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def self._deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = PAYJPv2.const_get(type)
214
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end