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,405 @@
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 CheckoutSessionLineItemDataResponse
18
+ attr_accessor :object
19
+
20
+ # ID
21
+ attr_accessor :id
22
+
23
+ # 割引や税金が適用される前のすべての商品の合計金額
24
+ attr_accessor :amount_subtotal
25
+
26
+ # 税額
27
+ attr_accessor :amount_tax
28
+
29
+ # 割引と税金が適用された後のすべての商品の合計金額
30
+ attr_accessor :amount_total
31
+
32
+ # 価格の通貨。現在は `jpy` のみサポートしています。
33
+ attr_accessor :currency
34
+
35
+ attr_accessor :description
36
+
37
+ # 料金情報
38
+ attr_accessor :price
39
+
40
+ # 数量
41
+ attr_accessor :quantity
42
+
43
+ class EnumAttributeValidator
44
+ attr_reader :datatype
45
+ attr_reader :allowable_values
46
+
47
+ def initialize(datatype, allowable_values)
48
+ @allowable_values = allowable_values.map do |value|
49
+ case datatype.to_s
50
+ when /Integer/i
51
+ value.to_i
52
+ when /Float/i
53
+ value.to_f
54
+ else
55
+ value
56
+ end
57
+ end
58
+ end
59
+
60
+ def valid?(value)
61
+ !value || allowable_values.include?(value)
62
+ end
63
+ end
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :object => :object,
69
+ :id => :id,
70
+ :amount_subtotal => :amount_subtotal,
71
+ :amount_tax => :amount_tax,
72
+ :amount_total => :amount_total,
73
+ :currency => :currency,
74
+ :description => :description,
75
+ :price => :price,
76
+ :quantity => :quantity
77
+ }
78
+ end
79
+
80
+ # Returns attribute mapping this model knows about
81
+ def self.acceptable_attribute_map
82
+ attribute_map
83
+ end
84
+
85
+ # Returns all the JSON keys this model knows about
86
+ def self.acceptable_attributes
87
+ acceptable_attribute_map.values
88
+ end
89
+
90
+ # Attribute type mapping.
91
+ def self.openapi_types
92
+ {
93
+ :object => :'String',
94
+ :id => :'String',
95
+ :amount_subtotal => :'Integer',
96
+ :amount_tax => :'Integer',
97
+ :amount_total => :'Integer',
98
+ :currency => :'Currency',
99
+ :description => :'String',
100
+ :price => :'PriceDetailsResponse',
101
+ :quantity => :'Integer'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ :description,
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::CheckoutSessionLineItemDataResponse` 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::CheckoutSessionLineItemDataResponse`. 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 = 'line_item'
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?(:amount_subtotal)
141
+ self.amount_subtotal = attributes[:amount_subtotal]
142
+ else
143
+ self.amount_subtotal = nil
144
+ end
145
+
146
+ if attributes.key?(:amount_tax)
147
+ self.amount_tax = attributes[:amount_tax]
148
+ else
149
+ self.amount_tax = nil
150
+ end
151
+
152
+ if attributes.key?(:amount_total)
153
+ self.amount_total = attributes[:amount_total]
154
+ else
155
+ self.amount_total = nil
156
+ end
157
+
158
+ if attributes.key?(:currency)
159
+ self.currency = attributes[:currency]
160
+ else
161
+ self.currency = nil
162
+ end
163
+
164
+ if attributes.key?(:description)
165
+ self.description = attributes[:description]
166
+ else
167
+ self.description = nil
168
+ end
169
+
170
+ if attributes.key?(:price)
171
+ self.price = attributes[:price]
172
+ else
173
+ self.price = nil
174
+ end
175
+
176
+ if attributes.key?(:quantity)
177
+ self.quantity = attributes[:quantity]
178
+ else
179
+ self.quantity = nil
180
+ end
181
+ end
182
+
183
+ # Custom attribute writer method checking allowed values (enum).
184
+ # @param [Object] object Object to be assigned
185
+ def object=(object)
186
+ validator = EnumAttributeValidator.new('String', ["line_item"])
187
+ unless validator.valid?(object)
188
+ raise ArgumentError, "invalid value for \"object\", must be one of #{validator.allowable_values}."
189
+ end
190
+ @object = object
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] id Value to be assigned
195
+ def id=(id)
196
+ if id.nil?
197
+ raise ArgumentError, 'id cannot be nil'
198
+ end
199
+
200
+ @id = id
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] amount_subtotal Value to be assigned
205
+ def amount_subtotal=(amount_subtotal)
206
+ if amount_subtotal.nil?
207
+ raise ArgumentError, 'amount_subtotal cannot be nil'
208
+ end
209
+
210
+ @amount_subtotal = amount_subtotal
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] amount_tax Value to be assigned
215
+ def amount_tax=(amount_tax)
216
+ if amount_tax.nil?
217
+ raise ArgumentError, 'amount_tax cannot be nil'
218
+ end
219
+
220
+ @amount_tax = amount_tax
221
+ end
222
+
223
+ # Custom attribute writer method with validation
224
+ # @param [Object] amount_total Value to be assigned
225
+ def amount_total=(amount_total)
226
+ if amount_total.nil?
227
+ raise ArgumentError, 'amount_total cannot be nil'
228
+ end
229
+
230
+ @amount_total = amount_total
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] currency Value to be assigned
235
+ def currency=(currency)
236
+ if currency.nil?
237
+ raise ArgumentError, 'currency cannot be nil'
238
+ end
239
+
240
+ @currency = currency
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] price Value to be assigned
245
+ def price=(price)
246
+ if price.nil?
247
+ raise ArgumentError, 'price cannot be nil'
248
+ end
249
+
250
+ @price = price
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] quantity Value to be assigned
255
+ def quantity=(quantity)
256
+ if quantity.nil?
257
+ raise ArgumentError, 'quantity cannot be nil'
258
+ end
259
+
260
+ @quantity = quantity
261
+ end
262
+
263
+ # Checks equality by comparing each attribute.
264
+ # @param [Object] Object to be compared
265
+ def ==(o)
266
+ return true if self.equal?(o)
267
+ self.class == o.class &&
268
+ object == o.object &&
269
+ id == o.id &&
270
+ amount_subtotal == o.amount_subtotal &&
271
+ amount_tax == o.amount_tax &&
272
+ amount_total == o.amount_total &&
273
+ currency == o.currency &&
274
+ description == o.description &&
275
+ price == o.price &&
276
+ quantity == o.quantity
277
+ end
278
+
279
+ # @see the `==` method
280
+ # @param [Object] Object to be compared
281
+ def eql?(o)
282
+ self == o
283
+ end
284
+
285
+ # Calculates hash code according to all attributes.
286
+ # @return [Integer] Hash code
287
+ def hash
288
+ [object, id, amount_subtotal, amount_tax, amount_total, currency, description, price, quantity].hash
289
+ end
290
+
291
+ # Builds the object from hash
292
+ # @param [Hash] attributes Model attributes in the form of hash
293
+ # @return [Object] Returns the model itself
294
+ def self.build_from_hash(attributes)
295
+ return nil unless attributes.is_a?(Hash)
296
+ attributes = attributes.transform_keys(&:to_sym)
297
+ transformed_hash = {}
298
+ openapi_types.each_pair do |key, type|
299
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
300
+ transformed_hash["#{key}"] = nil
301
+ elsif type =~ /\AArray<(.*)>/i
302
+ # check to ensure the input is an array given that the attribute
303
+ # is documented as an array but the input is not
304
+ if attributes[attribute_map[key]].is_a?(Array)
305
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
306
+ end
307
+ elsif !attributes[attribute_map[key]].nil?
308
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
309
+ end
310
+ end
311
+ new(transformed_hash)
312
+ end
313
+
314
+ # Deserializes the data based on type
315
+ # @param string type Data type
316
+ # @param string value Value to be deserialized
317
+ # @return [Object] Deserialized data
318
+ def self._deserialize(type, value)
319
+ case type.to_sym
320
+ when :Time
321
+ Time.parse(value)
322
+ when :Date
323
+ Date.parse(value)
324
+ when :String
325
+ value.to_s
326
+ when :Integer
327
+ value.to_i
328
+ when :Float
329
+ value.to_f
330
+ when :Boolean
331
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
332
+ true
333
+ else
334
+ false
335
+ end
336
+ when :Object
337
+ # generic object (usually a Hash), return directly
338
+ value
339
+ when /\AArray<(?<inner_type>.+)>\z/
340
+ inner_type = Regexp.last_match[:inner_type]
341
+ value.map { |v| _deserialize(inner_type, v) }
342
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
343
+ k_type = Regexp.last_match[:k_type]
344
+ v_type = Regexp.last_match[:v_type]
345
+ {}.tap do |hash|
346
+ value.each do |k, v|
347
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
348
+ end
349
+ end
350
+ else # model
351
+ # models (e.g. Pet) or oneOf
352
+ klass = PAYJPv2.const_get(type)
353
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
354
+ end
355
+ end
356
+
357
+ # Returns the string representation of the object
358
+ # @return [String] String presentation of the object
359
+ def to_s
360
+ to_hash.to_s
361
+ end
362
+
363
+ # to_body is an alias to to_hash (backward compatibility)
364
+ # @return [Hash] Returns the object in the form of hash
365
+ def to_body
366
+ to_hash
367
+ end
368
+
369
+ # Returns the object in the form of hash
370
+ # @return [Hash] Returns the object in the form of hash
371
+ def to_hash
372
+ hash = {}
373
+ self.class.attribute_map.each_pair do |attr, param|
374
+ value = self.send(attr)
375
+ if value.nil?
376
+ is_nullable = self.class.openapi_nullable.include?(attr)
377
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
378
+ end
379
+
380
+ hash[param] = _to_hash(value)
381
+ end
382
+ hash
383
+ end
384
+
385
+ # Outputs non-array value in the form of hash
386
+ # For object, use to_hash. Otherwise, just return the value
387
+ # @param [Object] value Any valid value
388
+ # @return [Hash] Returns the value in the form of hash
389
+ def _to_hash(value)
390
+ if value.is_a?(Array)
391
+ value.compact.map { |v| _to_hash(v) }
392
+ elsif value.is_a?(Hash)
393
+ {}.tap do |hash|
394
+ value.each { |k, v| hash[k] = _to_hash(v) }
395
+ end
396
+ elsif value.respond_to? :to_hash
397
+ value.to_hash
398
+ else
399
+ value
400
+ end
401
+ end
402
+
403
+ end
404
+
405
+ 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 CheckoutSessionLineItemListResponse
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<CheckoutSessionLineItemDataResponse>'
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::CheckoutSessionLineItemListResponse` 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::CheckoutSessionLineItemListResponse`. 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