lago_ruby 0.46.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (553) hide show
  1. checksums.yaml +7 -0
  2. data/CODE_OF_CONDUCT.md +128 -0
  3. data/CONTRIBUTING.md +213 -0
  4. data/Gemfile +9 -0
  5. data/Gemfile.lock +72 -0
  6. data/LICENSE +21 -0
  7. data/README.md +343 -0
  8. data/Rakefile +10 -0
  9. data/docs/AddOn.md +18 -0
  10. data/docs/AddOnBaseInput.md +28 -0
  11. data/docs/AddOnCreateInput.md +18 -0
  12. data/docs/AddOnCreateInputAddOn.md +28 -0
  13. data/docs/AddOnObject.md +32 -0
  14. data/docs/AddOnUpdateInput.md +18 -0
  15. data/docs/AddOnsApi.md +433 -0
  16. data/docs/AddOnsPaginated.md +20 -0
  17. data/docs/ApiErrorBadRequest.md +20 -0
  18. data/docs/ApiErrorForbidden.md +22 -0
  19. data/docs/ApiErrorNotAllowed.md +22 -0
  20. data/docs/ApiErrorNotFound.md +22 -0
  21. data/docs/ApiErrorUnauthorized.md +20 -0
  22. data/docs/ApiErrorUnprocessableEntity.md +24 -0
  23. data/docs/AppliedAddOn.md +18 -0
  24. data/docs/AppliedAddOnInput.md +18 -0
  25. data/docs/AppliedAddOnInputAppliedAddOn.md +24 -0
  26. data/docs/AppliedAddOnObject.md +32 -0
  27. data/docs/AppliedCoupon.md +18 -0
  28. data/docs/AppliedCouponInput.md +18 -0
  29. data/docs/AppliedCouponInputAppliedCoupon.md +30 -0
  30. data/docs/AppliedCouponObject.md +50 -0
  31. data/docs/AppliedCouponObjectExtended.md +52 -0
  32. data/docs/AppliedCouponsPaginated.md +20 -0
  33. data/docs/BaseAppliedTax.md +34 -0
  34. data/docs/BillableMetric.md +18 -0
  35. data/docs/BillableMetricBaseInput.md +30 -0
  36. data/docs/BillableMetricCreateInput.md +18 -0
  37. data/docs/BillableMetricCreateInputBillableMetric.md +30 -0
  38. data/docs/BillableMetricGroup.md +20 -0
  39. data/docs/BillableMetricGroupValuesInner.md +49 -0
  40. data/docs/BillableMetricGroupValuesInnerOneOf.md +20 -0
  41. data/docs/BillableMetricObject.md +40 -0
  42. data/docs/BillableMetricUpdateInput.md +18 -0
  43. data/docs/BillableMetricsApi.md +439 -0
  44. data/docs/BillableMetricsPaginated.md +20 -0
  45. data/docs/ChargeObject.md +40 -0
  46. data/docs/ChargeObjectProperties.md +40 -0
  47. data/docs/ChargeProperties.md +40 -0
  48. data/docs/ChargePropertiesGraduatedPercentageRangesInner.md +24 -0
  49. data/docs/ChargePropertiesGraduatedRangesInner.md +24 -0
  50. data/docs/ChargePropertiesVolumeRangesInner.md +24 -0
  51. data/docs/Country.md +15 -0
  52. data/docs/Coupon.md +18 -0
  53. data/docs/CouponBaseInput.md +42 -0
  54. data/docs/CouponBaseInputAppliesTo.md +20 -0
  55. data/docs/CouponCreateInput.md +18 -0
  56. data/docs/CouponCreateInputCoupon.md +42 -0
  57. data/docs/CouponObject.md +52 -0
  58. data/docs/CouponUpdateInput.md +18 -0
  59. data/docs/CouponsApi.md +583 -0
  60. data/docs/CouponsPaginated.md +20 -0
  61. data/docs/CreateWebhookEndpoint200Response.md +18 -0
  62. data/docs/CreateWebhookEndpoint200ResponseWebhookEndpoint.md +26 -0
  63. data/docs/CreateWebhookEndpointRequest.md +18 -0
  64. data/docs/CreateWebhookEndpointRequestWebhookEndpoint.md +20 -0
  65. data/docs/CreditNote.md +18 -0
  66. data/docs/CreditNoteAppliedTaxObject.md +38 -0
  67. data/docs/CreditNoteCreateInput.md +18 -0
  68. data/docs/CreditNoteCreateInputCreditNote.md +28 -0
  69. data/docs/CreditNoteCreateInputCreditNoteItemsInner.md +20 -0
  70. data/docs/CreditNoteItemObject.md +24 -0
  71. data/docs/CreditNoteItemObjectFee.md +74 -0
  72. data/docs/CreditNoteObject.md +64 -0
  73. data/docs/CreditNoteUpdateInput.md +18 -0
  74. data/docs/CreditNoteUpdateInputCreditNote.md +18 -0
  75. data/docs/CreditNotes.md +18 -0
  76. data/docs/CreditNotesApi.md +435 -0
  77. data/docs/CreditObject.md +28 -0
  78. data/docs/CreditObjectInvoice.md +20 -0
  79. data/docs/CreditObjectItem.md +24 -0
  80. data/docs/Currency.md +15 -0
  81. data/docs/Customer.md +18 -0
  82. data/docs/CustomerBillingConfiguration.md +30 -0
  83. data/docs/CustomerChargeUsageObject.md +28 -0
  84. data/docs/CustomerChargeUsageObjectBillableMetric.md +24 -0
  85. data/docs/CustomerChargeUsageObjectCharge.md +20 -0
  86. data/docs/CustomerChargeUsageObjectGroupsInner.md +26 -0
  87. data/docs/CustomerCreateInput.md +18 -0
  88. data/docs/CustomerCreateInputCustomer.md +58 -0
  89. data/docs/CustomerCreateInputCustomerMetadataInner.md +24 -0
  90. data/docs/CustomerMetadata.md +26 -0
  91. data/docs/CustomerObject.md +68 -0
  92. data/docs/CustomerObjectExtended.md +70 -0
  93. data/docs/CustomerUsage.md +18 -0
  94. data/docs/CustomerUsageObject.md +32 -0
  95. data/docs/CustomersApi.md +505 -0
  96. data/docs/CustomersPaginated.md +20 -0
  97. data/docs/Event.md +18 -0
  98. data/docs/EventBatchInput.md +18 -0
  99. data/docs/EventBatchInputEvent.md +28 -0
  100. data/docs/EventBatchInputEventProperties.md +18 -0
  101. data/docs/EventEstimateFeesInput.md +18 -0
  102. data/docs/EventEstimateFeesInputEvent.md +24 -0
  103. data/docs/EventInput.md +18 -0
  104. data/docs/EventInputEvent.md +28 -0
  105. data/docs/EventObject.md +36 -0
  106. data/docs/EventsApi.md +285 -0
  107. data/docs/Fee.md +18 -0
  108. data/docs/FeeAppliedTaxObject.md +36 -0
  109. data/docs/FeeObject.md +74 -0
  110. data/docs/FeeObjectItem.md +26 -0
  111. data/docs/FeeUpdateInput.md +18 -0
  112. data/docs/FeeUpdateInputFee.md +18 -0
  113. data/docs/Fees.md +18 -0
  114. data/docs/FeesApi.md +253 -0
  115. data/docs/FeesPaginated.md +20 -0
  116. data/docs/FindAllWebhookEndpoints200Response.md +20 -0
  117. data/docs/GetCustomerPortalUrl200Response.md +18 -0
  118. data/docs/GetCustomerPortalUrl200ResponseCustomer.md +18 -0
  119. data/docs/GroupObject.md +22 -0
  120. data/docs/GroupPropertiesObject.md +20 -0
  121. data/docs/GroupPropertiesObjectValues.md +40 -0
  122. data/docs/GroupsPaginated.md +20 -0
  123. data/docs/Invoice.md +18 -0
  124. data/docs/InvoiceAppliedTaxObject.md +38 -0
  125. data/docs/InvoiceMetadataObject.md +24 -0
  126. data/docs/InvoiceObject.md +62 -0
  127. data/docs/InvoiceObjectCustomer.md +68 -0
  128. data/docs/InvoiceObjectExtended.md +68 -0
  129. data/docs/InvoiceOneOffCreateInput.md +18 -0
  130. data/docs/InvoiceOneOffCreateInputInvoice.md +22 -0
  131. data/docs/InvoiceOneOffCreateInputInvoiceFeesInner.md +26 -0
  132. data/docs/InvoiceUpdateInput.md +18 -0
  133. data/docs/InvoiceUpdateInputInvoice.md +20 -0
  134. data/docs/InvoiceUpdateInputInvoiceMetadataInner.md +22 -0
  135. data/docs/InvoicesApi.md +582 -0
  136. data/docs/InvoicesPaginated.md +20 -0
  137. data/docs/Organization.md +18 -0
  138. data/docs/OrganizationBillingConfiguration.md +22 -0
  139. data/docs/OrganizationObject.md +54 -0
  140. data/docs/OrganizationUpdateInput.md +18 -0
  141. data/docs/OrganizationUpdateInputOrganization.md +46 -0
  142. data/docs/OrganizationsApi.md +77 -0
  143. data/docs/PaginationMeta.md +26 -0
  144. data/docs/Plan.md +18 -0
  145. data/docs/PlanCreateInput.md +18 -0
  146. data/docs/PlanCreateInputPlan.md +38 -0
  147. data/docs/PlanCreateInputPlanChargesInner.md +34 -0
  148. data/docs/PlanCreateInputPlanChargesInnerGroupPropertiesInner.md +20 -0
  149. data/docs/PlanObject.md +46 -0
  150. data/docs/PlanUpdateInput.md +18 -0
  151. data/docs/PlanUpdateInputPlan.md +38 -0
  152. data/docs/PlanUpdateInputPlanChargesInner.md +36 -0
  153. data/docs/PlansApi.md +363 -0
  154. data/docs/PlansPaginated.md +20 -0
  155. data/docs/Subscription.md +18 -0
  156. data/docs/SubscriptionCreateInput.md +18 -0
  157. data/docs/SubscriptionCreateInputSubscription.md +28 -0
  158. data/docs/SubscriptionObject.md +48 -0
  159. data/docs/SubscriptionUpdateInput.md +18 -0
  160. data/docs/SubscriptionUpdateInputSubscription.md +20 -0
  161. data/docs/SubscriptionsApi.md +303 -0
  162. data/docs/SubscriptionsPaginated.md +20 -0
  163. data/docs/Tax.md +18 -0
  164. data/docs/TaxBaseInput.md +26 -0
  165. data/docs/TaxCreateInput.md +18 -0
  166. data/docs/TaxCreateInputTax.md +26 -0
  167. data/docs/TaxObject.md +38 -0
  168. data/docs/TaxUpdateInput.md +18 -0
  169. data/docs/TaxesApi.md +363 -0
  170. data/docs/TaxesPaginated.md +20 -0
  171. data/docs/Timezone.md +15 -0
  172. data/docs/Wallet.md +18 -0
  173. data/docs/WalletCreateInput.md +18 -0
  174. data/docs/WalletCreateInputWallet.md +30 -0
  175. data/docs/WalletObject.md +46 -0
  176. data/docs/WalletTransactionCreateInput.md +18 -0
  177. data/docs/WalletTransactionCreateInputWalletTransaction.md +22 -0
  178. data/docs/WalletTransactionObject.md +32 -0
  179. data/docs/WalletTransactions.md +18 -0
  180. data/docs/WalletTransactionsPaginated.md +20 -0
  181. data/docs/WalletUpdateInput.md +18 -0
  182. data/docs/WalletUpdateInputWallet.md +20 -0
  183. data/docs/WalletsApi.md +515 -0
  184. data/docs/WalletsPaginated.md +20 -0
  185. data/docs/WebhookEndpointsApi.md +363 -0
  186. data/docs/WebhooksApi.md +74 -0
  187. data/git_push.sh +57 -0
  188. data/lago_ruby.gemspec +42 -0
  189. data/lib/lago_ruby/api/add_ons_api.rb +421 -0
  190. data/lib/lago_ruby/api/billable_metrics_api.rb +422 -0
  191. data/lib/lago_ruby/api/coupons_api.rb +563 -0
  192. data/lib/lago_ruby/api/credit_notes_api.rb +419 -0
  193. data/lib/lago_ruby/api/customers_api.rb +481 -0
  194. data/lib/lago_ruby/api/events_api.rb +289 -0
  195. data/lib/lago_ruby/api/fees_api.rb +268 -0
  196. data/lib/lago_ruby/api/invoices_api.rb +565 -0
  197. data/lib/lago_ruby/api/organizations_api.rb +90 -0
  198. data/lib/lago_ruby/api/plans_api.rb +353 -0
  199. data/lib/lago_ruby/api/subscriptions_api.rb +306 -0
  200. data/lib/lago_ruby/api/taxes_api.rb +353 -0
  201. data/lib/lago_ruby/api/wallets_api.rb +503 -0
  202. data/lib/lago_ruby/api/webhook_endpoints_api.rb +353 -0
  203. data/lib/lago_ruby/api/webhooks_api.rb +79 -0
  204. data/lib/lago_ruby/api_client.rb +392 -0
  205. data/lib/lago_ruby/api_error.rb +58 -0
  206. data/lib/lago_ruby/configuration.rb +297 -0
  207. data/lib/lago_ruby/models/add_on.rb +221 -0
  208. data/lib/lago_ruby/models/add_on_base_input.rb +267 -0
  209. data/lib/lago_ruby/models/add_on_create_input.rb +221 -0
  210. data/lib/lago_ruby/models/add_on_create_input_add_on.rb +302 -0
  211. data/lib/lago_ruby/models/add_on_object.rb +329 -0
  212. data/lib/lago_ruby/models/add_on_update_input.rb +221 -0
  213. data/lib/lago_ruby/models/add_ons_paginated.rb +239 -0
  214. data/lib/lago_ruby/models/api_error_bad_request.rb +237 -0
  215. data/lib/lago_ruby/models/api_error_forbidden.rb +253 -0
  216. data/lib/lago_ruby/models/api_error_not_allowed.rb +253 -0
  217. data/lib/lago_ruby/models/api_error_not_found.rb +253 -0
  218. data/lib/lago_ruby/models/api_error_unauthorized.rb +237 -0
  219. data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +269 -0
  220. data/lib/lago_ruby/models/applied_add_on.rb +221 -0
  221. data/lib/lago_ruby/models/applied_add_on_input.rb +221 -0
  222. data/lib/lago_ruby/models/applied_add_on_input_applied_add_on.rb +259 -0
  223. data/lib/lago_ruby/models/applied_add_on_object.rb +339 -0
  224. data/lib/lago_ruby/models/applied_coupon.rb +221 -0
  225. data/lib/lago_ruby/models/applied_coupon_input.rb +221 -0
  226. data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +343 -0
  227. data/lib/lago_ruby/models/applied_coupon_object.rb +507 -0
  228. data/lib/lago_ruby/models/applied_coupon_object_extended.rb +532 -0
  229. data/lib/lago_ruby/models/applied_coupons_paginated.rb +239 -0
  230. data/lib/lago_ruby/models/base_applied_tax.rb +294 -0
  231. data/lib/lago_ruby/models/billable_metric.rb +221 -0
  232. data/lib/lago_ruby/models/billable_metric_base_input.rb +310 -0
  233. data/lib/lago_ruby/models/billable_metric_create_input.rb +221 -0
  234. data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +338 -0
  235. data/lib/lago_ruby/models/billable_metric_group.rb +242 -0
  236. data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +105 -0
  237. data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +242 -0
  238. data/lib/lago_ruby/models/billable_metric_object.rb +423 -0
  239. data/lib/lago_ruby/models/billable_metric_update_input.rb +221 -0
  240. data/lib/lago_ruby/models/billable_metrics_paginated.rb +239 -0
  241. data/lib/lago_ruby/models/charge_object.rb +397 -0
  242. data/lib/lago_ruby/models/charge_object_properties.rb +422 -0
  243. data/lib/lago_ruby/models/charge_properties.rb +415 -0
  244. data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +269 -0
  245. data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +311 -0
  246. data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +311 -0
  247. data/lib/lago_ruby/models/country.rb +287 -0
  248. data/lib/lago_ruby/models/coupon.rb +221 -0
  249. data/lib/lago_ruby/models/coupon_base_input.rb +414 -0
  250. data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +232 -0
  251. data/lib/lago_ruby/models/coupon_create_input.rb +221 -0
  252. data/lib/lago_ruby/models/coupon_create_input_coupon.rb +449 -0
  253. data/lib/lago_ruby/models/coupon_object.rb +538 -0
  254. data/lib/lago_ruby/models/coupon_update_input.rb +221 -0
  255. data/lib/lago_ruby/models/coupons_paginated.rb +239 -0
  256. data/lib/lago_ruby/models/create_webhook_endpoint200_response.rb +221 -0
  257. data/lib/lago_ruby/models/create_webhook_endpoint200_response_webhook_endpoint.rb +317 -0
  258. data/lib/lago_ruby/models/create_webhook_endpoint_request.rb +214 -0
  259. data/lib/lago_ruby/models/create_webhook_endpoint_request_webhook_endpoint.rb +267 -0
  260. data/lib/lago_ruby/models/credit_note.rb +221 -0
  261. data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +320 -0
  262. data/lib/lago_ruby/models/credit_note_create_input.rb +221 -0
  263. data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +318 -0
  264. data/lib/lago_ruby/models/credit_note_create_input_credit_note_items_inner.rb +239 -0
  265. data/lib/lago_ruby/models/credit_note_item_object.rb +271 -0
  266. data/lib/lago_ruby/models/credit_note_item_object_fee.rb +628 -0
  267. data/lib/lago_ruby/models/credit_note_object.rb +635 -0
  268. data/lib/lago_ruby/models/credit_note_update_input.rb +221 -0
  269. data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +256 -0
  270. data/lib/lago_ruby/models/credit_notes.rb +223 -0
  271. data/lib/lago_ruby/models/credit_object.rb +304 -0
  272. data/lib/lago_ruby/models/credit_object_invoice.rb +271 -0
  273. data/lib/lago_ruby/models/credit_object_item.rb +308 -0
  274. data/lib/lago_ruby/models/currency.rb +175 -0
  275. data/lib/lago_ruby/models/customer.rb +221 -0
  276. data/lib/lago_ruby/models/customer_billing_configuration.rb +313 -0
  277. data/lib/lago_ruby/models/customer_charge_usage_object.rb +327 -0
  278. data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +308 -0
  279. data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +274 -0
  280. data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +277 -0
  281. data/lib/lago_ruby/models/customer_create_input.rb +221 -0
  282. data/lib/lago_ruby/models/customer_create_input_customer.rb +436 -0
  283. data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +266 -0
  284. data/lib/lago_ruby/models/customer_metadata.rb +291 -0
  285. data/lib/lago_ruby/models/customer_object.rb +517 -0
  286. data/lib/lago_ruby/models/customer_object_extended.rb +536 -0
  287. data/lib/lago_ruby/models/customer_usage.rb +221 -0
  288. data/lib/lago_ruby/models/customer_usage_object.rb +335 -0
  289. data/lib/lago_ruby/models/customers_paginated.rb +239 -0
  290. data/lib/lago_ruby/models/event.rb +221 -0
  291. data/lib/lago_ruby/models/event_batch_input.rb +221 -0
  292. data/lib/lago_ruby/models/event_batch_input_event.rb +287 -0
  293. data/lib/lago_ruby/models/event_batch_input_event_properties.rb +250 -0
  294. data/lib/lago_ruby/models/event_estimate_fees_input.rb +221 -0
  295. data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +252 -0
  296. data/lib/lago_ruby/models/event_input.rb +221 -0
  297. data/lib/lago_ruby/models/event_input_event.rb +278 -0
  298. data/lib/lago_ruby/models/event_object.rb +367 -0
  299. data/lib/lago_ruby/models/fee.rb +221 -0
  300. data/lib/lago_ruby/models/fee_applied_tax_object.rb +311 -0
  301. data/lib/lago_ruby/models/fee_object.rb +621 -0
  302. data/lib/lago_ruby/models/fee_object_item.rb +337 -0
  303. data/lib/lago_ruby/models/fee_update_input.rb +221 -0
  304. data/lib/lago_ruby/models/fee_update_input_fee.rb +256 -0
  305. data/lib/lago_ruby/models/fees.rb +223 -0
  306. data/lib/lago_ruby/models/fees_paginated.rb +246 -0
  307. data/lib/lago_ruby/models/find_all_webhook_endpoints200_response.rb +239 -0
  308. data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +221 -0
  309. data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +222 -0
  310. data/lib/lago_ruby/models/group_object.rb +256 -0
  311. data/lib/lago_ruby/models/group_properties_object.rb +238 -0
  312. data/lib/lago_ruby/models/group_properties_object_values.rb +422 -0
  313. data/lib/lago_ruby/models/groups_paginated.rb +239 -0
  314. data/lib/lago_ruby/models/invoice.rb +221 -0
  315. data/lib/lago_ruby/models/invoice_applied_tax_object.rb +321 -0
  316. data/lib/lago_ruby/models/invoice_metadata_object.rb +245 -0
  317. data/lib/lago_ruby/models/invoice_object.rb +611 -0
  318. data/lib/lago_ruby/models/invoice_object_customer.rb +524 -0
  319. data/lib/lago_ruby/models/invoice_object_extended.rb +651 -0
  320. data/lib/lago_ruby/models/invoice_one_off_create_input.rb +221 -0
  321. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +249 -0
  322. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +284 -0
  323. data/lib/lago_ruby/models/invoice_update_input.rb +221 -0
  324. data/lib/lago_ruby/models/invoice_update_input_invoice.rb +260 -0
  325. data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +235 -0
  326. data/lib/lago_ruby/models/invoices_paginated.rb +239 -0
  327. data/lib/lago_ruby/models/organization.rb +221 -0
  328. data/lib/lago_ruby/models/organization_billing_configuration.rb +237 -0
  329. data/lib/lago_ruby/models/organization_object.rb +431 -0
  330. data/lib/lago_ruby/models/organization_update_input.rb +221 -0
  331. data/lib/lago_ruby/models/organization_update_input_organization.rb +386 -0
  332. data/lib/lago_ruby/models/pagination_meta.rb +278 -0
  333. data/lib/lago_ruby/models/plan.rb +221 -0
  334. data/lib/lago_ruby/models/plan_create_input.rb +221 -0
  335. data/lib/lago_ruby/models/plan_create_input_plan.rb +353 -0
  336. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +332 -0
  337. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +238 -0
  338. data/lib/lago_ruby/models/plan_object.rb +456 -0
  339. data/lib/lago_ruby/models/plan_update_input.rb +221 -0
  340. data/lib/lago_ruby/models/plan_update_input_plan.rb +353 -0
  341. data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +342 -0
  342. data/lib/lago_ruby/models/plans_paginated.rb +239 -0
  343. data/lib/lago_ruby/models/subscription.rb +221 -0
  344. data/lib/lago_ruby/models/subscription_create_input.rb +221 -0
  345. data/lib/lago_ruby/models/subscription_create_input_subscription.rb +320 -0
  346. data/lib/lago_ruby/models/subscription_object.rb +481 -0
  347. data/lib/lago_ruby/models/subscription_update_input.rb +221 -0
  348. data/lib/lago_ruby/models/subscription_update_input_subscription.rb +226 -0
  349. data/lib/lago_ruby/models/subscriptions_paginated.rb +239 -0
  350. data/lib/lago_ruby/models/tax.rb +221 -0
  351. data/lib/lago_ruby/models/tax_base_input.rb +277 -0
  352. data/lib/lago_ruby/models/tax_create_input.rb +221 -0
  353. data/lib/lago_ruby/models/tax_create_input_tax.rb +305 -0
  354. data/lib/lago_ruby/models/tax_object.rb +364 -0
  355. data/lib/lago_ruby/models/tax_update_input.rb +221 -0
  356. data/lib/lago_ruby/models/taxes_paginated.rb +239 -0
  357. data/lib/lago_ruby/models/timezone.rb +173 -0
  358. data/lib/lago_ruby/models/wallet.rb +221 -0
  359. data/lib/lago_ruby/models/wallet_create_input.rb +214 -0
  360. data/lib/lago_ruby/models/wallet_create_input_wallet.rb +353 -0
  361. data/lib/lago_ruby/models/wallet_object.rb +525 -0
  362. data/lib/lago_ruby/models/wallet_transaction_create_input.rb +221 -0
  363. data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +284 -0
  364. data/lib/lago_ruby/models/wallet_transaction_object.rb +422 -0
  365. data/lib/lago_ruby/models/wallet_transactions.rb +223 -0
  366. data/lib/lago_ruby/models/wallet_transactions_paginated.rb +246 -0
  367. data/lib/lago_ruby/models/wallet_update_input.rb +221 -0
  368. data/lib/lago_ruby/models/wallet_update_input_wallet.rb +227 -0
  369. data/lib/lago_ruby/models/wallets_paginated.rb +239 -0
  370. data/lib/lago_ruby/version.rb +15 -0
  371. data/lib/lago_ruby.rb +217 -0
  372. data/spec/api/add_ons_api_spec.rb +109 -0
  373. data/spec/api/billable_metrics_api_spec.rb +111 -0
  374. data/spec/api/coupons_api_spec.rb +137 -0
  375. data/spec/api/credit_notes_api_spec.rb +110 -0
  376. data/spec/api/customers_api_spec.rb +122 -0
  377. data/spec/api/events_api_spec.rb +83 -0
  378. data/spec/api/fees_api_spec.rb +87 -0
  379. data/spec/api/invoices_api_spec.rb +138 -0
  380. data/spec/api/organizations_api_spec.rb +47 -0
  381. data/spec/api/plans_api_spec.rb +97 -0
  382. data/spec/api/subscriptions_api_spec.rb +89 -0
  383. data/spec/api/taxes_api_spec.rb +97 -0
  384. data/spec/api/wallets_api_spec.rb +126 -0
  385. data/spec/api/webhook_endpoints_api_spec.rb +97 -0
  386. data/spec/api/webhooks_api_spec.rb +46 -0
  387. data/spec/api_client_spec.rb +228 -0
  388. data/spec/configuration_spec.rb +42 -0
  389. data/spec/models/add_on_base_input_spec.rb +64 -0
  390. data/spec/models/add_on_create_input_add_on_spec.rb +64 -0
  391. data/spec/models/add_on_create_input_spec.rb +34 -0
  392. data/spec/models/add_on_object_spec.rb +76 -0
  393. data/spec/models/add_on_spec.rb +34 -0
  394. data/spec/models/add_on_update_input_spec.rb +34 -0
  395. data/spec/models/add_ons_paginated_spec.rb +40 -0
  396. data/spec/models/api_error_bad_request_spec.rb +40 -0
  397. data/spec/models/api_error_forbidden_spec.rb +46 -0
  398. data/spec/models/api_error_not_allowed_spec.rb +46 -0
  399. data/spec/models/api_error_not_found_spec.rb +46 -0
  400. data/spec/models/api_error_unauthorized_spec.rb +40 -0
  401. data/spec/models/api_error_unprocessable_entity_spec.rb +52 -0
  402. data/spec/models/applied_add_on_input_applied_add_on_spec.rb +52 -0
  403. data/spec/models/applied_add_on_input_spec.rb +34 -0
  404. data/spec/models/applied_add_on_object_spec.rb +76 -0
  405. data/spec/models/applied_add_on_spec.rb +34 -0
  406. data/spec/models/applied_coupon_input_applied_coupon_spec.rb +74 -0
  407. data/spec/models/applied_coupon_input_spec.rb +34 -0
  408. data/spec/models/applied_coupon_object_extended_spec.rb +144 -0
  409. data/spec/models/applied_coupon_object_spec.rb +138 -0
  410. data/spec/models/applied_coupon_spec.rb +34 -0
  411. data/spec/models/applied_coupons_paginated_spec.rb +40 -0
  412. data/spec/models/base_applied_tax_spec.rb +82 -0
  413. data/spec/models/billable_metric_base_input_spec.rb +74 -0
  414. data/spec/models/billable_metric_create_input_billable_metric_spec.rb +74 -0
  415. data/spec/models/billable_metric_create_input_spec.rb +34 -0
  416. data/spec/models/billable_metric_group_spec.rb +40 -0
  417. data/spec/models/billable_metric_group_values_inner_one_of_spec.rb +40 -0
  418. data/spec/models/billable_metric_group_values_inner_spec.rb +31 -0
  419. data/spec/models/billable_metric_object_spec.rb +104 -0
  420. data/spec/models/billable_metric_spec.rb +34 -0
  421. data/spec/models/billable_metric_update_input_spec.rb +34 -0
  422. data/spec/models/billable_metrics_paginated_spec.rb +40 -0
  423. data/spec/models/charge_object_properties_spec.rb +100 -0
  424. data/spec/models/charge_object_spec.rb +104 -0
  425. data/spec/models/charge_properties_graduated_percentage_ranges_inner_spec.rb +52 -0
  426. data/spec/models/charge_properties_graduated_ranges_inner_spec.rb +59 -0
  427. data/spec/models/charge_properties_spec.rb +100 -0
  428. data/spec/models/charge_properties_volume_ranges_inner_spec.rb +59 -0
  429. data/spec/models/country_spec.rb +28 -0
  430. data/spec/models/coupon_base_input_applies_to_spec.rb +40 -0
  431. data/spec/models/coupon_base_input_spec.rb +118 -0
  432. data/spec/models/coupon_create_input_coupon_spec.rb +118 -0
  433. data/spec/models/coupon_create_input_spec.rb +34 -0
  434. data/spec/models/coupon_object_spec.rb +148 -0
  435. data/spec/models/coupon_spec.rb +34 -0
  436. data/spec/models/coupon_update_input_spec.rb +34 -0
  437. data/spec/models/coupons_paginated_spec.rb +40 -0
  438. data/spec/models/create_webhook_endpoint200_response_spec.rb +34 -0
  439. data/spec/models/create_webhook_endpoint200_response_webhook_endpoint_spec.rb +62 -0
  440. data/spec/models/create_webhook_endpoint_request_spec.rb +34 -0
  441. data/spec/models/create_webhook_endpoint_request_webhook_endpoint_spec.rb +44 -0
  442. data/spec/models/credit_note_applied_tax_object_spec.rb +94 -0
  443. data/spec/models/credit_note_create_input_credit_note_items_inner_spec.rb +40 -0
  444. data/spec/models/credit_note_create_input_credit_note_spec.rb +68 -0
  445. data/spec/models/credit_note_create_input_spec.rb +34 -0
  446. data/spec/models/credit_note_item_object_fee_spec.rb +206 -0
  447. data/spec/models/credit_note_item_object_spec.rb +52 -0
  448. data/spec/models/credit_note_object_spec.rb +184 -0
  449. data/spec/models/credit_note_spec.rb +34 -0
  450. data/spec/models/credit_note_update_input_credit_note_spec.rb +38 -0
  451. data/spec/models/credit_note_update_input_spec.rb +34 -0
  452. data/spec/models/credit_notes_spec.rb +34 -0
  453. data/spec/models/credit_object_invoice_spec.rb +44 -0
  454. data/spec/models/credit_object_item_spec.rb +56 -0
  455. data/spec/models/credit_object_spec.rb +64 -0
  456. data/spec/models/currency_spec.rb +28 -0
  457. data/spec/models/customer_billing_configuration_spec.rb +74 -0
  458. data/spec/models/customer_charge_usage_object_billable_metric_spec.rb +56 -0
  459. data/spec/models/customer_charge_usage_object_charge_spec.rb +44 -0
  460. data/spec/models/customer_charge_usage_object_groups_inner_spec.rb +58 -0
  461. data/spec/models/customer_charge_usage_object_spec.rb +89 -0
  462. data/spec/models/customer_create_input_customer_metadata_inner_spec.rb +52 -0
  463. data/spec/models/customer_create_input_customer_spec.rb +154 -0
  464. data/spec/models/customer_create_input_spec.rb +34 -0
  465. data/spec/models/customer_metadata_spec.rb +58 -0
  466. data/spec/models/customer_object_extended_spec.rb +190 -0
  467. data/spec/models/customer_object_spec.rb +184 -0
  468. data/spec/models/customer_spec.rb +34 -0
  469. data/spec/models/customer_usage_object_spec.rb +76 -0
  470. data/spec/models/customer_usage_spec.rb +34 -0
  471. data/spec/models/customers_paginated_spec.rb +40 -0
  472. data/spec/models/event_batch_input_event_properties_spec.rb +38 -0
  473. data/spec/models/event_batch_input_event_spec.rb +64 -0
  474. data/spec/models/event_batch_input_spec.rb +34 -0
  475. data/spec/models/event_estimate_fees_input_event_spec.rb +52 -0
  476. data/spec/models/event_estimate_fees_input_spec.rb +34 -0
  477. data/spec/models/event_input_event_spec.rb +64 -0
  478. data/spec/models/event_input_spec.rb +34 -0
  479. data/spec/models/event_object_spec.rb +88 -0
  480. data/spec/models/event_spec.rb +34 -0
  481. data/spec/models/fee_applied_tax_object_spec.rb +88 -0
  482. data/spec/models/fee_object_item_spec.rb +66 -0
  483. data/spec/models/fee_object_spec.rb +206 -0
  484. data/spec/models/fee_spec.rb +34 -0
  485. data/spec/models/fee_update_input_fee_spec.rb +38 -0
  486. data/spec/models/fee_update_input_spec.rb +34 -0
  487. data/spec/models/fees_paginated_spec.rb +40 -0
  488. data/spec/models/fees_spec.rb +34 -0
  489. data/spec/models/find_all_webhook_endpoints200_response_spec.rb +40 -0
  490. data/spec/models/get_customer_portal_url200_response_customer_spec.rb +34 -0
  491. data/spec/models/get_customer_portal_url200_response_spec.rb +34 -0
  492. data/spec/models/group_object_spec.rb +46 -0
  493. data/spec/models/group_properties_object_spec.rb +40 -0
  494. data/spec/models/group_properties_object_values_spec.rb +100 -0
  495. data/spec/models/groups_paginated_spec.rb +40 -0
  496. data/spec/models/invoice_applied_tax_object_spec.rb +94 -0
  497. data/spec/models/invoice_metadata_object_spec.rb +52 -0
  498. data/spec/models/invoice_object_customer_spec.rb +184 -0
  499. data/spec/models/invoice_object_extended_spec.rb +196 -0
  500. data/spec/models/invoice_object_spec.rb +178 -0
  501. data/spec/models/invoice_one_off_create_input_invoice_fees_inner_spec.rb +58 -0
  502. data/spec/models/invoice_one_off_create_input_invoice_spec.rb +46 -0
  503. data/spec/models/invoice_one_off_create_input_spec.rb +34 -0
  504. data/spec/models/invoice_spec.rb +34 -0
  505. data/spec/models/invoice_update_input_invoice_metadata_inner_spec.rb +46 -0
  506. data/spec/models/invoice_update_input_invoice_spec.rb +44 -0
  507. data/spec/models/invoice_update_input_spec.rb +34 -0
  508. data/spec/models/invoices_paginated_spec.rb +40 -0
  509. data/spec/models/organization_billing_configuration_spec.rb +46 -0
  510. data/spec/models/organization_object_spec.rb +142 -0
  511. data/spec/models/organization_spec.rb +34 -0
  512. data/spec/models/organization_update_input_organization_spec.rb +122 -0
  513. data/spec/models/organization_update_input_spec.rb +34 -0
  514. data/spec/models/pagination_meta_spec.rb +58 -0
  515. data/spec/models/plan_create_input_plan_charges_inner_group_properties_inner_spec.rb +40 -0
  516. data/spec/models/plan_create_input_plan_charges_inner_spec.rb +86 -0
  517. data/spec/models/plan_create_input_plan_spec.rb +98 -0
  518. data/spec/models/plan_create_input_spec.rb +34 -0
  519. data/spec/models/plan_object_spec.rb +122 -0
  520. data/spec/models/plan_spec.rb +34 -0
  521. data/spec/models/plan_update_input_plan_charges_inner_spec.rb +92 -0
  522. data/spec/models/plan_update_input_plan_spec.rb +98 -0
  523. data/spec/models/plan_update_input_spec.rb +34 -0
  524. data/spec/models/plans_paginated_spec.rb +40 -0
  525. data/spec/models/subscription_create_input_spec.rb +34 -0
  526. data/spec/models/subscription_create_input_subscription_spec.rb +68 -0
  527. data/spec/models/subscription_object_spec.rb +132 -0
  528. data/spec/models/subscription_spec.rb +34 -0
  529. data/spec/models/subscription_update_input_spec.rb +34 -0
  530. data/spec/models/subscription_update_input_subscription_spec.rb +40 -0
  531. data/spec/models/subscriptions_paginated_spec.rb +40 -0
  532. data/spec/models/tax_base_input_spec.rb +58 -0
  533. data/spec/models/tax_create_input_spec.rb +34 -0
  534. data/spec/models/tax_create_input_tax_spec.rb +66 -0
  535. data/spec/models/tax_object_spec.rb +94 -0
  536. data/spec/models/tax_spec.rb +34 -0
  537. data/spec/models/tax_update_input_spec.rb +34 -0
  538. data/spec/models/taxes_paginated_spec.rb +40 -0
  539. data/spec/models/timezone_spec.rb +28 -0
  540. data/spec/models/wallet_create_input_spec.rb +34 -0
  541. data/spec/models/wallet_create_input_wallet_spec.rb +80 -0
  542. data/spec/models/wallet_object_spec.rb +140 -0
  543. data/spec/models/wallet_spec.rb +34 -0
  544. data/spec/models/wallet_transaction_create_input_spec.rb +34 -0
  545. data/spec/models/wallet_transaction_create_input_wallet_transaction_spec.rb +46 -0
  546. data/spec/models/wallet_transaction_object_spec.rb +95 -0
  547. data/spec/models/wallet_transactions_paginated_spec.rb +40 -0
  548. data/spec/models/wallet_transactions_spec.rb +34 -0
  549. data/spec/models/wallet_update_input_spec.rb +34 -0
  550. data/spec/models/wallet_update_input_wallet_spec.rb +40 -0
  551. data/spec/models/wallets_paginated_spec.rb +40 -0
  552. data/spec/spec_helper.rb +111 -0
  553. metadata +818 -0
@@ -0,0 +1,532 @@
1
+ =begin
2
+ #Lago API documentation
3
+
4
+ #Lago API allows your application to push customer information and metrics (events) from your application to the billing application.
5
+
6
+ The version of the OpenAPI document: 0.46.0-beta
7
+ Contact: tech@getlago.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LagoAPI
17
+ class AppliedCouponObjectExtended
18
+ # Unique identifier of the applied coupon, created by Lago.
19
+ attr_accessor :lago_id
20
+
21
+ # Unique identifier of the coupon, created by Lago.
22
+ attr_accessor :lago_coupon_id
23
+
24
+ # Unique code used to identify the coupon.
25
+ attr_accessor :coupon_code
26
+
27
+ # The name of the coupon.
28
+ attr_accessor :coupon_name
29
+
30
+ # Unique identifier of the customer, created by Lago.
31
+ attr_accessor :lago_customer_id
32
+
33
+ # The customer external unique identifier (provided by your own application)
34
+ attr_accessor :external_customer_id
35
+
36
+ # The status of the coupon. Can be either `active` or `terminated`.
37
+ attr_accessor :status
38
+
39
+ # The amount of the coupon in cents. This field is required only for coupon with `fixed_amount` type.
40
+ attr_accessor :amount_cents
41
+
42
+ # The remaining amount in cents for a `fixed_amount` coupon with a frequency set to `once`. This field indicates the remaining balance or value that can still be utilized from the coupon.
43
+ attr_accessor :amount_cents_remaining
44
+
45
+ attr_accessor :amount_currency
46
+
47
+ # The percentage rate of the coupon. This field is required only for coupons with a `percentage` coupon type.
48
+ attr_accessor :percentage_rate
49
+
50
+ # The type of frequency for the coupon. It can have three possible values: `once`, `recurring` or `forever`. - If set to `once`, the coupon is applicable only for a single use. - If set to `recurring`, the coupon can be used multiple times for recurring billing periods. - If set to `forever`, the coupon has unlimited usage and can be applied indefinitely.
51
+ attr_accessor :frequency
52
+
53
+ # Specifies the number of billing periods to which the coupon applies. This field is required only for coupons with a `recurring` frequency type
54
+ attr_accessor :frequency_duration
55
+
56
+ # The remaining number of billing periods to which the coupon is applicable. This field determines the remaining usage or availability of the coupon based on the remaining billing periods.
57
+ attr_accessor :frequency_duration_remaining
58
+
59
+ # The date and time after which the coupon will stop applying to customer's invoices. Once the expiration date is reached, the coupon will no longer be applicable, and any further invoices generated for the customer will not include the coupon discount.
60
+ attr_accessor :expiration_at
61
+
62
+ # The date and time when the coupon was assigned to a customer. It is expressed in UTC format according to the ISO 8601 datetime standard.
63
+ attr_accessor :created_at
64
+
65
+ # This field indicates the specific moment when the coupon amount is fully utilized or when the coupon is removed from the customer's coupon list. It is expressed in UTC format according to the ISO 8601 datetime standard.
66
+ attr_accessor :terminated_at
67
+
68
+ attr_accessor :credits
69
+
70
+ class EnumAttributeValidator
71
+ attr_reader :datatype
72
+ attr_reader :allowable_values
73
+
74
+ def initialize(datatype, allowable_values)
75
+ @allowable_values = allowable_values.map do |value|
76
+ case datatype.to_s
77
+ when /Integer/i
78
+ value.to_i
79
+ when /Float/i
80
+ value.to_f
81
+ else
82
+ value
83
+ end
84
+ end
85
+ end
86
+
87
+ def valid?(value)
88
+ !value || allowable_values.include?(value)
89
+ end
90
+ end
91
+
92
+ # Attribute mapping from ruby-style variable name to JSON key.
93
+ def self.attribute_map
94
+ {
95
+ :'lago_id' => :'lago_id',
96
+ :'lago_coupon_id' => :'lago_coupon_id',
97
+ :'coupon_code' => :'coupon_code',
98
+ :'coupon_name' => :'coupon_name',
99
+ :'lago_customer_id' => :'lago_customer_id',
100
+ :'external_customer_id' => :'external_customer_id',
101
+ :'status' => :'status',
102
+ :'amount_cents' => :'amount_cents',
103
+ :'amount_cents_remaining' => :'amount_cents_remaining',
104
+ :'amount_currency' => :'amount_currency',
105
+ :'percentage_rate' => :'percentage_rate',
106
+ :'frequency' => :'frequency',
107
+ :'frequency_duration' => :'frequency_duration',
108
+ :'frequency_duration_remaining' => :'frequency_duration_remaining',
109
+ :'expiration_at' => :'expiration_at',
110
+ :'created_at' => :'created_at',
111
+ :'terminated_at' => :'terminated_at',
112
+ :'credits' => :'credits'
113
+ }
114
+ end
115
+
116
+ # Returns all the JSON keys this model knows about
117
+ def self.acceptable_attributes
118
+ attribute_map.values
119
+ end
120
+
121
+ # Attribute type mapping.
122
+ def self.openapi_types
123
+ {
124
+ :'lago_id' => :'String',
125
+ :'lago_coupon_id' => :'String',
126
+ :'coupon_code' => :'String',
127
+ :'coupon_name' => :'String',
128
+ :'lago_customer_id' => :'String',
129
+ :'external_customer_id' => :'String',
130
+ :'status' => :'String',
131
+ :'amount_cents' => :'Integer',
132
+ :'amount_cents_remaining' => :'Integer',
133
+ :'amount_currency' => :'Currency',
134
+ :'percentage_rate' => :'String',
135
+ :'frequency' => :'String',
136
+ :'frequency_duration' => :'Integer',
137
+ :'frequency_duration_remaining' => :'Integer',
138
+ :'expiration_at' => :'Time',
139
+ :'created_at' => :'Time',
140
+ :'terminated_at' => :'Time',
141
+ :'credits' => :'Array<CreditObject>'
142
+ }
143
+ end
144
+
145
+ # List of attributes with nullable: true
146
+ def self.openapi_nullable
147
+ Set.new([
148
+ :'amount_cents',
149
+ :'amount_cents_remaining',
150
+ :'percentage_rate',
151
+ :'frequency_duration',
152
+ :'frequency_duration_remaining',
153
+ :'expiration_at',
154
+ :'terminated_at',
155
+ ])
156
+ end
157
+
158
+ # List of class defined in allOf (OpenAPI v3)
159
+ def self.openapi_all_of
160
+ [
161
+ :'AppliedCouponObject'
162
+ ]
163
+ end
164
+
165
+ # Initializes the object
166
+ # @param [Hash] attributes Model attributes in the form of hash
167
+ def initialize(attributes = {})
168
+ if (!attributes.is_a?(Hash))
169
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::AppliedCouponObjectExtended` initialize method"
170
+ end
171
+
172
+ # check to see if the attribute exists and convert string to symbol for hash key
173
+ attributes = attributes.each_with_object({}) { |(k, v), h|
174
+ if (!self.class.attribute_map.key?(k.to_sym))
175
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::AppliedCouponObjectExtended`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
176
+ end
177
+ h[k.to_sym] = v
178
+ }
179
+
180
+ if attributes.key?(:'lago_id')
181
+ self.lago_id = attributes[:'lago_id']
182
+ else
183
+ self.lago_id = nil
184
+ end
185
+
186
+ if attributes.key?(:'lago_coupon_id')
187
+ self.lago_coupon_id = attributes[:'lago_coupon_id']
188
+ else
189
+ self.lago_coupon_id = nil
190
+ end
191
+
192
+ if attributes.key?(:'coupon_code')
193
+ self.coupon_code = attributes[:'coupon_code']
194
+ else
195
+ self.coupon_code = nil
196
+ end
197
+
198
+ if attributes.key?(:'coupon_name')
199
+ self.coupon_name = attributes[:'coupon_name']
200
+ else
201
+ self.coupon_name = nil
202
+ end
203
+
204
+ if attributes.key?(:'lago_customer_id')
205
+ self.lago_customer_id = attributes[:'lago_customer_id']
206
+ else
207
+ self.lago_customer_id = nil
208
+ end
209
+
210
+ if attributes.key?(:'external_customer_id')
211
+ self.external_customer_id = attributes[:'external_customer_id']
212
+ else
213
+ self.external_customer_id = nil
214
+ end
215
+
216
+ if attributes.key?(:'status')
217
+ self.status = attributes[:'status']
218
+ else
219
+ self.status = nil
220
+ end
221
+
222
+ if attributes.key?(:'amount_cents')
223
+ self.amount_cents = attributes[:'amount_cents']
224
+ end
225
+
226
+ if attributes.key?(:'amount_cents_remaining')
227
+ self.amount_cents_remaining = attributes[:'amount_cents_remaining']
228
+ end
229
+
230
+ if attributes.key?(:'amount_currency')
231
+ self.amount_currency = attributes[:'amount_currency']
232
+ end
233
+
234
+ if attributes.key?(:'percentage_rate')
235
+ self.percentage_rate = attributes[:'percentage_rate']
236
+ end
237
+
238
+ if attributes.key?(:'frequency')
239
+ self.frequency = attributes[:'frequency']
240
+ else
241
+ self.frequency = nil
242
+ end
243
+
244
+ if attributes.key?(:'frequency_duration')
245
+ self.frequency_duration = attributes[:'frequency_duration']
246
+ end
247
+
248
+ if attributes.key?(:'frequency_duration_remaining')
249
+ self.frequency_duration_remaining = attributes[:'frequency_duration_remaining']
250
+ end
251
+
252
+ if attributes.key?(:'expiration_at')
253
+ self.expiration_at = attributes[:'expiration_at']
254
+ end
255
+
256
+ if attributes.key?(:'created_at')
257
+ self.created_at = attributes[:'created_at']
258
+ else
259
+ self.created_at = nil
260
+ end
261
+
262
+ if attributes.key?(:'terminated_at')
263
+ self.terminated_at = attributes[:'terminated_at']
264
+ end
265
+
266
+ if attributes.key?(:'credits')
267
+ if (value = attributes[:'credits']).is_a?(Array)
268
+ self.credits = value
269
+ end
270
+ else
271
+ self.credits = nil
272
+ end
273
+ end
274
+
275
+ # Show invalid properties with the reasons. Usually used together with valid?
276
+ # @return Array for valid properties with the reasons
277
+ def list_invalid_properties
278
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
279
+ invalid_properties = Array.new
280
+ if @lago_id.nil?
281
+ invalid_properties.push('invalid value for "lago_id", lago_id cannot be nil.')
282
+ end
283
+
284
+ if @lago_coupon_id.nil?
285
+ invalid_properties.push('invalid value for "lago_coupon_id", lago_coupon_id cannot be nil.')
286
+ end
287
+
288
+ if @coupon_code.nil?
289
+ invalid_properties.push('invalid value for "coupon_code", coupon_code cannot be nil.')
290
+ end
291
+
292
+ if @coupon_name.nil?
293
+ invalid_properties.push('invalid value for "coupon_name", coupon_name cannot be nil.')
294
+ end
295
+
296
+ if @lago_customer_id.nil?
297
+ invalid_properties.push('invalid value for "lago_customer_id", lago_customer_id cannot be nil.')
298
+ end
299
+
300
+ if @external_customer_id.nil?
301
+ invalid_properties.push('invalid value for "external_customer_id", external_customer_id cannot be nil.')
302
+ end
303
+
304
+ if @status.nil?
305
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
306
+ end
307
+
308
+ pattern = Regexp.new(/^[0-9]+.?[0-9]*$/)
309
+ if !@percentage_rate.nil? && @percentage_rate !~ pattern
310
+ invalid_properties.push("invalid value for \"percentage_rate\", must conform to the pattern #{pattern}.")
311
+ end
312
+
313
+ if @frequency.nil?
314
+ invalid_properties.push('invalid value for "frequency", frequency cannot be nil.')
315
+ end
316
+
317
+ if @created_at.nil?
318
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
319
+ end
320
+
321
+ if @credits.nil?
322
+ invalid_properties.push('invalid value for "credits", credits cannot be nil.')
323
+ end
324
+
325
+ invalid_properties
326
+ end
327
+
328
+ # Check to see if the all the properties in the model are valid
329
+ # @return true if the model is valid
330
+ def valid?
331
+ warn '[DEPRECATED] the `valid?` method is obsolete'
332
+ return false if @lago_id.nil?
333
+ return false if @lago_coupon_id.nil?
334
+ return false if @coupon_code.nil?
335
+ return false if @coupon_name.nil?
336
+ return false if @lago_customer_id.nil?
337
+ return false if @external_customer_id.nil?
338
+ return false if @status.nil?
339
+ status_validator = EnumAttributeValidator.new('String', ["active", "terminated"])
340
+ return false unless status_validator.valid?(@status)
341
+ return false if !@percentage_rate.nil? && @percentage_rate !~ Regexp.new(/^[0-9]+.?[0-9]*$/)
342
+ return false if @frequency.nil?
343
+ frequency_validator = EnumAttributeValidator.new('String', ["once", "recurring"])
344
+ return false unless frequency_validator.valid?(@frequency)
345
+ return false if @created_at.nil?
346
+ return false if @credits.nil?
347
+ true
348
+ end
349
+
350
+ # Custom attribute writer method checking allowed values (enum).
351
+ # @param [Object] status Object to be assigned
352
+ def status=(status)
353
+ validator = EnumAttributeValidator.new('String', ["active", "terminated"])
354
+ unless validator.valid?(status)
355
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
356
+ end
357
+ @status = status
358
+ end
359
+
360
+ # Custom attribute writer method with validation
361
+ # @param [Object] percentage_rate Value to be assigned
362
+ def percentage_rate=(percentage_rate)
363
+ pattern = Regexp.new(/^[0-9]+.?[0-9]*$/)
364
+ if !percentage_rate.nil? && percentage_rate !~ pattern
365
+ fail ArgumentError, "invalid value for \"percentage_rate\", must conform to the pattern #{pattern}."
366
+ end
367
+
368
+ @percentage_rate = percentage_rate
369
+ end
370
+
371
+ # Custom attribute writer method checking allowed values (enum).
372
+ # @param [Object] frequency Object to be assigned
373
+ def frequency=(frequency)
374
+ validator = EnumAttributeValidator.new('String', ["once", "recurring"])
375
+ unless validator.valid?(frequency)
376
+ fail ArgumentError, "invalid value for \"frequency\", must be one of #{validator.allowable_values}."
377
+ end
378
+ @frequency = frequency
379
+ end
380
+
381
+ # Checks equality by comparing each attribute.
382
+ # @param [Object] Object to be compared
383
+ def ==(o)
384
+ return true if self.equal?(o)
385
+ self.class == o.class &&
386
+ lago_id == o.lago_id &&
387
+ lago_coupon_id == o.lago_coupon_id &&
388
+ coupon_code == o.coupon_code &&
389
+ coupon_name == o.coupon_name &&
390
+ lago_customer_id == o.lago_customer_id &&
391
+ external_customer_id == o.external_customer_id &&
392
+ status == o.status &&
393
+ amount_cents == o.amount_cents &&
394
+ amount_cents_remaining == o.amount_cents_remaining &&
395
+ amount_currency == o.amount_currency &&
396
+ percentage_rate == o.percentage_rate &&
397
+ frequency == o.frequency &&
398
+ frequency_duration == o.frequency_duration &&
399
+ frequency_duration_remaining == o.frequency_duration_remaining &&
400
+ expiration_at == o.expiration_at &&
401
+ created_at == o.created_at &&
402
+ terminated_at == o.terminated_at &&
403
+ credits == o.credits
404
+ end
405
+
406
+ # @see the `==` method
407
+ # @param [Object] Object to be compared
408
+ def eql?(o)
409
+ self == o
410
+ end
411
+
412
+ # Calculates hash code according to all attributes.
413
+ # @return [Integer] Hash code
414
+ def hash
415
+ [lago_id, lago_coupon_id, coupon_code, coupon_name, lago_customer_id, external_customer_id, status, amount_cents, amount_cents_remaining, amount_currency, percentage_rate, frequency, frequency_duration, frequency_duration_remaining, expiration_at, created_at, terminated_at, credits].hash
416
+ end
417
+
418
+ # Builds the object from hash
419
+ # @param [Hash] attributes Model attributes in the form of hash
420
+ # @return [Object] Returns the model itself
421
+ def self.build_from_hash(attributes)
422
+ return nil unless attributes.is_a?(Hash)
423
+ attributes = attributes.transform_keys(&:to_sym)
424
+ transformed_hash = {}
425
+ openapi_types.each_pair do |key, type|
426
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
427
+ transformed_hash["#{key}"] = nil
428
+ elsif type =~ /\AArray<(.*)>/i
429
+ # check to ensure the input is an array given that the attribute
430
+ # is documented as an array but the input is not
431
+ if attributes[attribute_map[key]].is_a?(Array)
432
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
433
+ end
434
+ elsif !attributes[attribute_map[key]].nil?
435
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
436
+ end
437
+ end
438
+ new(transformed_hash)
439
+ end
440
+
441
+ # Deserializes the data based on type
442
+ # @param string type Data type
443
+ # @param string value Value to be deserialized
444
+ # @return [Object] Deserialized data
445
+ def self._deserialize(type, value)
446
+ case type.to_sym
447
+ when :Time
448
+ Time.parse(value)
449
+ when :Date
450
+ Date.parse(value)
451
+ when :String
452
+ value.to_s
453
+ when :Integer
454
+ value.to_i
455
+ when :Float
456
+ value.to_f
457
+ when :Boolean
458
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
459
+ true
460
+ else
461
+ false
462
+ end
463
+ when :Object
464
+ # generic object (usually a Hash), return directly
465
+ value
466
+ when /\AArray<(?<inner_type>.+)>\z/
467
+ inner_type = Regexp.last_match[:inner_type]
468
+ value.map { |v| _deserialize(inner_type, v) }
469
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
470
+ k_type = Regexp.last_match[:k_type]
471
+ v_type = Regexp.last_match[:v_type]
472
+ {}.tap do |hash|
473
+ value.each do |k, v|
474
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
475
+ end
476
+ end
477
+ else # model
478
+ # models (e.g. Pet) or oneOf
479
+ klass = LagoAPI.const_get(type)
480
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
481
+ end
482
+ end
483
+
484
+ # Returns the string representation of the object
485
+ # @return [String] String presentation of the object
486
+ def to_s
487
+ to_hash.to_s
488
+ end
489
+
490
+ # to_body is an alias to to_hash (backward compatibility)
491
+ # @return [Hash] Returns the object in the form of hash
492
+ def to_body
493
+ to_hash
494
+ end
495
+
496
+ # Returns the object in the form of hash
497
+ # @return [Hash] Returns the object in the form of hash
498
+ def to_hash
499
+ hash = {}
500
+ self.class.attribute_map.each_pair do |attr, param|
501
+ value = self.send(attr)
502
+ if value.nil?
503
+ is_nullable = self.class.openapi_nullable.include?(attr)
504
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
505
+ end
506
+
507
+ hash[param] = _to_hash(value)
508
+ end
509
+ hash
510
+ end
511
+
512
+ # Outputs non-array value in the form of hash
513
+ # For object, use to_hash. Otherwise, just return the value
514
+ # @param [Object] value Any valid value
515
+ # @return [Hash] Returns the value in the form of hash
516
+ def _to_hash(value)
517
+ if value.is_a?(Array)
518
+ value.compact.map { |v| _to_hash(v) }
519
+ elsif value.is_a?(Hash)
520
+ {}.tap do |hash|
521
+ value.each { |k, v| hash[k] = _to_hash(v) }
522
+ end
523
+ elsif value.respond_to? :to_hash
524
+ value.to_hash
525
+ else
526
+ value
527
+ end
528
+ end
529
+
530
+ end
531
+
532
+ end