wallee-ruby-sdk 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +1 -1
  4. data/lib/wallee-ruby-sdk.rb +17 -5
  5. data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +99 -0
  6. data/lib/wallee-ruby-sdk/api/shopify_subscription_service_api.rb +124 -0
  7. data/lib/wallee-ruby-sdk/api/shopify_transaction_service_api.rb +213 -0
  8. data/lib/wallee-ruby-sdk/api/subscriber_service_api.rb +3 -3
  9. data/lib/wallee-ruby-sdk/api/subscription_service_api.rb +67 -0
  10. data/lib/wallee-ruby-sdk/api/token_service_api.rb +126 -0
  11. data/lib/wallee-ruby-sdk/api_client.rb +5 -3
  12. data/lib/wallee-ruby-sdk/configuration.rb +2 -2
  13. data/lib/wallee-ruby-sdk/models/abstract_account_update.rb +11 -1
  14. data/lib/wallee-ruby-sdk/models/{abstract_shopify_subscription_product_active.rb → abstract_shopify_subscription_product_update.rb} +2 -12
  15. data/lib/wallee-ruby-sdk/models/abstract_space_update.rb +11 -1
  16. data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +59 -1
  17. data/lib/wallee-ruby-sdk/models/abstract_webhook_url_update.rb +24 -0
  18. data/lib/wallee-ruby-sdk/models/account.rb +31 -1
  19. data/lib/wallee-ruby-sdk/models/account_create.rb +11 -1
  20. data/lib/wallee-ruby-sdk/models/account_update.rb +11 -1
  21. data/lib/wallee-ruby-sdk/models/charge_attempt.rb +11 -1
  22. data/lib/wallee-ruby-sdk/models/payment_connector_configuration.rb +13 -1
  23. data/lib/wallee-ruby-sdk/models/sales_channel.rb +34 -4
  24. data/lib/wallee-ruby-sdk/models/shopify_additional_line_item_data.rb +35 -0
  25. data/lib/wallee-ruby-sdk/models/shopify_integration.rb +73 -31
  26. data/lib/wallee-ruby-sdk/models/shopify_integration_payment_app_version.rb +34 -0
  27. data/lib/wallee-ruby-sdk/models/{shopify_integration_app_version.rb → shopify_integration_subscription_app_version.rb} +3 -3
  28. data/lib/wallee-ruby-sdk/models/shopify_subscriber_creation.rb +216 -0
  29. data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +51 -7
  30. data/lib/wallee-ruby-sdk/models/shopify_subscription_address.rb +0 -60
  31. data/lib/wallee-ruby-sdk/models/shopify_subscription_address_create.rb +546 -0
  32. data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +353 -0
  33. data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +261 -0
  34. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_item.rb → shopify_subscription_model_item.rb} +2 -2
  35. data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_tax_line.rb → shopify_subscription_model_tax_line.rb} +1 -1
  36. data/lib/wallee-ruby-sdk/models/shopify_subscription_product_create.rb +9 -14
  37. data/lib/wallee-ruby-sdk/models/{shopify_subscription_product_active.rb → shopify_subscription_product_update.rb} +2 -12
  38. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_addresses_request.rb +211 -0
  39. data/lib/wallee-ruby-sdk/models/shopify_subscription_update_request.rb +11 -81
  40. data/lib/wallee-ruby-sdk/models/space.rb +31 -1
  41. data/lib/wallee-ruby-sdk/models/space_create.rb +11 -1
  42. data/lib/wallee-ruby-sdk/models/space_update.rb +11 -1
  43. data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
  44. data/lib/wallee-ruby-sdk/models/subscription_charge.rb +48 -0
  45. data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +48 -0
  46. data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +1 -1
  47. data/lib/wallee-ruby-sdk/models/subscription_product_version.rb +11 -1
  48. data/lib/wallee-ruby-sdk/models/subscription_product_version_pending.rb +14 -4
  49. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +206 -0
  50. data/lib/wallee-ruby-sdk/models/tax_calculation.rb +35 -0
  51. data/lib/wallee-ruby-sdk/models/transaction.rb +69 -1
  52. data/lib/wallee-ruby-sdk/models/transaction_completion.rb +26 -1
  53. data/lib/wallee-ruby-sdk/models/transaction_completion_behavior.rb +36 -0
  54. data/lib/wallee-ruby-sdk/models/transaction_completion_request.rb +26 -1
  55. data/lib/wallee-ruby-sdk/models/transaction_create.rb +59 -1
  56. data/lib/wallee-ruby-sdk/models/transaction_pending.rb +59 -1
  57. data/lib/wallee-ruby-sdk/models/webhook_url.rb +24 -0
  58. data/lib/wallee-ruby-sdk/models/webhook_url_create.rb +24 -0
  59. data/lib/wallee-ruby-sdk/models/webhook_url_update.rb +24 -0
  60. data/lib/wallee-ruby-sdk/version.rb +1 -1
  61. data/wallee-ruby-sdk.gemspec +3 -2
  62. metadata +45 -14
@@ -0,0 +1,353 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ #
22
+ class ShopifySubscriptionCreationRequest
23
+ #
24
+ attr_accessor :billing_address
25
+
26
+ #
27
+ attr_accessor :billing_configuration
28
+
29
+ #
30
+ attr_accessor :currency
31
+
32
+ # The external id helps to identify the entity and a subsequent creation of an entity with the same ID will not create a new entity.
33
+ attr_accessor :external_id
34
+
35
+ #
36
+ attr_accessor :integration
37
+
38
+ #
39
+ attr_accessor :items
40
+
41
+ #
42
+ attr_accessor :language
43
+
44
+ #
45
+ attr_accessor :shipping_address
46
+
47
+ #
48
+ attr_accessor :shipping_method_name
49
+
50
+ #
51
+ attr_accessor :space_view_id
52
+
53
+ #
54
+ attr_accessor :store_order_confirmation_email_enabled
55
+
56
+ #
57
+ attr_accessor :subscriber
58
+
59
+ #
60
+ attr_accessor :subscriber_suspension_allowed
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'billing_address' => :'billingAddress',
66
+ :'billing_configuration' => :'billingConfiguration',
67
+ :'currency' => :'currency',
68
+ :'external_id' => :'externalId',
69
+ :'integration' => :'integration',
70
+ :'items' => :'items',
71
+ :'language' => :'language',
72
+ :'shipping_address' => :'shippingAddress',
73
+ :'shipping_method_name' => :'shippingMethodName',
74
+ :'space_view_id' => :'spaceViewId',
75
+ :'store_order_confirmation_email_enabled' => :'storeOrderConfirmationEmailEnabled',
76
+ :'subscriber' => :'subscriber',
77
+ :'subscriber_suspension_allowed' => :'subscriberSuspensionAllowed'
78
+ }
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.swagger_types
83
+ {
84
+ :'billing_address' => :'ShopifySubscriptionAddressCreate',
85
+ :'billing_configuration' => :'ShopifySubscriptionModelBillingConfiguration',
86
+ :'currency' => :'String',
87
+ :'external_id' => :'String',
88
+ :'integration' => :'Integer',
89
+ :'items' => :'Array<ShopifySubscriptionModelItem>',
90
+ :'language' => :'String',
91
+ :'shipping_address' => :'ShopifySubscriptionAddressCreate',
92
+ :'shipping_method_name' => :'String',
93
+ :'space_view_id' => :'Integer',
94
+ :'store_order_confirmation_email_enabled' => :'BOOLEAN',
95
+ :'subscriber' => :'ShopifySubscriberCreation',
96
+ :'subscriber_suspension_allowed' => :'BOOLEAN'
97
+ }
98
+ end
99
+
100
+ # Initializes the object
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ def initialize(attributes = {})
103
+ return unless attributes.is_a?(Hash)
104
+
105
+ # convert string to symbol for hash key
106
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
107
+
108
+ if attributes.has_key?(:'billingAddress')
109
+ self.billing_address = attributes[:'billingAddress']
110
+ end
111
+
112
+ if attributes.has_key?(:'billingConfiguration')
113
+ self.billing_configuration = attributes[:'billingConfiguration']
114
+ end
115
+
116
+ if attributes.has_key?(:'currency')
117
+ self.currency = attributes[:'currency']
118
+ end
119
+
120
+ if attributes.has_key?(:'externalId')
121
+ self.external_id = attributes[:'externalId']
122
+ end
123
+
124
+ if attributes.has_key?(:'integration')
125
+ self.integration = attributes[:'integration']
126
+ end
127
+
128
+ if attributes.has_key?(:'items')
129
+ if (value = attributes[:'items']).is_a?(Array)
130
+ self.items = value
131
+ end
132
+ end
133
+
134
+ if attributes.has_key?(:'language')
135
+ self.language = attributes[:'language']
136
+ end
137
+
138
+ if attributes.has_key?(:'shippingAddress')
139
+ self.shipping_address = attributes[:'shippingAddress']
140
+ end
141
+
142
+ if attributes.has_key?(:'shippingMethodName')
143
+ self.shipping_method_name = attributes[:'shippingMethodName']
144
+ end
145
+
146
+ if attributes.has_key?(:'spaceViewId')
147
+ self.space_view_id = attributes[:'spaceViewId']
148
+ end
149
+
150
+ if attributes.has_key?(:'storeOrderConfirmationEmailEnabled')
151
+ self.store_order_confirmation_email_enabled = attributes[:'storeOrderConfirmationEmailEnabled']
152
+ end
153
+
154
+ if attributes.has_key?(:'subscriber')
155
+ self.subscriber = attributes[:'subscriber']
156
+ end
157
+
158
+ if attributes.has_key?(:'subscriberSuspensionAllowed')
159
+ self.subscriber_suspension_allowed = attributes[:'subscriberSuspensionAllowed']
160
+ end
161
+ end
162
+
163
+ # Show invalid properties with the reasons. Usually used together with valid?
164
+ # @return Array for valid properties with the reasons
165
+ def list_invalid_properties
166
+ invalid_properties = Array.new
167
+ if @billing_address.nil?
168
+ invalid_properties.push('invalid value for "billing_address", billing_address cannot be nil.')
169
+ end
170
+
171
+ if @currency.nil?
172
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
173
+ end
174
+
175
+ if @external_id.nil?
176
+ invalid_properties.push('invalid value for "external_id", external_id cannot be nil.')
177
+ end
178
+
179
+ if @integration.nil?
180
+ invalid_properties.push('invalid value for "integration", integration cannot be nil.')
181
+ end
182
+
183
+ if @items.nil?
184
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
185
+ end
186
+
187
+ if @language.nil?
188
+ invalid_properties.push('invalid value for "language", language cannot be nil.')
189
+ end
190
+
191
+ if @shipping_address.nil?
192
+ invalid_properties.push('invalid value for "shipping_address", shipping_address cannot be nil.')
193
+ end
194
+
195
+ if @subscriber.nil?
196
+ invalid_properties.push('invalid value for "subscriber", subscriber cannot be nil.')
197
+ end
198
+
199
+ invalid_properties
200
+ end
201
+
202
+ # Check to see if the all the properties in the model are valid
203
+ # @return true if the model is valid
204
+ def valid?
205
+ return false if @billing_address.nil?
206
+ return false if @currency.nil?
207
+ return false if @external_id.nil?
208
+ return false if @integration.nil?
209
+ return false if @items.nil?
210
+ return false if @language.nil?
211
+ return false if @shipping_address.nil?
212
+ return false if @subscriber.nil?
213
+ true
214
+ end
215
+
216
+ # Checks equality by comparing each attribute.
217
+ # @param [Object] Object to be compared
218
+ def ==(o)
219
+ return true if self.equal?(o)
220
+ self.class == o.class &&
221
+ billing_address == o.billing_address &&
222
+ billing_configuration == o.billing_configuration &&
223
+ currency == o.currency &&
224
+ external_id == o.external_id &&
225
+ integration == o.integration &&
226
+ items == o.items &&
227
+ language == o.language &&
228
+ shipping_address == o.shipping_address &&
229
+ shipping_method_name == o.shipping_method_name &&
230
+ space_view_id == o.space_view_id &&
231
+ store_order_confirmation_email_enabled == o.store_order_confirmation_email_enabled &&
232
+ subscriber == o.subscriber &&
233
+ subscriber_suspension_allowed == o.subscriber_suspension_allowed
234
+ end
235
+
236
+ # @see the `==` method
237
+ # @param [Object] Object to be compared
238
+ def eql?(o)
239
+ self == o
240
+ end
241
+
242
+ # Calculates hash code according to all attributes.
243
+ # @return [Fixnum] Hash code
244
+ def hash
245
+ [billing_address, billing_configuration, currency, external_id, integration, items, language, shipping_address, shipping_method_name, space_view_id, store_order_confirmation_email_enabled, subscriber, subscriber_suspension_allowed].hash
246
+ end
247
+
248
+ # Builds the object from hash
249
+ # @param [Hash] attributes Model attributes in the form of hash
250
+ # @return [Object] Returns the model itself
251
+ def build_from_hash(attributes)
252
+ return nil unless attributes.is_a?(Hash)
253
+ self.class.swagger_types.each_pair do |key, type|
254
+ if type =~ /\AArray<(.*)>/i
255
+ # check to ensure the input is an array given that the attribute
256
+ # is documented as an array but the input is not
257
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
258
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
259
+ end
260
+ elsif !attributes[self.class.attribute_map[key]].nil?
261
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
262
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
263
+ end
264
+
265
+ self
266
+ end
267
+
268
+ # Deserializes the data based on type
269
+ # @param string type Data type
270
+ # @param string value Value to be deserialized
271
+ # @return [Object] Deserialized data
272
+ def _deserialize(type, value)
273
+ case type.to_sym
274
+ when :DateTime
275
+ DateTime.parse(value)
276
+ when :Date
277
+ Date.parse(value)
278
+ when :String
279
+ value.to_s
280
+ when :Integer
281
+ value.to_i
282
+ when :Float
283
+ value.to_f
284
+ when :BOOLEAN
285
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
286
+ true
287
+ else
288
+ false
289
+ end
290
+ when :Object
291
+ # generic object (usually a Hash), return directly
292
+ value
293
+ when /\AArray<(?<inner_type>.+)>\z/
294
+ inner_type = Regexp.last_match[:inner_type]
295
+ value.map { |v| _deserialize(inner_type, v) }
296
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
297
+ k_type = Regexp.last_match[:k_type]
298
+ v_type = Regexp.last_match[:v_type]
299
+ {}.tap do |hash|
300
+ value.each do |k, v|
301
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
302
+ end
303
+ end
304
+ else # model
305
+ temp_model = Wallee.const_get(type).new
306
+ temp_model.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ next if value.nil?
329
+ hash[param] = _to_hash(value)
330
+ end
331
+ hash
332
+ end
333
+
334
+ # Outputs non-array value in the form of hash
335
+ # For object, use to_hash. Otherwise, just return the value
336
+ # @param [Object] value Any valid value
337
+ # @return [Hash] Returns the value in the form of hash
338
+ def _to_hash(value)
339
+ if value.is_a?(Array)
340
+ value.compact.map{ |v| _to_hash(v) }
341
+ elsif value.is_a?(Hash)
342
+ {}.tap do |hash|
343
+ value.each { |k, v| hash[k] = _to_hash(v) }
344
+ end
345
+ elsif value.respond_to? :to_hash
346
+ value.to_hash
347
+ else
348
+ value
349
+ end
350
+ end
351
+
352
+ end
353
+ end
@@ -0,0 +1,261 @@
1
+ =begin
2
+ The wallee API allows an easy interaction with the wallee web service.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
16
+ =end
17
+
18
+ require 'date'
19
+
20
+ module Wallee
21
+ #
22
+ class ShopifySubscriptionModelBillingConfiguration
23
+ # Define the day of the month on which the recurring orders should be created.
24
+ attr_accessor :billing_day_of_month
25
+
26
+ #
27
+ attr_accessor :billing_interval_amount
28
+
29
+ # Define how frequently recurring orders should be created.
30
+ attr_accessor :billing_interval_unit
31
+
32
+ # Define the weekday on which the recurring orders should be created.
33
+ attr_accessor :billing_weekday
34
+
35
+ # Define the maximum number of orders the subscription will run for.
36
+ attr_accessor :maximal_billing_cycles
37
+
38
+ # Define the maximum number of orders the subscription can be suspended for at a time.
39
+ attr_accessor :maximal_suspendable_cycles
40
+
41
+ # Define the minimal number of orders the subscription will run for.
42
+ attr_accessor :minimal_billing_cycles
43
+
44
+ # Define the number of orders the subscription will keep running for after its termination has been requested.
45
+ attr_accessor :termination_billing_cycles
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'billing_day_of_month' => :'billingDayOfMonth',
51
+ :'billing_interval_amount' => :'billingIntervalAmount',
52
+ :'billing_interval_unit' => :'billingIntervalUnit',
53
+ :'billing_weekday' => :'billingWeekday',
54
+ :'maximal_billing_cycles' => :'maximalBillingCycles',
55
+ :'maximal_suspendable_cycles' => :'maximalSuspendableCycles',
56
+ :'minimal_billing_cycles' => :'minimalBillingCycles',
57
+ :'termination_billing_cycles' => :'terminationBillingCycles'
58
+ }
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.swagger_types
63
+ {
64
+ :'billing_day_of_month' => :'Integer',
65
+ :'billing_interval_amount' => :'Integer',
66
+ :'billing_interval_unit' => :'ShopifySubscriptionBillingIntervalUnit',
67
+ :'billing_weekday' => :'ShopifySubscriptionWeekday',
68
+ :'maximal_billing_cycles' => :'Integer',
69
+ :'maximal_suspendable_cycles' => :'Integer',
70
+ :'minimal_billing_cycles' => :'Integer',
71
+ :'termination_billing_cycles' => :'Integer'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ if attributes.has_key?(:'billingDayOfMonth')
84
+ self.billing_day_of_month = attributes[:'billingDayOfMonth']
85
+ end
86
+
87
+ if attributes.has_key?(:'billingIntervalAmount')
88
+ self.billing_interval_amount = attributes[:'billingIntervalAmount']
89
+ end
90
+
91
+ if attributes.has_key?(:'billingIntervalUnit')
92
+ self.billing_interval_unit = attributes[:'billingIntervalUnit']
93
+ end
94
+
95
+ if attributes.has_key?(:'billingWeekday')
96
+ self.billing_weekday = attributes[:'billingWeekday']
97
+ end
98
+
99
+ if attributes.has_key?(:'maximalBillingCycles')
100
+ self.maximal_billing_cycles = attributes[:'maximalBillingCycles']
101
+ end
102
+
103
+ if attributes.has_key?(:'maximalSuspendableCycles')
104
+ self.maximal_suspendable_cycles = attributes[:'maximalSuspendableCycles']
105
+ end
106
+
107
+ if attributes.has_key?(:'minimalBillingCycles')
108
+ self.minimal_billing_cycles = attributes[:'minimalBillingCycles']
109
+ end
110
+
111
+ if attributes.has_key?(:'terminationBillingCycles')
112
+ self.termination_billing_cycles = attributes[:'terminationBillingCycles']
113
+ end
114
+ end
115
+
116
+ # Show invalid properties with the reasons. Usually used together with valid?
117
+ # @return Array for valid properties with the reasons
118
+ def list_invalid_properties
119
+ invalid_properties = Array.new
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ true
127
+ end
128
+
129
+ # Checks equality by comparing each attribute.
130
+ # @param [Object] Object to be compared
131
+ def ==(o)
132
+ return true if self.equal?(o)
133
+ self.class == o.class &&
134
+ billing_day_of_month == o.billing_day_of_month &&
135
+ billing_interval_amount == o.billing_interval_amount &&
136
+ billing_interval_unit == o.billing_interval_unit &&
137
+ billing_weekday == o.billing_weekday &&
138
+ maximal_billing_cycles == o.maximal_billing_cycles &&
139
+ maximal_suspendable_cycles == o.maximal_suspendable_cycles &&
140
+ minimal_billing_cycles == o.minimal_billing_cycles &&
141
+ termination_billing_cycles == o.termination_billing_cycles
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Fixnum] Hash code
152
+ def hash
153
+ [billing_day_of_month, billing_interval_amount, billing_interval_unit, billing_weekday, maximal_billing_cycles, maximal_suspendable_cycles, minimal_billing_cycles, termination_billing_cycles].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ self.class.swagger_types.each_pair do |key, type|
162
+ if type =~ /\AArray<(.*)>/i
163
+ # check to ensure the input is an array given that the attribute
164
+ # is documented as an array but the input is not
165
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
166
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
167
+ end
168
+ elsif !attributes[self.class.attribute_map[key]].nil?
169
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
170
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
171
+ end
172
+
173
+ self
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 _deserialize(type, value)
181
+ case type.to_sym
182
+ when :DateTime
183
+ DateTime.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
+ temp_model = Wallee.const_get(type).new
214
+ temp_model.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ next if value.nil?
237
+ hash[param] = _to_hash(value)
238
+ end
239
+ hash
240
+ end
241
+
242
+ # Outputs non-array value in the form of hash
243
+ # For object, use to_hash. Otherwise, just return the value
244
+ # @param [Object] value Any valid value
245
+ # @return [Hash] Returns the value in the form of hash
246
+ def _to_hash(value)
247
+ if value.is_a?(Array)
248
+ value.compact.map{ |v| _to_hash(v) }
249
+ elsif value.is_a?(Hash)
250
+ {}.tap do |hash|
251
+ value.each { |k, v| hash[k] = _to_hash(v) }
252
+ end
253
+ elsif value.respond_to? :to_hash
254
+ value.to_hash
255
+ else
256
+ value
257
+ end
258
+ end
259
+
260
+ end
261
+ end