ultracart_api 3.11.47 → 3.11.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,455 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ConversationPbxHardwarePhone
17
+ # Conversation Pbx Hardware Phone UUID
18
+ attr_accessor :conversation_pbx_hardware_phone_uuid
19
+
20
+ # Created At
21
+ attr_accessor :created_at
22
+
23
+ # Description
24
+ attr_accessor :description
25
+
26
+ # MAC Address
27
+ attr_accessor :mac_address
28
+
29
+ # Manufacturer
30
+ attr_accessor :manufacturer
31
+
32
+ # Merchant Id
33
+ attr_accessor :merchant_id
34
+
35
+ # Model
36
+ attr_accessor :model
37
+
38
+ # Name
39
+ attr_accessor :name
40
+
41
+ # Auto-provisioning URL for phone configuration
42
+ attr_accessor :provisioning_url
43
+
44
+ # SIP Domain
45
+ attr_accessor :sip_domain
46
+
47
+ # SIP Password
48
+ attr_accessor :sip_password
49
+
50
+ # SIP Username
51
+ attr_accessor :sip_username
52
+
53
+ # Updated At
54
+ attr_accessor :updated_at
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'conversation_pbx_hardware_phone_uuid' => :'conversation_pbx_hardware_phone_uuid',
60
+ :'created_at' => :'created_at',
61
+ :'description' => :'description',
62
+ :'mac_address' => :'mac_address',
63
+ :'manufacturer' => :'manufacturer',
64
+ :'merchant_id' => :'merchant_id',
65
+ :'model' => :'model',
66
+ :'name' => :'name',
67
+ :'provisioning_url' => :'provisioning_url',
68
+ :'sip_domain' => :'sip_domain',
69
+ :'sip_password' => :'sip_password',
70
+ :'sip_username' => :'sip_username',
71
+ :'updated_at' => :'updated_at'
72
+ }
73
+ end
74
+
75
+ # Attribute type mapping.
76
+ def self.swagger_types
77
+ {
78
+ :'conversation_pbx_hardware_phone_uuid' => :'String',
79
+ :'created_at' => :'Object',
80
+ :'description' => :'String',
81
+ :'mac_address' => :'String',
82
+ :'manufacturer' => :'String',
83
+ :'merchant_id' => :'String',
84
+ :'model' => :'String',
85
+ :'name' => :'String',
86
+ :'provisioning_url' => :'String',
87
+ :'sip_domain' => :'String',
88
+ :'sip_password' => :'String',
89
+ :'sip_username' => :'String',
90
+ :'updated_at' => :'Object'
91
+ }
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ return unless attributes.is_a?(Hash)
98
+
99
+ # convert string to symbol for hash key
100
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
101
+
102
+ if attributes.has_key?(:'conversation_pbx_hardware_phone_uuid')
103
+ self.conversation_pbx_hardware_phone_uuid = attributes[:'conversation_pbx_hardware_phone_uuid']
104
+ end
105
+
106
+ if attributes.has_key?(:'created_at')
107
+ self.created_at = attributes[:'created_at']
108
+ end
109
+
110
+ if attributes.has_key?(:'description')
111
+ self.description = attributes[:'description']
112
+ end
113
+
114
+ if attributes.has_key?(:'mac_address')
115
+ self.mac_address = attributes[:'mac_address']
116
+ end
117
+
118
+ if attributes.has_key?(:'manufacturer')
119
+ self.manufacturer = attributes[:'manufacturer']
120
+ end
121
+
122
+ if attributes.has_key?(:'merchant_id')
123
+ self.merchant_id = attributes[:'merchant_id']
124
+ end
125
+
126
+ if attributes.has_key?(:'model')
127
+ self.model = attributes[:'model']
128
+ end
129
+
130
+ if attributes.has_key?(:'name')
131
+ self.name = attributes[:'name']
132
+ end
133
+
134
+ if attributes.has_key?(:'provisioning_url')
135
+ self.provisioning_url = attributes[:'provisioning_url']
136
+ end
137
+
138
+ if attributes.has_key?(:'sip_domain')
139
+ self.sip_domain = attributes[:'sip_domain']
140
+ end
141
+
142
+ if attributes.has_key?(:'sip_password')
143
+ self.sip_password = attributes[:'sip_password']
144
+ end
145
+
146
+ if attributes.has_key?(:'sip_username')
147
+ self.sip_username = attributes[:'sip_username']
148
+ end
149
+
150
+ if attributes.has_key?(:'updated_at')
151
+ self.updated_at = attributes[:'updated_at']
152
+ end
153
+ end
154
+
155
+ # Show invalid properties with the reasons. Usually used together with valid?
156
+ # @return Array for valid properties with the reasons
157
+ def list_invalid_properties
158
+ invalid_properties = Array.new
159
+ if !@conversation_pbx_hardware_phone_uuid.nil? && @conversation_pbx_hardware_phone_uuid.to_s.length > 50
160
+ invalid_properties.push('invalid value for "conversation_pbx_hardware_phone_uuid", the character length must be smaller than or equal to 50.')
161
+ end
162
+
163
+ if !@description.nil? && @description.to_s.length > 500
164
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
165
+ end
166
+
167
+ if !@mac_address.nil? && @mac_address.to_s.length > 17
168
+ invalid_properties.push('invalid value for "mac_address", the character length must be smaller than or equal to 17.')
169
+ end
170
+
171
+ if !@manufacturer.nil? && @manufacturer.to_s.length > 100
172
+ invalid_properties.push('invalid value for "manufacturer", the character length must be smaller than or equal to 100.')
173
+ end
174
+
175
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
176
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
177
+ end
178
+
179
+ if !@model.nil? && @model.to_s.length > 100
180
+ invalid_properties.push('invalid value for "model", the character length must be smaller than or equal to 100.')
181
+ end
182
+
183
+ if !@name.nil? && @name.to_s.length > 100
184
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
185
+ end
186
+
187
+ if !@sip_domain.nil? && @sip_domain.to_s.length > 200
188
+ invalid_properties.push('invalid value for "sip_domain", the character length must be smaller than or equal to 200.')
189
+ end
190
+
191
+ if !@sip_password.nil? && @sip_password.to_s.length > 100
192
+ invalid_properties.push('invalid value for "sip_password", the character length must be smaller than or equal to 100.')
193
+ end
194
+
195
+ if !@sip_username.nil? && @sip_username.to_s.length > 100
196
+ invalid_properties.push('invalid value for "sip_username", the character length must be smaller than or equal to 100.')
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 !@conversation_pbx_hardware_phone_uuid.nil? && @conversation_pbx_hardware_phone_uuid.to_s.length > 50
206
+ return false if !@description.nil? && @description.to_s.length > 500
207
+ return false if !@mac_address.nil? && @mac_address.to_s.length > 17
208
+ return false if !@manufacturer.nil? && @manufacturer.to_s.length > 100
209
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
210
+ return false if !@model.nil? && @model.to_s.length > 100
211
+ return false if !@name.nil? && @name.to_s.length > 100
212
+ return false if !@sip_domain.nil? && @sip_domain.to_s.length > 200
213
+ return false if !@sip_password.nil? && @sip_password.to_s.length > 100
214
+ return false if !@sip_username.nil? && @sip_username.to_s.length > 100
215
+ true
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] conversation_pbx_hardware_phone_uuid Value to be assigned
220
+ def conversation_pbx_hardware_phone_uuid=(conversation_pbx_hardware_phone_uuid)
221
+ if !conversation_pbx_hardware_phone_uuid.nil? && conversation_pbx_hardware_phone_uuid.to_s.length > 50
222
+ fail ArgumentError, 'invalid value for "conversation_pbx_hardware_phone_uuid", the character length must be smaller than or equal to 50.'
223
+ end
224
+
225
+ @conversation_pbx_hardware_phone_uuid = conversation_pbx_hardware_phone_uuid
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] description Value to be assigned
230
+ def description=(description)
231
+ if !description.nil? && description.to_s.length > 500
232
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
233
+ end
234
+
235
+ @description = description
236
+ end
237
+
238
+ # Custom attribute writer method with validation
239
+ # @param [Object] mac_address Value to be assigned
240
+ def mac_address=(mac_address)
241
+ if !mac_address.nil? && mac_address.to_s.length > 17
242
+ fail ArgumentError, 'invalid value for "mac_address", the character length must be smaller than or equal to 17.'
243
+ end
244
+
245
+ @mac_address = mac_address
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] manufacturer Value to be assigned
250
+ def manufacturer=(manufacturer)
251
+ if !manufacturer.nil? && manufacturer.to_s.length > 100
252
+ fail ArgumentError, 'invalid value for "manufacturer", the character length must be smaller than or equal to 100.'
253
+ end
254
+
255
+ @manufacturer = manufacturer
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] merchant_id Value to be assigned
260
+ def merchant_id=(merchant_id)
261
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
262
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
263
+ end
264
+
265
+ @merchant_id = merchant_id
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] model Value to be assigned
270
+ def model=(model)
271
+ if !model.nil? && model.to_s.length > 100
272
+ fail ArgumentError, 'invalid value for "model", the character length must be smaller than or equal to 100.'
273
+ end
274
+
275
+ @model = model
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] name Value to be assigned
280
+ def name=(name)
281
+ if !name.nil? && name.to_s.length > 100
282
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
283
+ end
284
+
285
+ @name = name
286
+ end
287
+
288
+ # Custom attribute writer method with validation
289
+ # @param [Object] sip_domain Value to be assigned
290
+ def sip_domain=(sip_domain)
291
+ if !sip_domain.nil? && sip_domain.to_s.length > 200
292
+ fail ArgumentError, 'invalid value for "sip_domain", the character length must be smaller than or equal to 200.'
293
+ end
294
+
295
+ @sip_domain = sip_domain
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] sip_password Value to be assigned
300
+ def sip_password=(sip_password)
301
+ if !sip_password.nil? && sip_password.to_s.length > 100
302
+ fail ArgumentError, 'invalid value for "sip_password", the character length must be smaller than or equal to 100.'
303
+ end
304
+
305
+ @sip_password = sip_password
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] sip_username Value to be assigned
310
+ def sip_username=(sip_username)
311
+ if !sip_username.nil? && sip_username.to_s.length > 100
312
+ fail ArgumentError, 'invalid value for "sip_username", the character length must be smaller than or equal to 100.'
313
+ end
314
+
315
+ @sip_username = sip_username
316
+ end
317
+
318
+ # Checks equality by comparing each attribute.
319
+ # @param [Object] Object to be compared
320
+ def ==(o)
321
+ return true if self.equal?(o)
322
+ self.class == o.class &&
323
+ conversation_pbx_hardware_phone_uuid == o.conversation_pbx_hardware_phone_uuid &&
324
+ created_at == o.created_at &&
325
+ description == o.description &&
326
+ mac_address == o.mac_address &&
327
+ manufacturer == o.manufacturer &&
328
+ merchant_id == o.merchant_id &&
329
+ model == o.model &&
330
+ name == o.name &&
331
+ provisioning_url == o.provisioning_url &&
332
+ sip_domain == o.sip_domain &&
333
+ sip_password == o.sip_password &&
334
+ sip_username == o.sip_username &&
335
+ updated_at == o.updated_at
336
+ end
337
+
338
+ # @see the `==` method
339
+ # @param [Object] Object to be compared
340
+ def eql?(o)
341
+ self == o
342
+ end
343
+
344
+ # Calculates hash code according to all attributes.
345
+ # @return [Fixnum] Hash code
346
+ def hash
347
+ [conversation_pbx_hardware_phone_uuid, created_at, description, mac_address, manufacturer, merchant_id, model, name, provisioning_url, sip_domain, sip_password, sip_username, updated_at].hash
348
+ end
349
+
350
+ # Builds the object from hash
351
+ # @param [Hash] attributes Model attributes in the form of hash
352
+ # @return [Object] Returns the model itself
353
+ def build_from_hash(attributes)
354
+ return nil unless attributes.is_a?(Hash)
355
+ self.class.swagger_types.each_pair do |key, type|
356
+ if type =~ /\AArray<(.*)>/i
357
+ # check to ensure the input is an array given that the attribute
358
+ # is documented as an array but the input is not
359
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
360
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
361
+ end
362
+ elsif !attributes[self.class.attribute_map[key]].nil?
363
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
364
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
365
+ end
366
+
367
+ self
368
+ end
369
+
370
+ # Deserializes the data based on type
371
+ # @param string type Data type
372
+ # @param string value Value to be deserialized
373
+ # @return [Object] Deserialized data
374
+ def _deserialize(type, value)
375
+ case type.to_sym
376
+ when :DateTime
377
+ DateTime.parse(value)
378
+ when :Date
379
+ Date.parse(value)
380
+ when :String
381
+ value.to_s
382
+ when :Integer
383
+ value.to_i
384
+ when :Float
385
+ value.to_f
386
+ when :BOOLEAN
387
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
388
+ true
389
+ else
390
+ false
391
+ end
392
+ when :Object
393
+ # generic object (usually a Hash), return directly
394
+ value
395
+ when /\AArray<(?<inner_type>.+)>\z/
396
+ inner_type = Regexp.last_match[:inner_type]
397
+ value.map { |v| _deserialize(inner_type, v) }
398
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
399
+ k_type = Regexp.last_match[:k_type]
400
+ v_type = Regexp.last_match[:v_type]
401
+ {}.tap do |hash|
402
+ value.each do |k, v|
403
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
404
+ end
405
+ end
406
+ else # model
407
+ temp_model = UltracartClient.const_get(type).new
408
+ temp_model.build_from_hash(value)
409
+ end
410
+ end
411
+
412
+ # Returns the string representation of the object
413
+ # @return [String] String presentation of the object
414
+ def to_s
415
+ to_hash.to_s
416
+ end
417
+
418
+ # to_body is an alias to to_hash (backward compatibility)
419
+ # @return [Hash] Returns the object in the form of hash
420
+ def to_body
421
+ to_hash
422
+ end
423
+
424
+ # Returns the object in the form of hash
425
+ # @return [Hash] Returns the object in the form of hash
426
+ def to_hash
427
+ hash = {}
428
+ self.class.attribute_map.each_pair do |attr, param|
429
+ value = self.send(attr)
430
+ next if value.nil?
431
+ hash[param] = _to_hash(value)
432
+ end
433
+ hash
434
+ end
435
+
436
+ # Outputs non-array value in the form of hash
437
+ # For object, use to_hash. Otherwise, just return the value
438
+ # @param [Object] value Any valid value
439
+ # @return [Hash] Returns the value in the form of hash
440
+ def _to_hash(value)
441
+ if value.is_a?(Array)
442
+ value.compact.map { |v| _to_hash(v) }
443
+ elsif value.is_a?(Hash)
444
+ {}.tap do |hash|
445
+ value.each { |k, v| hash[k] = _to_hash(v) }
446
+ end
447
+ elsif value.respond_to? :to_hash
448
+ value.to_hash
449
+ else
450
+ value
451
+ end
452
+ end
453
+
454
+ end
455
+ end
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ConversationPbxHardwarePhoneResponse
17
+ attr_accessor :error
18
+
19
+ attr_accessor :hardware_phone
20
+
21
+ attr_accessor :metadata
22
+
23
+ # Indicates if API call was successful
24
+ attr_accessor :success
25
+
26
+ attr_accessor :warning
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'error' => :'error',
32
+ :'hardware_phone' => :'hardware_phone',
33
+ :'metadata' => :'metadata',
34
+ :'success' => :'success',
35
+ :'warning' => :'warning'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'error' => :'Error',
43
+ :'hardware_phone' => :'ConversationPbxHardwarePhone',
44
+ :'metadata' => :'ResponseMetadata',
45
+ :'success' => :'BOOLEAN',
46
+ :'warning' => :'Warning'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'error')
59
+ self.error = attributes[:'error']
60
+ end
61
+
62
+ if attributes.has_key?(:'hardware_phone')
63
+ self.hardware_phone = attributes[:'hardware_phone']
64
+ end
65
+
66
+ if attributes.has_key?(:'metadata')
67
+ self.metadata = attributes[:'metadata']
68
+ end
69
+
70
+ if attributes.has_key?(:'success')
71
+ self.success = attributes[:'success']
72
+ end
73
+
74
+ if attributes.has_key?(:'warning')
75
+ self.warning = attributes[:'warning']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ error == o.error &&
98
+ hardware_phone == o.hardware_phone &&
99
+ metadata == o.metadata &&
100
+ success == o.success &&
101
+ warning == o.warning
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [error, hardware_phone, metadata, success, warning].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = UltracartClient.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end