lago_ruby 0.46.0.pre.beta → 0.48.0.pre.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (231) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +17 -19
  4. data/docs/AddOnsApi.md +0 -70
  5. data/docs/BillableMetricBaseInput.md +2 -0
  6. data/docs/BillableMetricCreateInputBillableMetric.md +2 -0
  7. data/docs/BillableMetricObject.md +2 -0
  8. data/docs/CouponObject.md +3 -1
  9. data/docs/CreditObjectItem.md +2 -2
  10. data/docs/EventInputEvent.md +4 -4
  11. data/docs/EventInputEventProperties.md +18 -0
  12. data/docs/EventInputEventTimestamp.md +15 -0
  13. data/docs/EventObject.md +2 -2
  14. data/docs/EventObjectProperties.md +18 -0
  15. data/docs/SubscriptionCreateInputSubscription.md +2 -0
  16. data/docs/SubscriptionObject.md +2 -0
  17. data/docs/SubscriptionUpdateInputSubscription.md +2 -0
  18. data/docs/WebhookEndpoint.md +18 -0
  19. data/docs/WebhookEndpointCreateInput.md +18 -0
  20. data/docs/WebhookEndpointCreateInputWebhookEndpoint.md +20 -0
  21. data/docs/WebhookEndpointObject.md +26 -0
  22. data/docs/WebhookEndpointUpdateInput.md +18 -0
  23. data/docs/WebhookEndpointsApi.md +28 -28
  24. data/docs/WebhookEndpointsPaginated.md +20 -0
  25. data/lago_ruby.gemspec +2 -2
  26. data/lib/lago_ruby/api/add_ons_api.rb +2 -70
  27. data/lib/lago_ruby/api/billable_metrics_api.rb +2 -2
  28. data/lib/lago_ruby/api/coupons_api.rb +2 -2
  29. data/lib/lago_ruby/api/credit_notes_api.rb +2 -2
  30. data/lib/lago_ruby/api/customers_api.rb +2 -2
  31. data/lib/lago_ruby/api/events_api.rb +2 -2
  32. data/lib/lago_ruby/api/fees_api.rb +2 -2
  33. data/lib/lago_ruby/api/invoices_api.rb +2 -2
  34. data/lib/lago_ruby/api/organizations_api.rb +2 -2
  35. data/lib/lago_ruby/api/plans_api.rb +2 -2
  36. data/lib/lago_ruby/api/subscriptions_api.rb +2 -2
  37. data/lib/lago_ruby/api/taxes_api.rb +2 -2
  38. data/lib/lago_ruby/api/wallets_api.rb +2 -2
  39. data/lib/lago_ruby/api/webhook_endpoints_api.rb +35 -35
  40. data/lib/lago_ruby/api/webhooks_api.rb +2 -2
  41. data/lib/lago_ruby/api_client.rb +2 -2
  42. data/lib/lago_ruby/api_error.rb +2 -2
  43. data/lib/lago_ruby/configuration.rb +2 -2
  44. data/lib/lago_ruby/models/add_on.rb +2 -2
  45. data/lib/lago_ruby/models/add_on_base_input.rb +2 -2
  46. data/lib/lago_ruby/models/add_on_create_input.rb +2 -2
  47. data/lib/lago_ruby/models/add_on_create_input_add_on.rb +2 -2
  48. data/lib/lago_ruby/models/add_on_object.rb +2 -2
  49. data/lib/lago_ruby/models/add_on_update_input.rb +2 -2
  50. data/lib/lago_ruby/models/add_ons_paginated.rb +2 -2
  51. data/lib/lago_ruby/models/api_error_bad_request.rb +2 -2
  52. data/lib/lago_ruby/models/api_error_forbidden.rb +2 -2
  53. data/lib/lago_ruby/models/api_error_not_allowed.rb +2 -2
  54. data/lib/lago_ruby/models/api_error_not_found.rb +2 -2
  55. data/lib/lago_ruby/models/api_error_unauthorized.rb +2 -2
  56. data/lib/lago_ruby/models/api_error_unprocessable_entity.rb +2 -2
  57. data/lib/lago_ruby/models/applied_add_on.rb +1 -1
  58. data/lib/lago_ruby/models/applied_add_on_input.rb +1 -1
  59. data/lib/lago_ruby/models/applied_add_on_input_applied_add_on.rb +1 -1
  60. data/lib/lago_ruby/models/applied_add_on_object.rb +1 -1
  61. data/lib/lago_ruby/models/applied_coupon.rb +2 -2
  62. data/lib/lago_ruby/models/applied_coupon_input.rb +2 -2
  63. data/lib/lago_ruby/models/applied_coupon_input_applied_coupon.rb +2 -2
  64. data/lib/lago_ruby/models/applied_coupon_object.rb +2 -2
  65. data/lib/lago_ruby/models/applied_coupon_object_extended.rb +2 -2
  66. data/lib/lago_ruby/models/applied_coupons_paginated.rb +2 -2
  67. data/lib/lago_ruby/models/base_applied_tax.rb +2 -2
  68. data/lib/lago_ruby/models/billable_metric.rb +2 -2
  69. data/lib/lago_ruby/models/billable_metric_base_input.rb +28 -5
  70. data/lib/lago_ruby/models/billable_metric_create_input.rb +2 -2
  71. data/lib/lago_ruby/models/billable_metric_create_input_billable_metric.rb +28 -5
  72. data/lib/lago_ruby/models/billable_metric_group.rb +2 -2
  73. data/lib/lago_ruby/models/billable_metric_group_values_inner.rb +2 -2
  74. data/lib/lago_ruby/models/billable_metric_group_values_inner_one_of.rb +2 -2
  75. data/lib/lago_ruby/models/billable_metric_object.rb +28 -5
  76. data/lib/lago_ruby/models/billable_metric_update_input.rb +2 -2
  77. data/lib/lago_ruby/models/billable_metrics_paginated.rb +2 -2
  78. data/lib/lago_ruby/models/charge_object.rb +2 -2
  79. data/lib/lago_ruby/models/charge_object_properties.rb +2 -2
  80. data/lib/lago_ruby/models/charge_properties.rb +2 -2
  81. data/lib/lago_ruby/models/charge_properties_graduated_percentage_ranges_inner.rb +2 -2
  82. data/lib/lago_ruby/models/charge_properties_graduated_ranges_inner.rb +2 -2
  83. data/lib/lago_ruby/models/charge_properties_volume_ranges_inner.rb +2 -2
  84. data/lib/lago_ruby/models/country.rb +2 -2
  85. data/lib/lago_ruby/models/coupon.rb +2 -2
  86. data/lib/lago_ruby/models/coupon_base_input.rb +2 -2
  87. data/lib/lago_ruby/models/coupon_base_input_applies_to.rb +2 -2
  88. data/lib/lago_ruby/models/coupon_create_input.rb +2 -2
  89. data/lib/lago_ruby/models/coupon_create_input_coupon.rb +2 -2
  90. data/lib/lago_ruby/models/coupon_object.rb +16 -6
  91. data/lib/lago_ruby/models/coupon_update_input.rb +2 -2
  92. data/lib/lago_ruby/models/coupons_paginated.rb +2 -2
  93. data/lib/lago_ruby/models/create_webhook_endpoint200_response.rb +1 -1
  94. data/lib/lago_ruby/models/create_webhook_endpoint200_response_webhook_endpoint.rb +1 -1
  95. data/lib/lago_ruby/models/create_webhook_endpoint_request.rb +1 -1
  96. data/lib/lago_ruby/models/create_webhook_endpoint_request_webhook_endpoint.rb +1 -1
  97. data/lib/lago_ruby/models/credit_note.rb +2 -2
  98. data/lib/lago_ruby/models/credit_note_applied_tax_object.rb +2 -2
  99. data/lib/lago_ruby/models/credit_note_create_input.rb +2 -2
  100. data/lib/lago_ruby/models/credit_note_create_input_credit_note.rb +2 -2
  101. data/lib/lago_ruby/models/credit_note_create_input_credit_note_items_inner.rb +2 -2
  102. data/lib/lago_ruby/models/credit_note_item_object.rb +2 -2
  103. data/lib/lago_ruby/models/credit_note_item_object_fee.rb +2 -2
  104. data/lib/lago_ruby/models/credit_note_object.rb +2 -2
  105. data/lib/lago_ruby/models/credit_note_update_input.rb +2 -2
  106. data/lib/lago_ruby/models/credit_note_update_input_credit_note.rb +2 -2
  107. data/lib/lago_ruby/models/credit_notes.rb +2 -2
  108. data/lib/lago_ruby/models/credit_object.rb +2 -2
  109. data/lib/lago_ruby/models/credit_object_invoice.rb +2 -2
  110. data/lib/lago_ruby/models/credit_object_item.rb +13 -13
  111. data/lib/lago_ruby/models/currency.rb +2 -2
  112. data/lib/lago_ruby/models/customer.rb +2 -2
  113. data/lib/lago_ruby/models/customer_billing_configuration.rb +2 -2
  114. data/lib/lago_ruby/models/customer_charge_usage_object.rb +2 -2
  115. data/lib/lago_ruby/models/customer_charge_usage_object_billable_metric.rb +2 -2
  116. data/lib/lago_ruby/models/customer_charge_usage_object_charge.rb +2 -2
  117. data/lib/lago_ruby/models/customer_charge_usage_object_groups_inner.rb +2 -2
  118. data/lib/lago_ruby/models/customer_create_input.rb +2 -2
  119. data/lib/lago_ruby/models/customer_create_input_customer.rb +2 -2
  120. data/lib/lago_ruby/models/customer_create_input_customer_metadata_inner.rb +2 -2
  121. data/lib/lago_ruby/models/customer_metadata.rb +2 -2
  122. data/lib/lago_ruby/models/customer_object.rb +2 -2
  123. data/lib/lago_ruby/models/customer_object_extended.rb +2 -2
  124. data/lib/lago_ruby/models/customer_usage.rb +2 -2
  125. data/lib/lago_ruby/models/customer_usage_object.rb +2 -2
  126. data/lib/lago_ruby/models/customers_paginated.rb +2 -2
  127. data/lib/lago_ruby/models/event.rb +2 -2
  128. data/lib/lago_ruby/models/event_batch_input.rb +2 -2
  129. data/lib/lago_ruby/models/event_batch_input_event.rb +2 -2
  130. data/lib/lago_ruby/models/event_batch_input_event_properties.rb +2 -2
  131. data/lib/lago_ruby/models/event_estimate_fees_input.rb +2 -2
  132. data/lib/lago_ruby/models/event_estimate_fees_input_event.rb +2 -2
  133. data/lib/lago_ruby/models/event_input.rb +2 -2
  134. data/lib/lago_ruby/models/event_input_event.rb +8 -6
  135. data/lib/lago_ruby/models/event_input_event_timestamp.rb +105 -0
  136. data/lib/lago_ruby/models/event_object.rb +3 -3
  137. data/lib/lago_ruby/models/event_object_properties.rb +250 -0
  138. data/lib/lago_ruby/models/fee.rb +2 -2
  139. data/lib/lago_ruby/models/fee_applied_tax_object.rb +2 -2
  140. data/lib/lago_ruby/models/fee_object.rb +2 -2
  141. data/lib/lago_ruby/models/fee_object_item.rb +2 -2
  142. data/lib/lago_ruby/models/fee_update_input.rb +2 -2
  143. data/lib/lago_ruby/models/fee_update_input_fee.rb +2 -2
  144. data/lib/lago_ruby/models/fees.rb +2 -2
  145. data/lib/lago_ruby/models/fees_paginated.rb +2 -2
  146. data/lib/lago_ruby/models/find_all_webhook_endpoints200_response.rb +1 -1
  147. data/lib/lago_ruby/models/get_customer_portal_url200_response.rb +2 -2
  148. data/lib/lago_ruby/models/get_customer_portal_url200_response_customer.rb +2 -2
  149. data/lib/lago_ruby/models/group_object.rb +2 -2
  150. data/lib/lago_ruby/models/group_properties_object.rb +2 -2
  151. data/lib/lago_ruby/models/group_properties_object_values.rb +2 -2
  152. data/lib/lago_ruby/models/groups_paginated.rb +2 -2
  153. data/lib/lago_ruby/models/invoice.rb +2 -2
  154. data/lib/lago_ruby/models/invoice_applied_tax_object.rb +2 -2
  155. data/lib/lago_ruby/models/invoice_metadata_object.rb +2 -2
  156. data/lib/lago_ruby/models/invoice_object.rb +2 -2
  157. data/lib/lago_ruby/models/invoice_object_customer.rb +2 -2
  158. data/lib/lago_ruby/models/invoice_object_extended.rb +2 -2
  159. data/lib/lago_ruby/models/invoice_one_off_create_input.rb +2 -2
  160. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice.rb +2 -2
  161. data/lib/lago_ruby/models/invoice_one_off_create_input_invoice_fees_inner.rb +2 -2
  162. data/lib/lago_ruby/models/invoice_update_input.rb +2 -2
  163. data/lib/lago_ruby/models/invoice_update_input_invoice.rb +2 -2
  164. data/lib/lago_ruby/models/invoice_update_input_invoice_metadata_inner.rb +2 -2
  165. data/lib/lago_ruby/models/invoices_paginated.rb +2 -2
  166. data/lib/lago_ruby/models/organization.rb +2 -2
  167. data/lib/lago_ruby/models/organization_billing_configuration.rb +2 -2
  168. data/lib/lago_ruby/models/organization_object.rb +2 -2
  169. data/lib/lago_ruby/models/organization_update_input.rb +2 -2
  170. data/lib/lago_ruby/models/organization_update_input_organization.rb +2 -2
  171. data/lib/lago_ruby/models/pagination_meta.rb +2 -2
  172. data/lib/lago_ruby/models/plan.rb +2 -2
  173. data/lib/lago_ruby/models/plan_create_input.rb +2 -2
  174. data/lib/lago_ruby/models/plan_create_input_plan.rb +2 -2
  175. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner.rb +2 -2
  176. data/lib/lago_ruby/models/plan_create_input_plan_charges_inner_group_properties_inner.rb +2 -2
  177. data/lib/lago_ruby/models/plan_object.rb +2 -2
  178. data/lib/lago_ruby/models/plan_update_input.rb +2 -2
  179. data/lib/lago_ruby/models/plan_update_input_plan.rb +2 -2
  180. data/lib/lago_ruby/models/plan_update_input_plan_charges_inner.rb +2 -2
  181. data/lib/lago_ruby/models/plans_paginated.rb +2 -2
  182. data/lib/lago_ruby/models/subscription.rb +2 -2
  183. data/lib/lago_ruby/models/subscription_create_input.rb +2 -2
  184. data/lib/lago_ruby/models/subscription_create_input_subscription.rb +13 -3
  185. data/lib/lago_ruby/models/subscription_object.rb +13 -3
  186. data/lib/lago_ruby/models/subscription_update_input.rb +2 -2
  187. data/lib/lago_ruby/models/subscription_update_input_subscription.rb +13 -3
  188. data/lib/lago_ruby/models/subscriptions_paginated.rb +2 -2
  189. data/lib/lago_ruby/models/tax.rb +2 -2
  190. data/lib/lago_ruby/models/tax_base_input.rb +2 -2
  191. data/lib/lago_ruby/models/tax_create_input.rb +2 -2
  192. data/lib/lago_ruby/models/tax_create_input_tax.rb +2 -2
  193. data/lib/lago_ruby/models/tax_object.rb +2 -2
  194. data/lib/lago_ruby/models/tax_update_input.rb +2 -2
  195. data/lib/lago_ruby/models/taxes_paginated.rb +2 -2
  196. data/lib/lago_ruby/models/timezone.rb +2 -2
  197. data/lib/lago_ruby/models/wallet.rb +2 -2
  198. data/lib/lago_ruby/models/wallet_create_input.rb +2 -2
  199. data/lib/lago_ruby/models/wallet_create_input_wallet.rb +2 -2
  200. data/lib/lago_ruby/models/wallet_object.rb +2 -2
  201. data/lib/lago_ruby/models/wallet_transaction_create_input.rb +2 -2
  202. data/lib/lago_ruby/models/wallet_transaction_create_input_wallet_transaction.rb +2 -2
  203. data/lib/lago_ruby/models/wallet_transaction_object.rb +2 -2
  204. data/lib/lago_ruby/models/wallet_transactions.rb +2 -2
  205. data/lib/lago_ruby/models/wallet_transactions_paginated.rb +2 -2
  206. data/lib/lago_ruby/models/wallet_update_input.rb +2 -2
  207. data/lib/lago_ruby/models/wallet_update_input_wallet.rb +2 -2
  208. data/lib/lago_ruby/models/wallets_paginated.rb +2 -2
  209. data/lib/lago_ruby/models/webhook_endpoint.rb +221 -0
  210. data/lib/lago_ruby/models/webhook_endpoint_create_input.rb +214 -0
  211. data/lib/lago_ruby/models/webhook_endpoint_create_input_webhook_endpoint.rb +267 -0
  212. data/lib/lago_ruby/models/webhook_endpoint_object.rb +317 -0
  213. data/lib/lago_ruby/models/webhook_endpoint_update_input.rb +214 -0
  214. data/lib/lago_ruby/models/webhook_endpoints_paginated.rb +239 -0
  215. data/lib/lago_ruby/version.rb +3 -3
  216. data/lib/lago_ruby.rb +10 -11
  217. data/spec/api_client_spec.rb +2 -2
  218. data/spec/configuration_spec.rb +2 -2
  219. data/spec/models/event_input_event_timestamp_spec.rb +21 -0
  220. data/spec/models/event_object_properties_spec.rb +38 -0
  221. data/spec/models/{create_webhook_endpoint_request_spec.rb → webhook_endpoint_create_input_spec.rb} +8 -8
  222. data/spec/models/{create_webhook_endpoint_request_webhook_endpoint_spec.rb → webhook_endpoint_create_input_webhook_endpoint_spec.rb} +8 -8
  223. data/spec/models/{create_webhook_endpoint200_response_webhook_endpoint_spec.rb → webhook_endpoint_object_spec.rb} +8 -8
  224. data/spec/models/{applied_add_on_spec.rb → webhook_endpoint_spec.rb} +9 -9
  225. data/spec/models/{create_webhook_endpoint200_response_spec.rb → webhook_endpoint_update_input_spec.rb} +8 -8
  226. data/spec/models/{find_all_webhook_endpoints200_response_spec.rb → webhook_endpoints_paginated_spec.rb} +8 -8
  227. data/spec/spec_helper.rb +2 -2
  228. metadata +176 -161
  229. data/spec/models/applied_add_on_input_applied_add_on_spec.rb +0 -52
  230. data/spec/models/applied_add_on_input_spec.rb +0 -34
  231. data/spec/models/applied_add_on_object_spec.rb +0 -76
@@ -0,0 +1,214 @@
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.48.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 WebhookEndpointCreateInput
18
+ attr_accessor :webhook_endpoint
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'webhook_endpoint' => :'webhook_endpoint'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'webhook_endpoint' => :'WebhookEndpointCreateInputWebhookEndpoint'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LagoAPI::WebhookEndpointCreateInput` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LagoAPI::WebhookEndpointCreateInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'webhook_endpoint')
61
+ self.webhook_endpoint = attributes[:'webhook_endpoint']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
69
+ invalid_properties = Array.new
70
+ invalid_properties
71
+ end
72
+
73
+ # Check to see if the all the properties in the model are valid
74
+ # @return true if the model is valid
75
+ def valid?
76
+ warn '[DEPRECATED] the `valid?` method is obsolete'
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ webhook_endpoint == o.webhook_endpoint
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [webhook_endpoint].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ return nil unless attributes.is_a?(Hash)
105
+ attributes = attributes.transform_keys(&:to_sym)
106
+ transformed_hash = {}
107
+ openapi_types.each_pair do |key, type|
108
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
109
+ transformed_hash["#{key}"] = nil
110
+ elsif type =~ /\AArray<(.*)>/i
111
+ # check to ensure the input is an array given that the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[attribute_map[key]].is_a?(Array)
114
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
115
+ end
116
+ elsif !attributes[attribute_map[key]].nil?
117
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
118
+ end
119
+ end
120
+ new(transformed_hash)
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def self._deserialize(type, value)
128
+ case type.to_sym
129
+ when :Time
130
+ Time.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :Boolean
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ # models (e.g. Pet) or oneOf
161
+ klass = LagoAPI.const_get(type)
162
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end
@@ -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.48.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