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,313 @@
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
+ # Configuration specific to the payment provider, utilized for billing the customer. This object contains settings and parameters necessary for processing payments and invoicing the customer.
18
+ class CustomerBillingConfiguration
19
+ # The grace period, expressed in days, for the invoice. This period refers to the additional time granted to the customer beyond the invoice due date to adjust usage and line items
20
+ attr_accessor :invoice_grace_period
21
+
22
+ # The payment provider utilized to initiate payments for invoices issued by Lago. Accepted values: `stripe`, `adyen`, `gocardless` or null. This field is required if you intend to assign a `provider_customer_id`.
23
+ attr_accessor :payment_provider
24
+
25
+ # The customer ID within the payment provider's system. If this field is not provided, Lago has the option to create a new customer record within the payment provider's system on behalf of the customer
26
+ attr_accessor :provider_customer_id
27
+
28
+ # Set this field to `true` if you want to create the customer in the payment provider synchronously with the customer creation process in Lago. This option is applicable only when the `provider_customer_id` is `null` and the customer is automatically created in the payment provider through Lago. By default, the value is set to `false`
29
+ attr_accessor :sync
30
+
31
+ # Set this field to `true` if you want to create a customer record in the payment provider's system. This option is applicable only when the `provider_customer_id` is null and the `sync_with_provider` field is set to `true`. By default, the value is set to `false`
32
+ attr_accessor :sync_with_provider
33
+
34
+ # The document locale, specified in the ISO 639-1 format. This field represents the language or locale used for the documents issued by Lago
35
+ attr_accessor :document_locale
36
+
37
+ # Specifies the available payment methods that can be used for this customer when `payment_provider` is set to `stripe`. The `provider_payment_methods` field is an array that allows multiple payment options to be defined. If this field is not explicitly set, all the payment methods are selected. For now, possible values are `card` and `sepa_debit`.
38
+ attr_accessor :provider_payment_methods
39
+
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'invoice_grace_period' => :'invoice_grace_period',
66
+ :'payment_provider' => :'payment_provider',
67
+ :'provider_customer_id' => :'provider_customer_id',
68
+ :'sync' => :'sync',
69
+ :'sync_with_provider' => :'sync_with_provider',
70
+ :'document_locale' => :'document_locale',
71
+ :'provider_payment_methods' => :'provider_payment_methods'
72
+ }
73
+ end
74
+
75
+ # Returns all the JSON keys this model knows about
76
+ def self.acceptable_attributes
77
+ attribute_map.values
78
+ end
79
+
80
+ # Attribute type mapping.
81
+ def self.openapi_types
82
+ {
83
+ :'invoice_grace_period' => :'Integer',
84
+ :'payment_provider' => :'String',
85
+ :'provider_customer_id' => :'String',
86
+ :'sync' => :'Boolean',
87
+ :'sync_with_provider' => :'Boolean',
88
+ :'document_locale' => :'String',
89
+ :'provider_payment_methods' => :'Array<String>'
90
+ }
91
+ end
92
+
93
+ # List of attributes with nullable: true
94
+ def self.openapi_nullable
95
+ Set.new([
96
+ :'provider_payment_methods'
97
+ ])
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ if (!attributes.is_a?(Hash))
104
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CustomerBillingConfiguration` initialize method"
105
+ end
106
+
107
+ # check to see if the attribute exists and convert string to symbol for hash key
108
+ attributes = attributes.each_with_object({}) { |(k, v), h|
109
+ if (!self.class.attribute_map.key?(k.to_sym))
110
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CustomerBillingConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
111
+ end
112
+ h[k.to_sym] = v
113
+ }
114
+
115
+ if attributes.key?(:'invoice_grace_period')
116
+ self.invoice_grace_period = attributes[:'invoice_grace_period']
117
+ end
118
+
119
+ if attributes.key?(:'payment_provider')
120
+ self.payment_provider = attributes[:'payment_provider']
121
+ end
122
+
123
+ if attributes.key?(:'provider_customer_id')
124
+ self.provider_customer_id = attributes[:'provider_customer_id']
125
+ end
126
+
127
+ if attributes.key?(:'sync')
128
+ self.sync = attributes[:'sync']
129
+ end
130
+
131
+ if attributes.key?(:'sync_with_provider')
132
+ self.sync_with_provider = attributes[:'sync_with_provider']
133
+ end
134
+
135
+ if attributes.key?(:'document_locale')
136
+ self.document_locale = attributes[:'document_locale']
137
+ end
138
+
139
+ if attributes.key?(:'provider_payment_methods')
140
+ if (value = attributes[:'provider_payment_methods']).is_a?(Array)
141
+ self.provider_payment_methods = value
142
+ end
143
+ end
144
+ end
145
+
146
+ # Show invalid properties with the reasons. Usually used together with valid?
147
+ # @return Array for valid properties with the reasons
148
+ def list_invalid_properties
149
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
150
+ invalid_properties = Array.new
151
+ invalid_properties
152
+ end
153
+
154
+ # Check to see if the all the properties in the model are valid
155
+ # @return true if the model is valid
156
+ def valid?
157
+ warn '[DEPRECATED] the `valid?` method is obsolete'
158
+ payment_provider_validator = EnumAttributeValidator.new('String', ["stripe", "adyen", "gocardless"])
159
+ return false unless payment_provider_validator.valid?(@payment_provider)
160
+ true
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] payment_provider Object to be assigned
165
+ def payment_provider=(payment_provider)
166
+ validator = EnumAttributeValidator.new('String', ["stripe", "adyen", "gocardless"])
167
+ unless validator.valid?(payment_provider)
168
+ fail ArgumentError, "invalid value for \"payment_provider\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @payment_provider = payment_provider
171
+ end
172
+
173
+ # Checks equality by comparing each attribute.
174
+ # @param [Object] Object to be compared
175
+ def ==(o)
176
+ return true if self.equal?(o)
177
+ self.class == o.class &&
178
+ invoice_grace_period == o.invoice_grace_period &&
179
+ payment_provider == o.payment_provider &&
180
+ provider_customer_id == o.provider_customer_id &&
181
+ sync == o.sync &&
182
+ sync_with_provider == o.sync_with_provider &&
183
+ document_locale == o.document_locale &&
184
+ provider_payment_methods == o.provider_payment_methods
185
+ end
186
+
187
+ # @see the `==` method
188
+ # @param [Object] Object to be compared
189
+ def eql?(o)
190
+ self == o
191
+ end
192
+
193
+ # Calculates hash code according to all attributes.
194
+ # @return [Integer] Hash code
195
+ def hash
196
+ [invoice_grace_period, payment_provider, provider_customer_id, sync, sync_with_provider, document_locale, provider_payment_methods].hash
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def self.build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ attributes = attributes.transform_keys(&:to_sym)
205
+ transformed_hash = {}
206
+ openapi_types.each_pair do |key, type|
207
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
208
+ transformed_hash["#{key}"] = nil
209
+ elsif type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
211
+ # is documented as an array but the input is not
212
+ if attributes[attribute_map[key]].is_a?(Array)
213
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
214
+ end
215
+ elsif !attributes[attribute_map[key]].nil?
216
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
217
+ end
218
+ end
219
+ new(transformed_hash)
220
+ end
221
+
222
+ # Deserializes the data based on type
223
+ # @param string type Data type
224
+ # @param string value Value to be deserialized
225
+ # @return [Object] Deserialized data
226
+ def self._deserialize(type, value)
227
+ case type.to_sym
228
+ when :Time
229
+ Time.parse(value)
230
+ when :Date
231
+ Date.parse(value)
232
+ when :String
233
+ value.to_s
234
+ when :Integer
235
+ value.to_i
236
+ when :Float
237
+ value.to_f
238
+ when :Boolean
239
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
240
+ true
241
+ else
242
+ false
243
+ end
244
+ when :Object
245
+ # generic object (usually a Hash), return directly
246
+ value
247
+ when /\AArray<(?<inner_type>.+)>\z/
248
+ inner_type = Regexp.last_match[:inner_type]
249
+ value.map { |v| _deserialize(inner_type, v) }
250
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
251
+ k_type = Regexp.last_match[:k_type]
252
+ v_type = Regexp.last_match[:v_type]
253
+ {}.tap do |hash|
254
+ value.each do |k, v|
255
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
256
+ end
257
+ end
258
+ else # model
259
+ # models (e.g. Pet) or oneOf
260
+ klass = LagoAPI.const_get(type)
261
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
262
+ end
263
+ end
264
+
265
+ # Returns the string representation of the object
266
+ # @return [String] String presentation of the object
267
+ def to_s
268
+ to_hash.to_s
269
+ end
270
+
271
+ # to_body is an alias to to_hash (backward compatibility)
272
+ # @return [Hash] Returns the object in the form of hash
273
+ def to_body
274
+ to_hash
275
+ end
276
+
277
+ # Returns the object in the form of hash
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_hash
280
+ hash = {}
281
+ self.class.attribute_map.each_pair do |attr, param|
282
+ value = self.send(attr)
283
+ if value.nil?
284
+ is_nullable = self.class.openapi_nullable.include?(attr)
285
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
286
+ end
287
+
288
+ hash[param] = _to_hash(value)
289
+ end
290
+ hash
291
+ end
292
+
293
+ # Outputs non-array value in the form of hash
294
+ # For object, use to_hash. Otherwise, just return the value
295
+ # @param [Object] value Any valid value
296
+ # @return [Hash] Returns the value in the form of hash
297
+ def _to_hash(value)
298
+ if value.is_a?(Array)
299
+ value.compact.map { |v| _to_hash(v) }
300
+ elsif value.is_a?(Hash)
301
+ {}.tap do |hash|
302
+ value.each { |k, v| hash[k] = _to_hash(v) }
303
+ end
304
+ elsif value.respond_to? :to_hash
305
+ value.to_hash
306
+ else
307
+ value
308
+ end
309
+ end
310
+
311
+ end
312
+
313
+ end
@@ -0,0 +1,327 @@
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 CustomerChargeUsageObject
18
+ # The number of units consumed by the customer for a specific charge item.
19
+ attr_accessor :units
20
+
21
+ # The amount in cents, tax excluded, consumed by the customer for a specific charge item.
22
+ attr_accessor :amount_cents
23
+
24
+ attr_accessor :amount_currency
25
+
26
+ attr_accessor :charge
27
+
28
+ attr_accessor :billable_metric
29
+
30
+ # Array of group object, representing multiple dimensions for a charge item.
31
+ attr_accessor :groups
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'units' => :'units',
37
+ :'amount_cents' => :'amount_cents',
38
+ :'amount_currency' => :'amount_currency',
39
+ :'charge' => :'charge',
40
+ :'billable_metric' => :'billable_metric',
41
+ :'groups' => :'groups'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'units' => :'String',
54
+ :'amount_cents' => :'Integer',
55
+ :'amount_currency' => :'Currency',
56
+ :'charge' => :'CustomerChargeUsageObjectCharge',
57
+ :'billable_metric' => :'CustomerChargeUsageObjectBillableMetric',
58
+ :'groups' => :'Array<CustomerChargeUsageObjectGroupsInner>'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::CustomerChargeUsageObject` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::CustomerChargeUsageObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'units')
84
+ self.units = attributes[:'units']
85
+ else
86
+ self.units = nil
87
+ end
88
+
89
+ if attributes.key?(:'amount_cents')
90
+ self.amount_cents = attributes[:'amount_cents']
91
+ else
92
+ self.amount_cents = nil
93
+ end
94
+
95
+ if attributes.key?(:'amount_currency')
96
+ self.amount_currency = attributes[:'amount_currency']
97
+ else
98
+ self.amount_currency = nil
99
+ end
100
+
101
+ if attributes.key?(:'charge')
102
+ self.charge = attributes[:'charge']
103
+ else
104
+ self.charge = nil
105
+ end
106
+
107
+ if attributes.key?(:'billable_metric')
108
+ self.billable_metric = attributes[:'billable_metric']
109
+ else
110
+ self.billable_metric = nil
111
+ end
112
+
113
+ if attributes.key?(:'groups')
114
+ if (value = attributes[:'groups']).is_a?(Array)
115
+ self.groups = value
116
+ end
117
+ else
118
+ self.groups = nil
119
+ end
120
+ end
121
+
122
+ # Show invalid properties with the reasons. Usually used together with valid?
123
+ # @return Array for valid properties with the reasons
124
+ def list_invalid_properties
125
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
126
+ invalid_properties = Array.new
127
+ if @units.nil?
128
+ invalid_properties.push('invalid value for "units", units cannot be nil.')
129
+ end
130
+
131
+ pattern = Regexp.new(/^[0-9]+.?[0-9]*$/)
132
+ if @units !~ pattern
133
+ invalid_properties.push("invalid value for \"units\", must conform to the pattern #{pattern}.")
134
+ end
135
+
136
+ if @amount_cents.nil?
137
+ invalid_properties.push('invalid value for "amount_cents", amount_cents cannot be nil.')
138
+ end
139
+
140
+ if @amount_currency.nil?
141
+ invalid_properties.push('invalid value for "amount_currency", amount_currency cannot be nil.')
142
+ end
143
+
144
+ if @charge.nil?
145
+ invalid_properties.push('invalid value for "charge", charge cannot be nil.')
146
+ end
147
+
148
+ if @billable_metric.nil?
149
+ invalid_properties.push('invalid value for "billable_metric", billable_metric cannot be nil.')
150
+ end
151
+
152
+ if @groups.nil?
153
+ invalid_properties.push('invalid value for "groups", groups cannot be nil.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ return false if @units.nil?
164
+ return false if @units !~ Regexp.new(/^[0-9]+.?[0-9]*$/)
165
+ return false if @amount_cents.nil?
166
+ return false if @amount_currency.nil?
167
+ return false if @charge.nil?
168
+ return false if @billable_metric.nil?
169
+ return false if @groups.nil?
170
+ true
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] units Value to be assigned
175
+ def units=(units)
176
+ if units.nil?
177
+ fail ArgumentError, 'units cannot be nil'
178
+ end
179
+
180
+ pattern = Regexp.new(/^[0-9]+.?[0-9]*$/)
181
+ if units !~ pattern
182
+ fail ArgumentError, "invalid value for \"units\", must conform to the pattern #{pattern}."
183
+ end
184
+
185
+ @units = units
186
+ end
187
+
188
+ # Checks equality by comparing each attribute.
189
+ # @param [Object] Object to be compared
190
+ def ==(o)
191
+ return true if self.equal?(o)
192
+ self.class == o.class &&
193
+ units == o.units &&
194
+ amount_cents == o.amount_cents &&
195
+ amount_currency == o.amount_currency &&
196
+ charge == o.charge &&
197
+ billable_metric == o.billable_metric &&
198
+ groups == o.groups
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Integer] Hash code
209
+ def hash
210
+ [units, amount_cents, amount_currency, charge, billable_metric, groups].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def self.build_from_hash(attributes)
217
+ return nil unless attributes.is_a?(Hash)
218
+ attributes = attributes.transform_keys(&:to_sym)
219
+ transformed_hash = {}
220
+ openapi_types.each_pair do |key, type|
221
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
222
+ transformed_hash["#{key}"] = nil
223
+ elsif type =~ /\AArray<(.*)>/i
224
+ # check to ensure the input is an array given that the attribute
225
+ # is documented as an array but the input is not
226
+ if attributes[attribute_map[key]].is_a?(Array)
227
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
228
+ end
229
+ elsif !attributes[attribute_map[key]].nil?
230
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
231
+ end
232
+ end
233
+ new(transformed_hash)
234
+ end
235
+
236
+ # Deserializes the data based on type
237
+ # @param string type Data type
238
+ # @param string value Value to be deserialized
239
+ # @return [Object] Deserialized data
240
+ def self._deserialize(type, value)
241
+ case type.to_sym
242
+ when :Time
243
+ Time.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :Boolean
253
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when :Object
259
+ # generic object (usually a Hash), return directly
260
+ value
261
+ when /\AArray<(?<inner_type>.+)>\z/
262
+ inner_type = Regexp.last_match[:inner_type]
263
+ value.map { |v| _deserialize(inner_type, v) }
264
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
265
+ k_type = Regexp.last_match[:k_type]
266
+ v_type = Regexp.last_match[:v_type]
267
+ {}.tap do |hash|
268
+ value.each do |k, v|
269
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
270
+ end
271
+ end
272
+ else # model
273
+ # models (e.g. Pet) or oneOf
274
+ klass = LagoAPI.const_get(type)
275
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
276
+ end
277
+ end
278
+
279
+ # Returns the string representation of the object
280
+ # @return [String] String presentation of the object
281
+ def to_s
282
+ to_hash.to_s
283
+ end
284
+
285
+ # to_body is an alias to to_hash (backward compatibility)
286
+ # @return [Hash] Returns the object in the form of hash
287
+ def to_body
288
+ to_hash
289
+ end
290
+
291
+ # Returns the object in the form of hash
292
+ # @return [Hash] Returns the object in the form of hash
293
+ def to_hash
294
+ hash = {}
295
+ self.class.attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ # Outputs non-array value in the form of hash
308
+ # For object, use to_hash. Otherwise, just return the value
309
+ # @param [Object] value Any valid value
310
+ # @return [Hash] Returns the value in the form of hash
311
+ def _to_hash(value)
312
+ if value.is_a?(Array)
313
+ value.compact.map { |v| _to_hash(v) }
314
+ elsif value.is_a?(Hash)
315
+ {}.tap do |hash|
316
+ value.each { |k, v| hash[k] = _to_hash(v) }
317
+ end
318
+ elsif value.respond_to? :to_hash
319
+ value.to_hash
320
+ else
321
+ value
322
+ end
323
+ end
324
+
325
+ end
326
+
327
+ end