lago_ruby 0.46.1.pre.beta → 0.49.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (237) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +15 -10
  4. data/docs/AddOnBaseInput.md +2 -0
  5. data/docs/AddOnCreateInputAddOn.md +2 -0
  6. data/docs/AddOnObject.md +2 -0
  7. data/docs/BillableMetricBaseInput.md +3 -1
  8. data/docs/BillableMetricCreateInputBillableMetric.md +3 -1
  9. data/docs/BillableMetricObject.md +3 -1
  10. data/docs/ChargeObject.md +2 -0
  11. data/docs/CouponObject.md +3 -1
  12. data/docs/CreditNoteItemObjectFee.md +2 -0
  13. data/docs/CreditObjectItem.md +2 -2
  14. data/docs/CustomerChargeUsageObject.md +2 -0
  15. data/docs/CustomerChargeUsageObjectGroupsInner.md +2 -0
  16. data/docs/CustomerPastUsage.md +20 -0
  17. data/docs/CustomerUsageObject.md +2 -0
  18. data/docs/CustomersApi.md +82 -0
  19. data/docs/EventInputEvent.md +2 -2
  20. data/docs/EventInputEventTimestamp.md +15 -0
  21. data/docs/EventObject.md +1 -1
  22. data/docs/FeeObject.md +2 -0
  23. data/docs/FeeObjectItem.md +2 -0
  24. data/docs/GroupPropertiesObject.md +2 -0
  25. data/docs/InvoiceOneOffCreateInputInvoiceFeesInner.md +2 -0
  26. data/docs/PlanCreateInputPlan.md +3 -1
  27. data/docs/PlanCreateInputPlanChargesInner.md +2 -0
  28. data/docs/PlanObject.md +3 -1
  29. data/docs/PlanUpdateInputPlan.md +3 -1
  30. data/docs/PlanUpdateInputPlanChargesInner.md +2 -0
  31. data/docs/SubscriptionCreateInputSubscription.md +2 -0
  32. data/docs/SubscriptionObject.md +2 -0
  33. data/docs/SubscriptionUpdateInputSubscription.md +2 -0
  34. data/docs/SubscriptionsApi.md +70 -0
  35. data/docs/WebhookEndpoint.md +18 -0
  36. data/docs/WebhookEndpointCreateInput.md +18 -0
  37. data/docs/WebhookEndpointCreateInputWebhookEndpoint.md +20 -0
  38. data/docs/WebhookEndpointObject.md +26 -0
  39. data/docs/WebhookEndpointUpdateInput.md +18 -0
  40. data/docs/WebhookEndpointsApi.md +28 -28
  41. data/docs/WebhookEndpointsPaginated.md +20 -0
  42. data/lago_ruby.gemspec +2 -2
  43. data/lib/lago_ruby/api/add_ons_api.rb +2 -2
  44. data/lib/lago_ruby/api/billable_metrics_api.rb +2 -2
  45. data/lib/lago_ruby/api/coupons_api.rb +2 -2
  46. data/lib/lago_ruby/api/credit_notes_api.rb +2 -2
  47. data/lib/lago_ruby/api/customers_api.rb +84 -2
  48. data/lib/lago_ruby/api/events_api.rb +2 -2
  49. data/lib/lago_ruby/api/fees_api.rb +2 -2
  50. data/lib/lago_ruby/api/invoices_api.rb +2 -2
  51. data/lib/lago_ruby/api/organizations_api.rb +2 -2
  52. data/lib/lago_ruby/api/plans_api.rb +2 -2
  53. data/lib/lago_ruby/api/subscriptions_api.rb +65 -2
  54. data/lib/lago_ruby/api/taxes_api.rb +2 -2
  55. data/lib/lago_ruby/api/wallets_api.rb +2 -2
  56. data/lib/lago_ruby/api/webhook_endpoints_api.rb +35 -35
  57. data/lib/lago_ruby/api/webhooks_api.rb +2 -2
  58. data/lib/lago_ruby/api_client.rb +4 -3
  59. data/lib/lago_ruby/api_error.rb +2 -2
  60. data/lib/lago_ruby/configuration.rb +3 -2
  61. data/lib/lago_ruby/models/add_on.rb +2 -2
  62. data/lib/lago_ruby/models/add_on_base_input.rb +13 -3
  63. data/lib/lago_ruby/models/add_on_create_input.rb +2 -2
  64. data/lib/lago_ruby/models/add_on_create_input_add_on.rb +13 -3
  65. data/lib/lago_ruby/models/add_on_object.rb +13 -3
  66. data/lib/lago_ruby/models/add_on_update_input.rb +2 -2
  67. data/lib/lago_ruby/models/add_ons_paginated.rb +2 -2
  68. data/lib/lago_ruby/models/api_error_bad_request.rb +2 -2
  69. data/lib/lago_ruby/models/api_error_forbidden.rb +2 -2
  70. data/lib/lago_ruby/models/api_error_not_allowed.rb +2 -2
  71. data/lib/lago_ruby/models/api_error_not_found.rb +2 -2
  72. data/lib/lago_ruby/models/api_error_unauthorized.rb +2 -2
  73. data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +2 -2
  74. data/lib/lago_ruby/models/applied_coupon.rb +2 -2
  75. data/lib/lago_ruby/models/applied_coupon_input.rb +2 -2
  76. data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +2 -2
  77. data/lib/lago_ruby/models/applied_coupon_object.rb +2 -2
  78. data/lib/lago_ruby/models/applied_coupon_object_extended.rb +2 -2
  79. data/lib/lago_ruby/models/applied_coupons_paginated.rb +2 -2
  80. data/lib/lago_ruby/models/base_applied_tax.rb +2 -2
  81. data/lib/lago_ruby/models/billable_metric.rb +2 -2
  82. data/lib/lago_ruby/models/billable_metric_base_input.rb +29 -6
  83. data/lib/lago_ruby/models/billable_metric_create_input.rb +2 -2
  84. data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +29 -6
  85. data/lib/lago_ruby/models/billable_metric_group.rb +2 -2
  86. data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +2 -2
  87. data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +2 -2
  88. data/lib/lago_ruby/models/billable_metric_object.rb +29 -6
  89. data/lib/lago_ruby/models/billable_metric_update_input.rb +2 -2
  90. data/lib/lago_ruby/models/billable_metrics_paginated.rb +2 -2
  91. data/lib/lago_ruby/models/charge_object.rb +13 -3
  92. data/lib/lago_ruby/models/charge_object_properties.rb +2 -2
  93. data/lib/lago_ruby/models/charge_properties.rb +2 -2
  94. data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +2 -2
  95. data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +2 -2
  96. data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +2 -2
  97. data/lib/lago_ruby/models/country.rb +2 -2
  98. data/lib/lago_ruby/models/coupon.rb +2 -2
  99. data/lib/lago_ruby/models/coupon_base_input.rb +2 -2
  100. data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +2 -2
  101. data/lib/lago_ruby/models/coupon_create_input.rb +2 -2
  102. data/lib/lago_ruby/models/coupon_create_input_coupon.rb +2 -2
  103. data/lib/lago_ruby/models/coupon_object.rb +16 -6
  104. data/lib/lago_ruby/models/coupon_update_input.rb +2 -2
  105. data/lib/lago_ruby/models/coupons_paginated.rb +2 -2
  106. data/lib/lago_ruby/models/credit_note.rb +2 -2
  107. data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +2 -2
  108. data/lib/lago_ruby/models/credit_note_create_input.rb +2 -2
  109. data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +2 -2
  110. data/lib/lago_ruby/models/credit_note_create_input_credit_note_items_inner.rb +2 -2
  111. data/lib/lago_ruby/models/credit_note_item_object.rb +2 -2
  112. data/lib/lago_ruby/models/credit_note_item_object_fee.rb +13 -3
  113. data/lib/lago_ruby/models/credit_note_object.rb +2 -2
  114. data/lib/lago_ruby/models/credit_note_update_input.rb +2 -2
  115. data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +2 -2
  116. data/lib/lago_ruby/models/credit_notes.rb +2 -2
  117. data/lib/lago_ruby/models/credit_object.rb +2 -2
  118. data/lib/lago_ruby/models/credit_object_invoice.rb +2 -2
  119. data/lib/lago_ruby/models/credit_object_item.rb +13 -13
  120. data/lib/lago_ruby/models/currency.rb +2 -2
  121. data/lib/lago_ruby/models/customer.rb +2 -2
  122. data/lib/lago_ruby/models/customer_billing_configuration.rb +2 -2
  123. data/lib/lago_ruby/models/customer_charge_usage_object.rb +20 -3
  124. data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +2 -2
  125. data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +2 -2
  126. data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +13 -3
  127. data/lib/lago_ruby/models/customer_create_input.rb +2 -2
  128. data/lib/lago_ruby/models/customer_create_input_customer.rb +2 -2
  129. data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +2 -2
  130. data/lib/lago_ruby/models/customer_metadata.rb +2 -2
  131. data/lib/lago_ruby/models/customer_object.rb +2 -2
  132. data/lib/lago_ruby/models/customer_object_extended.rb +2 -2
  133. data/lib/lago_ruby/models/customer_past_usage.rb +239 -0
  134. data/lib/lago_ruby/models/customer_usage.rb +2 -2
  135. data/lib/lago_ruby/models/customer_usage_object.rb +14 -3
  136. data/lib/lago_ruby/models/customers_paginated.rb +2 -2
  137. data/lib/lago_ruby/models/event.rb +2 -2
  138. data/lib/lago_ruby/models/event_batch_input.rb +2 -2
  139. data/lib/lago_ruby/models/event_batch_input_event.rb +2 -2
  140. data/lib/lago_ruby/models/event_batch_input_event_properties.rb +2 -2
  141. data/lib/lago_ruby/models/event_estimate_fees_input.rb +2 -2
  142. data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +2 -2
  143. data/lib/lago_ruby/models/event_input.rb +2 -2
  144. data/lib/lago_ruby/models/event_input_event.rb +3 -4
  145. data/lib/lago_ruby/models/event_input_event_timestamp.rb +105 -0
  146. data/lib/lago_ruby/models/event_object.rb +2 -2
  147. data/lib/lago_ruby/models/event_object_properties.rb +2 -2
  148. data/lib/lago_ruby/models/fee.rb +2 -2
  149. data/lib/lago_ruby/models/fee_applied_tax_object.rb +2 -2
  150. data/lib/lago_ruby/models/fee_object.rb +13 -3
  151. data/lib/lago_ruby/models/fee_object_item.rb +13 -3
  152. data/lib/lago_ruby/models/fee_update_input.rb +2 -2
  153. data/lib/lago_ruby/models/fee_update_input_fee.rb +2 -2
  154. data/lib/lago_ruby/models/fees.rb +2 -2
  155. data/lib/lago_ruby/models/fees_paginated.rb +2 -2
  156. data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +2 -2
  157. data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +2 -2
  158. data/lib/lago_ruby/models/group_object.rb +2 -2
  159. data/lib/lago_ruby/models/group_properties_object.rb +13 -3
  160. data/lib/lago_ruby/models/group_properties_object_values.rb +2 -2
  161. data/lib/lago_ruby/models/groups_paginated.rb +2 -2
  162. data/lib/lago_ruby/models/invoice.rb +2 -2
  163. data/lib/lago_ruby/models/invoice_applied_tax_object.rb +2 -2
  164. data/lib/lago_ruby/models/invoice_metadata_object.rb +2 -2
  165. data/lib/lago_ruby/models/invoice_object.rb +2 -2
  166. data/lib/lago_ruby/models/invoice_object_customer.rb +2 -2
  167. data/lib/lago_ruby/models/invoice_object_extended.rb +2 -2
  168. data/lib/lago_ruby/models/invoice_one_off_create_input.rb +2 -2
  169. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +2 -2
  170. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +13 -3
  171. data/lib/lago_ruby/models/invoice_update_input.rb +2 -2
  172. data/lib/lago_ruby/models/invoice_update_input_invoice.rb +2 -2
  173. data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +2 -2
  174. data/lib/lago_ruby/models/invoices_paginated.rb +2 -2
  175. data/lib/lago_ruby/models/organization.rb +2 -2
  176. data/lib/lago_ruby/models/organization_billing_configuration.rb +2 -2
  177. data/lib/lago_ruby/models/organization_object.rb +2 -2
  178. data/lib/lago_ruby/models/organization_update_input.rb +2 -2
  179. data/lib/lago_ruby/models/organization_update_input_organization.rb +2 -2
  180. data/lib/lago_ruby/models/pagination_meta.rb +2 -2
  181. data/lib/lago_ruby/models/plan.rb +2 -2
  182. data/lib/lago_ruby/models/plan_create_input.rb +2 -2
  183. data/lib/lago_ruby/models/plan_create_input_plan.rb +13 -3
  184. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +13 -3
  185. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +2 -2
  186. data/lib/lago_ruby/models/plan_object.rb +13 -3
  187. data/lib/lago_ruby/models/plan_update_input.rb +2 -2
  188. data/lib/lago_ruby/models/plan_update_input_plan.rb +13 -3
  189. data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +13 -3
  190. data/lib/lago_ruby/models/plans_paginated.rb +2 -2
  191. data/lib/lago_ruby/models/subscription.rb +2 -2
  192. data/lib/lago_ruby/models/subscription_create_input.rb +2 -2
  193. data/lib/lago_ruby/models/subscription_create_input_subscription.rb +13 -3
  194. data/lib/lago_ruby/models/subscription_object.rb +13 -3
  195. data/lib/lago_ruby/models/subscription_update_input.rb +2 -2
  196. data/lib/lago_ruby/models/subscription_update_input_subscription.rb +13 -3
  197. data/lib/lago_ruby/models/subscriptions_paginated.rb +2 -2
  198. data/lib/lago_ruby/models/tax.rb +2 -2
  199. data/lib/lago_ruby/models/tax_base_input.rb +2 -2
  200. data/lib/lago_ruby/models/tax_create_input.rb +2 -2
  201. data/lib/lago_ruby/models/tax_create_input_tax.rb +2 -2
  202. data/lib/lago_ruby/models/tax_object.rb +2 -2
  203. data/lib/lago_ruby/models/tax_update_input.rb +2 -2
  204. data/lib/lago_ruby/models/taxes_paginated.rb +2 -2
  205. data/lib/lago_ruby/models/timezone.rb +2 -2
  206. data/lib/lago_ruby/models/wallet.rb +2 -2
  207. data/lib/lago_ruby/models/wallet_create_input.rb +2 -2
  208. data/lib/lago_ruby/models/wallet_create_input_wallet.rb +2 -2
  209. data/lib/lago_ruby/models/wallet_object.rb +2 -2
  210. data/lib/lago_ruby/models/wallet_transaction_create_input.rb +2 -2
  211. data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +2 -2
  212. data/lib/lago_ruby/models/wallet_transaction_object.rb +2 -2
  213. data/lib/lago_ruby/models/wallet_transactions.rb +2 -2
  214. data/lib/lago_ruby/models/wallet_transactions_paginated.rb +2 -2
  215. data/lib/lago_ruby/models/wallet_update_input.rb +2 -2
  216. data/lib/lago_ruby/models/wallet_update_input_wallet.rb +2 -2
  217. data/lib/lago_ruby/models/wallets_paginated.rb +2 -2
  218. data/lib/lago_ruby/models/webhook_endpoint.rb +221 -0
  219. data/lib/lago_ruby/models/webhook_endpoint_create_input.rb +214 -0
  220. data/lib/lago_ruby/models/webhook_endpoint_create_input_webhook_endpoint.rb +267 -0
  221. data/lib/lago_ruby/models/webhook_endpoint_object.rb +317 -0
  222. data/lib/lago_ruby/models/webhook_endpoint_update_input.rb +214 -0
  223. data/lib/lago_ruby/models/webhook_endpoints_paginated.rb +239 -0
  224. data/lib/lago_ruby/version.rb +3 -3
  225. data/lib/lago_ruby.rb +10 -7
  226. data/spec/api_client_spec.rb +2 -2
  227. data/spec/configuration_spec.rb +2 -2
  228. data/spec/models/customer_past_usage_spec.rb +42 -0
  229. data/spec/models/event_input_event_timestamp_spec.rb +21 -0
  230. data/spec/models/{create_webhook_endpoint_request_spec.rb → webhook_endpoint_create_input_spec.rb} +8 -8
  231. data/spec/models/{create_webhook_endpoint_request_webhook_endpoint_spec.rb → webhook_endpoint_create_input_webhook_endpoint_spec.rb} +8 -8
  232. data/spec/models/{create_webhook_endpoint200_response_webhook_endpoint_spec.rb → webhook_endpoint_object_spec.rb} +8 -8
  233. data/spec/models/{create_webhook_endpoint200_response_spec.rb → webhook_endpoint_spec.rb} +8 -8
  234. data/spec/models/webhook_endpoint_update_input_spec.rb +34 -0
  235. data/spec/models/{find_all_webhook_endpoints200_response_spec.rb → webhook_endpoints_paginated_spec.rb} +8 -8
  236. data/spec/spec_helper.rb +2 -2
  237. metadata +179 -157
@@ -0,0 +1,267 @@
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.49.0-beta
7
+ Contact: tech@getlago.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LagoAPI
17
+ class WebhookEndpointCreateInputWebhookEndpoint
18
+ # The URL of the webhook endpoint.
19
+ attr_accessor :webhook_url
20
+
21
+ # The signature used for the webhook. If no value is passed,
22
+ attr_accessor :signature_algo
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'webhook_url' => :'webhook_url',
50
+ :'signature_algo' => :'signature_algo'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'webhook_url' => :'String',
63
+ :'signature_algo' => :'String'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ :'signature_algo'
71
+ ])
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ if (!attributes.is_a?(Hash))
78
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::WebhookEndpointCreateInputWebhookEndpoint` initialize method"
79
+ end
80
+
81
+ # check to see if the attribute exists and convert string to symbol for hash key
82
+ attributes = attributes.each_with_object({}) { |(k, v), h|
83
+ if (!self.class.attribute_map.key?(k.to_sym))
84
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::WebhookEndpointCreateInputWebhookEndpoint`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
85
+ end
86
+ h[k.to_sym] = v
87
+ }
88
+
89
+ if attributes.key?(:'webhook_url')
90
+ self.webhook_url = attributes[:'webhook_url']
91
+ else
92
+ self.webhook_url = nil
93
+ end
94
+
95
+ if attributes.key?(:'signature_algo')
96
+ self.signature_algo = attributes[:'signature_algo']
97
+ end
98
+ end
99
+
100
+ # Show invalid properties with the reasons. Usually used together with valid?
101
+ # @return Array for valid properties with the reasons
102
+ def list_invalid_properties
103
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
104
+ invalid_properties = Array.new
105
+ if @webhook_url.nil?
106
+ invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
107
+ end
108
+
109
+ invalid_properties
110
+ end
111
+
112
+ # Check to see if the all the properties in the model are valid
113
+ # @return true if the model is valid
114
+ def valid?
115
+ warn '[DEPRECATED] the `valid?` method is obsolete'
116
+ return false if @webhook_url.nil?
117
+ signature_algo_validator = EnumAttributeValidator.new('String', ["jwt", "hmac"])
118
+ return false unless signature_algo_validator.valid?(@signature_algo)
119
+ true
120
+ end
121
+
122
+ # Custom attribute writer method checking allowed values (enum).
123
+ # @param [Object] signature_algo Object to be assigned
124
+ def signature_algo=(signature_algo)
125
+ validator = EnumAttributeValidator.new('String', ["jwt", "hmac"])
126
+ unless validator.valid?(signature_algo)
127
+ fail ArgumentError, "invalid value for \"signature_algo\", must be one of #{validator.allowable_values}."
128
+ end
129
+ @signature_algo = signature_algo
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ webhook_url == o.webhook_url &&
138
+ signature_algo == o.signature_algo
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Integer] Hash code
149
+ def hash
150
+ [webhook_url, signature_algo].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def self.build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ attributes = attributes.transform_keys(&:to_sym)
159
+ transformed_hash = {}
160
+ openapi_types.each_pair do |key, type|
161
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
162
+ transformed_hash["#{key}"] = nil
163
+ elsif type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[attribute_map[key]].is_a?(Array)
167
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
168
+ end
169
+ elsif !attributes[attribute_map[key]].nil?
170
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
171
+ end
172
+ end
173
+ new(transformed_hash)
174
+ end
175
+
176
+ # Deserializes the data based on type
177
+ # @param string type Data type
178
+ # @param string value Value to be deserialized
179
+ # @return [Object] Deserialized data
180
+ def self._deserialize(type, value)
181
+ case type.to_sym
182
+ when :Time
183
+ Time.parse(value)
184
+ when :Date
185
+ Date.parse(value)
186
+ when :String
187
+ value.to_s
188
+ when :Integer
189
+ value.to_i
190
+ when :Float
191
+ value.to_f
192
+ when :Boolean
193
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
194
+ true
195
+ else
196
+ false
197
+ end
198
+ when :Object
199
+ # generic object (usually a Hash), return directly
200
+ value
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ # models (e.g. Pet) or oneOf
214
+ klass = LagoAPI.const_get(type)
215
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+
265
+ end
266
+
267
+ end
@@ -0,0 +1,317 @@
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.49.0-beta
7
+ Contact: tech@getlago.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 7.1.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LagoAPI
17
+ class WebhookEndpointObject
18
+ # Unique identifier assigned to the wallet within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the webhook endpoint's record within the Lago system.
19
+ attr_accessor :lago_id
20
+
21
+ # Unique identifier assigned to the organization attached to the webhook endpoint within the Lago application. This ID is exclusively created by Lago and serves as a unique identifier for the organization’s record within the Lago system.
22
+ attr_accessor :lago_organization_id
23
+
24
+ # The name of the wallet.
25
+ attr_accessor :webhook_url
26
+
27
+ # The signature algo for the webhook.
28
+ attr_accessor :signature_algo
29
+
30
+ # The date of the webhook endpoint creation, represented in ISO 8601 datetime format and expressed in Coordinated Universal Time (UTC).
31
+ attr_accessor :created_at
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'lago_id' => :'lago_id',
59
+ :'lago_organization_id' => :'lago_organization_id',
60
+ :'webhook_url' => :'webhook_url',
61
+ :'signature_algo' => :'signature_algo',
62
+ :'created_at' => :'created_at'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'lago_id' => :'String',
75
+ :'lago_organization_id' => :'String',
76
+ :'webhook_url' => :'String',
77
+ :'signature_algo' => :'String',
78
+ :'created_at' => :'Time'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::WebhookEndpointObject` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::WebhookEndpointObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'lago_id')
104
+ self.lago_id = attributes[:'lago_id']
105
+ else
106
+ self.lago_id = nil
107
+ end
108
+
109
+ if attributes.key?(:'lago_organization_id')
110
+ self.lago_organization_id = attributes[:'lago_organization_id']
111
+ else
112
+ self.lago_organization_id = nil
113
+ end
114
+
115
+ if attributes.key?(:'webhook_url')
116
+ self.webhook_url = attributes[:'webhook_url']
117
+ else
118
+ self.webhook_url = nil
119
+ end
120
+
121
+ if attributes.key?(:'signature_algo')
122
+ self.signature_algo = attributes[:'signature_algo']
123
+ end
124
+
125
+ if attributes.key?(:'created_at')
126
+ self.created_at = attributes[:'created_at']
127
+ else
128
+ self.created_at = nil
129
+ end
130
+ end
131
+
132
+ # Show invalid properties with the reasons. Usually used together with valid?
133
+ # @return Array for valid properties with the reasons
134
+ def list_invalid_properties
135
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
136
+ invalid_properties = Array.new
137
+ if @lago_id.nil?
138
+ invalid_properties.push('invalid value for "lago_id", lago_id cannot be nil.')
139
+ end
140
+
141
+ if @lago_organization_id.nil?
142
+ invalid_properties.push('invalid value for "lago_organization_id", lago_organization_id cannot be nil.')
143
+ end
144
+
145
+ if @webhook_url.nil?
146
+ invalid_properties.push('invalid value for "webhook_url", webhook_url cannot be nil.')
147
+ end
148
+
149
+ if @created_at.nil?
150
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
151
+ end
152
+
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ warn '[DEPRECATED] the `valid?` method is obsolete'
160
+ return false if @lago_id.nil?
161
+ return false if @lago_organization_id.nil?
162
+ return false if @webhook_url.nil?
163
+ signature_algo_validator = EnumAttributeValidator.new('String', ["jwt", "hmac"])
164
+ return false unless signature_algo_validator.valid?(@signature_algo)
165
+ return false if @created_at.nil?
166
+ true
167
+ end
168
+
169
+ # Custom attribute writer method checking allowed values (enum).
170
+ # @param [Object] signature_algo Object to be assigned
171
+ def signature_algo=(signature_algo)
172
+ validator = EnumAttributeValidator.new('String', ["jwt", "hmac"])
173
+ unless validator.valid?(signature_algo)
174
+ fail ArgumentError, "invalid value for \"signature_algo\", must be one of #{validator.allowable_values}."
175
+ end
176
+ @signature_algo = signature_algo
177
+ end
178
+
179
+ # Checks equality by comparing each attribute.
180
+ # @param [Object] Object to be compared
181
+ def ==(o)
182
+ return true if self.equal?(o)
183
+ self.class == o.class &&
184
+ lago_id == o.lago_id &&
185
+ lago_organization_id == o.lago_organization_id &&
186
+ webhook_url == o.webhook_url &&
187
+ signature_algo == o.signature_algo &&
188
+ created_at == o.created_at
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [lago_id, lago_organization_id, webhook_url, signature_algo, created_at].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ attributes = attributes.transform_keys(&:to_sym)
209
+ transformed_hash = {}
210
+ openapi_types.each_pair do |key, type|
211
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = nil
213
+ elsif type =~ /\AArray<(.*)>/i
214
+ # check to ensure the input is an array given that the attribute
215
+ # is documented as an array but the input is not
216
+ if attributes[attribute_map[key]].is_a?(Array)
217
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
218
+ end
219
+ elsif !attributes[attribute_map[key]].nil?
220
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
221
+ end
222
+ end
223
+ new(transformed_hash)
224
+ end
225
+
226
+ # Deserializes the data based on type
227
+ # @param string type Data type
228
+ # @param string value Value to be deserialized
229
+ # @return [Object] Deserialized data
230
+ def self._deserialize(type, value)
231
+ case type.to_sym
232
+ when :Time
233
+ Time.parse(value)
234
+ when :Date
235
+ Date.parse(value)
236
+ when :String
237
+ value.to_s
238
+ when :Integer
239
+ value.to_i
240
+ when :Float
241
+ value.to_f
242
+ when :Boolean
243
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
244
+ true
245
+ else
246
+ false
247
+ end
248
+ when :Object
249
+ # generic object (usually a Hash), return directly
250
+ value
251
+ when /\AArray<(?<inner_type>.+)>\z/
252
+ inner_type = Regexp.last_match[:inner_type]
253
+ value.map { |v| _deserialize(inner_type, v) }
254
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
255
+ k_type = Regexp.last_match[:k_type]
256
+ v_type = Regexp.last_match[:v_type]
257
+ {}.tap do |hash|
258
+ value.each do |k, v|
259
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
260
+ end
261
+ end
262
+ else # model
263
+ # models (e.g. Pet) or oneOf
264
+ klass = LagoAPI.const_get(type)
265
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
266
+ end
267
+ end
268
+
269
+ # Returns the string representation of the object
270
+ # @return [String] String presentation of the object
271
+ def to_s
272
+ to_hash.to_s
273
+ end
274
+
275
+ # to_body is an alias to to_hash (backward compatibility)
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_body
278
+ to_hash
279
+ end
280
+
281
+ # Returns the object in the form of hash
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_hash
284
+ hash = {}
285
+ self.class.attribute_map.each_pair do |attr, param|
286
+ value = self.send(attr)
287
+ if value.nil?
288
+ is_nullable = self.class.openapi_nullable.include?(attr)
289
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
290
+ end
291
+
292
+ hash[param] = _to_hash(value)
293
+ end
294
+ hash
295
+ end
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+
315
+ end
316
+
317
+ end