ultracart_api 4.1.40 → 4.1.42

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,490 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ConversationPbxAddress
18
+ # Twilio Address SID
19
+ attr_accessor :address_sid
20
+
21
+ # City
22
+ attr_accessor :city
23
+
24
+ # Conversation Pbx Address UUID
25
+ attr_accessor :conversation_pbx_address_uuid
26
+
27
+ # ISO country code (2 characters)
28
+ attr_accessor :country_code
29
+
30
+ # Customer name
31
+ attr_accessor :customer_name
32
+
33
+ # Friendly name for the address
34
+ attr_accessor :friendly_name
35
+
36
+ # Merchant Id
37
+ attr_accessor :merchant_id
38
+
39
+ # Postal code
40
+ attr_accessor :postal_code
41
+
42
+ # State/Province/Region
43
+ attr_accessor :region
44
+
45
+ # Street address
46
+ attr_accessor :street
47
+
48
+ # Whether the address is valid (validated or verified)
49
+ attr_accessor :valid
50
+
51
+ # Whether the address has been validated by Twilio
52
+ attr_accessor :validated
53
+
54
+ # Whether the address has been verified by Twilio
55
+ attr_accessor :verified
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'address_sid' => :'address_sid',
61
+ :'city' => :'city',
62
+ :'conversation_pbx_address_uuid' => :'conversation_pbx_address_uuid',
63
+ :'country_code' => :'country_code',
64
+ :'customer_name' => :'customer_name',
65
+ :'friendly_name' => :'friendly_name',
66
+ :'merchant_id' => :'merchant_id',
67
+ :'postal_code' => :'postal_code',
68
+ :'region' => :'region',
69
+ :'street' => :'street',
70
+ :'valid' => :'valid',
71
+ :'validated' => :'validated',
72
+ :'verified' => :'verified'
73
+ }
74
+ end
75
+
76
+ # Returns all the JSON keys this model knows about
77
+ def self.acceptable_attributes
78
+ attribute_map.values
79
+ end
80
+
81
+ # Attribute type mapping.
82
+ def self.openapi_types
83
+ {
84
+ :'address_sid' => :'String',
85
+ :'city' => :'String',
86
+ :'conversation_pbx_address_uuid' => :'String',
87
+ :'country_code' => :'String',
88
+ :'customer_name' => :'String',
89
+ :'friendly_name' => :'String',
90
+ :'merchant_id' => :'String',
91
+ :'postal_code' => :'String',
92
+ :'region' => :'String',
93
+ :'street' => :'String',
94
+ :'valid' => :'Boolean',
95
+ :'validated' => :'Boolean',
96
+ :'verified' => :'Boolean'
97
+ }
98
+ end
99
+
100
+ # List of attributes with nullable: true
101
+ def self.openapi_nullable
102
+ Set.new([
103
+ ])
104
+ end
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ def initialize(attributes = {})
109
+ if (!attributes.is_a?(Hash))
110
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationPbxAddress` initialize method"
111
+ end
112
+
113
+ # check to see if the attribute exists and convert string to symbol for hash key
114
+ attributes = attributes.each_with_object({}) { |(k, v), h|
115
+ if (!self.class.attribute_map.key?(k.to_sym))
116
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationPbxAddress`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
117
+ end
118
+ h[k.to_sym] = v
119
+ }
120
+
121
+ if attributes.key?(:'address_sid')
122
+ self.address_sid = attributes[:'address_sid']
123
+ end
124
+
125
+ if attributes.key?(:'city')
126
+ self.city = attributes[:'city']
127
+ end
128
+
129
+ if attributes.key?(:'conversation_pbx_address_uuid')
130
+ self.conversation_pbx_address_uuid = attributes[:'conversation_pbx_address_uuid']
131
+ end
132
+
133
+ if attributes.key?(:'country_code')
134
+ self.country_code = attributes[:'country_code']
135
+ end
136
+
137
+ if attributes.key?(:'customer_name')
138
+ self.customer_name = attributes[:'customer_name']
139
+ end
140
+
141
+ if attributes.key?(:'friendly_name')
142
+ self.friendly_name = attributes[:'friendly_name']
143
+ end
144
+
145
+ if attributes.key?(:'merchant_id')
146
+ self.merchant_id = attributes[:'merchant_id']
147
+ end
148
+
149
+ if attributes.key?(:'postal_code')
150
+ self.postal_code = attributes[:'postal_code']
151
+ end
152
+
153
+ if attributes.key?(:'region')
154
+ self.region = attributes[:'region']
155
+ end
156
+
157
+ if attributes.key?(:'street')
158
+ self.street = attributes[:'street']
159
+ end
160
+
161
+ if attributes.key?(:'valid')
162
+ self.valid = attributes[:'valid']
163
+ end
164
+
165
+ if attributes.key?(:'validated')
166
+ self.validated = attributes[:'validated']
167
+ end
168
+
169
+ if attributes.key?(:'verified')
170
+ self.verified = attributes[:'verified']
171
+ end
172
+ end
173
+
174
+ # Show invalid properties with the reasons. Usually used together with valid?
175
+ # @return Array for valid properties with the reasons
176
+ def list_invalid_properties
177
+ invalid_properties = Array.new
178
+ if !@address_sid.nil? && @address_sid.to_s.length > 50
179
+ invalid_properties.push('invalid value for "address_sid", the character length must be smaller than or equal to 50.')
180
+ end
181
+
182
+ if !@city.nil? && @city.to_s.length > 100
183
+ invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 100.')
184
+ end
185
+
186
+ if !@conversation_pbx_address_uuid.nil? && @conversation_pbx_address_uuid.to_s.length > 50
187
+ invalid_properties.push('invalid value for "conversation_pbx_address_uuid", the character length must be smaller than or equal to 50.')
188
+ end
189
+
190
+ if !@country_code.nil? && @country_code.to_s.length > 2
191
+ invalid_properties.push('invalid value for "country_code", the character length must be smaller than or equal to 2.')
192
+ end
193
+
194
+ if !@customer_name.nil? && @customer_name.to_s.length > 100
195
+ invalid_properties.push('invalid value for "customer_name", the character length must be smaller than or equal to 100.')
196
+ end
197
+
198
+ if !@friendly_name.nil? && @friendly_name.to_s.length > 100
199
+ invalid_properties.push('invalid value for "friendly_name", the character length must be smaller than or equal to 100.')
200
+ end
201
+
202
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
203
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
204
+ end
205
+
206
+ if !@postal_code.nil? && @postal_code.to_s.length > 20
207
+ invalid_properties.push('invalid value for "postal_code", the character length must be smaller than or equal to 20.')
208
+ end
209
+
210
+ if !@region.nil? && @region.to_s.length > 50
211
+ invalid_properties.push('invalid value for "region", the character length must be smaller than or equal to 50.')
212
+ end
213
+
214
+ if !@street.nil? && @street.to_s.length > 200
215
+ invalid_properties.push('invalid value for "street", the character length must be smaller than or equal to 200.')
216
+ end
217
+
218
+ invalid_properties
219
+ end
220
+
221
+ # Check to see if the all the properties in the model are valid
222
+ # @return true if the model is valid
223
+ def valid?
224
+ return false if !@address_sid.nil? && @address_sid.to_s.length > 50
225
+ return false if !@city.nil? && @city.to_s.length > 100
226
+ return false if !@conversation_pbx_address_uuid.nil? && @conversation_pbx_address_uuid.to_s.length > 50
227
+ return false if !@country_code.nil? && @country_code.to_s.length > 2
228
+ return false if !@customer_name.nil? && @customer_name.to_s.length > 100
229
+ return false if !@friendly_name.nil? && @friendly_name.to_s.length > 100
230
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
231
+ return false if !@postal_code.nil? && @postal_code.to_s.length > 20
232
+ return false if !@region.nil? && @region.to_s.length > 50
233
+ return false if !@street.nil? && @street.to_s.length > 200
234
+ true
235
+ end
236
+
237
+ # Custom attribute writer method with validation
238
+ # @param [Object] address_sid Value to be assigned
239
+ def address_sid=(address_sid)
240
+ if !address_sid.nil? && address_sid.to_s.length > 50
241
+ fail ArgumentError, 'invalid value for "address_sid", the character length must be smaller than or equal to 50.'
242
+ end
243
+
244
+ @address_sid = address_sid
245
+ end
246
+
247
+ # Custom attribute writer method with validation
248
+ # @param [Object] city Value to be assigned
249
+ def city=(city)
250
+ if !city.nil? && city.to_s.length > 100
251
+ fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 100.'
252
+ end
253
+
254
+ @city = city
255
+ end
256
+
257
+ # Custom attribute writer method with validation
258
+ # @param [Object] conversation_pbx_address_uuid Value to be assigned
259
+ def conversation_pbx_address_uuid=(conversation_pbx_address_uuid)
260
+ if !conversation_pbx_address_uuid.nil? && conversation_pbx_address_uuid.to_s.length > 50
261
+ fail ArgumentError, 'invalid value for "conversation_pbx_address_uuid", the character length must be smaller than or equal to 50.'
262
+ end
263
+
264
+ @conversation_pbx_address_uuid = conversation_pbx_address_uuid
265
+ end
266
+
267
+ # Custom attribute writer method with validation
268
+ # @param [Object] country_code Value to be assigned
269
+ def country_code=(country_code)
270
+ if !country_code.nil? && country_code.to_s.length > 2
271
+ fail ArgumentError, 'invalid value for "country_code", the character length must be smaller than or equal to 2.'
272
+ end
273
+
274
+ @country_code = country_code
275
+ end
276
+
277
+ # Custom attribute writer method with validation
278
+ # @param [Object] customer_name Value to be assigned
279
+ def customer_name=(customer_name)
280
+ if !customer_name.nil? && customer_name.to_s.length > 100
281
+ fail ArgumentError, 'invalid value for "customer_name", the character length must be smaller than or equal to 100.'
282
+ end
283
+
284
+ @customer_name = customer_name
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] friendly_name Value to be assigned
289
+ def friendly_name=(friendly_name)
290
+ if !friendly_name.nil? && friendly_name.to_s.length > 100
291
+ fail ArgumentError, 'invalid value for "friendly_name", the character length must be smaller than or equal to 100.'
292
+ end
293
+
294
+ @friendly_name = friendly_name
295
+ end
296
+
297
+ # Custom attribute writer method with validation
298
+ # @param [Object] merchant_id Value to be assigned
299
+ def merchant_id=(merchant_id)
300
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
301
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
302
+ end
303
+
304
+ @merchant_id = merchant_id
305
+ end
306
+
307
+ # Custom attribute writer method with validation
308
+ # @param [Object] postal_code Value to be assigned
309
+ def postal_code=(postal_code)
310
+ if !postal_code.nil? && postal_code.to_s.length > 20
311
+ fail ArgumentError, 'invalid value for "postal_code", the character length must be smaller than or equal to 20.'
312
+ end
313
+
314
+ @postal_code = postal_code
315
+ end
316
+
317
+ # Custom attribute writer method with validation
318
+ # @param [Object] region Value to be assigned
319
+ def region=(region)
320
+ if !region.nil? && region.to_s.length > 50
321
+ fail ArgumentError, 'invalid value for "region", the character length must be smaller than or equal to 50.'
322
+ end
323
+
324
+ @region = region
325
+ end
326
+
327
+ # Custom attribute writer method with validation
328
+ # @param [Object] street Value to be assigned
329
+ def street=(street)
330
+ if !street.nil? && street.to_s.length > 200
331
+ fail ArgumentError, 'invalid value for "street", the character length must be smaller than or equal to 200.'
332
+ end
333
+
334
+ @street = street
335
+ end
336
+
337
+ # Checks equality by comparing each attribute.
338
+ # @param [Object] Object to be compared
339
+ def ==(o)
340
+ return true if self.equal?(o)
341
+ self.class == o.class &&
342
+ address_sid == o.address_sid &&
343
+ city == o.city &&
344
+ conversation_pbx_address_uuid == o.conversation_pbx_address_uuid &&
345
+ country_code == o.country_code &&
346
+ customer_name == o.customer_name &&
347
+ friendly_name == o.friendly_name &&
348
+ merchant_id == o.merchant_id &&
349
+ postal_code == o.postal_code &&
350
+ region == o.region &&
351
+ street == o.street &&
352
+ valid == o.valid &&
353
+ validated == o.validated &&
354
+ verified == o.verified
355
+ end
356
+
357
+ # @see the `==` method
358
+ # @param [Object] Object to be compared
359
+ def eql?(o)
360
+ self == o
361
+ end
362
+
363
+ # Calculates hash code according to all attributes.
364
+ # @return [Integer] Hash code
365
+ def hash
366
+ [address_sid, city, conversation_pbx_address_uuid, country_code, customer_name, friendly_name, merchant_id, postal_code, region, street, valid, validated, verified].hash
367
+ end
368
+
369
+ # Builds the object from hash
370
+ # @param [Hash] attributes Model attributes in the form of hash
371
+ # @return [Object] Returns the model itself
372
+ def self.build_from_hash(attributes)
373
+ new.build_from_hash(attributes)
374
+ end
375
+
376
+ # Builds the object from hash
377
+ # @param [Hash] attributes Model attributes in the form of hash
378
+ # @return [Object] Returns the model itself
379
+ def build_from_hash(attributes)
380
+ return nil unless attributes.is_a?(Hash)
381
+ attributes = attributes.transform_keys(&:to_sym)
382
+ self.class.openapi_types.each_pair do |key, type|
383
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
384
+ self.send("#{key}=", nil)
385
+ elsif type =~ /\AArray<(.*)>/i
386
+ # check to ensure the input is an array given that the attribute
387
+ # is documented as an array but the input is not
388
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
389
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
390
+ end
391
+ elsif !attributes[self.class.attribute_map[key]].nil?
392
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
393
+ end
394
+ end
395
+
396
+ self
397
+ end
398
+
399
+ # Deserializes the data based on type
400
+ # @param string type Data type
401
+ # @param string value Value to be deserialized
402
+ # @return [Object] Deserialized data
403
+ def _deserialize(type, value)
404
+ case type.to_sym
405
+ when :Time
406
+ Time.parse(value)
407
+ when :Date
408
+ Date.parse(value)
409
+ when :String
410
+ value.to_s
411
+ when :Integer
412
+ value.to_i
413
+ when :Float
414
+ value.to_f
415
+ when :Boolean
416
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
417
+ true
418
+ else
419
+ false
420
+ end
421
+ when :Object
422
+ # generic object (usually a Hash), return directly
423
+ value
424
+ when /\AArray<(?<inner_type>.+)>\z/
425
+ inner_type = Regexp.last_match[:inner_type]
426
+ value.map { |v| _deserialize(inner_type, v) }
427
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
428
+ k_type = Regexp.last_match[:k_type]
429
+ v_type = Regexp.last_match[:v_type]
430
+ {}.tap do |hash|
431
+ value.each do |k, v|
432
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
433
+ end
434
+ end
435
+ else # model
436
+ # models (e.g. Pet) or oneOf
437
+ klass = UltracartClient.const_get(type)
438
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
439
+ end
440
+ end
441
+
442
+ # Returns the string representation of the object
443
+ # @return [String] String presentation of the object
444
+ def to_s
445
+ to_hash.to_s
446
+ end
447
+
448
+ # to_body is an alias to to_hash (backward compatibility)
449
+ # @return [Hash] Returns the object in the form of hash
450
+ def to_body
451
+ to_hash
452
+ end
453
+
454
+ # Returns the object in the form of hash
455
+ # @return [Hash] Returns the object in the form of hash
456
+ def to_hash
457
+ hash = {}
458
+ self.class.attribute_map.each_pair do |attr, param|
459
+ value = self.send(attr)
460
+ if value.nil?
461
+ is_nullable = self.class.openapi_nullable.include?(attr)
462
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
463
+ end
464
+
465
+ hash[param] = _to_hash(value)
466
+ end
467
+ hash
468
+ end
469
+
470
+ # Outputs non-array value in the form of hash
471
+ # For object, use to_hash. Otherwise, just return the value
472
+ # @param [Object] value Any valid value
473
+ # @return [Hash] Returns the value in the form of hash
474
+ def _to_hash(value)
475
+ if value.is_a?(Array)
476
+ value.compact.map { |v| _to_hash(v) }
477
+ elsif value.is_a?(Hash)
478
+ {}.tap do |hash|
479
+ value.each { |k, v| hash[k] = _to_hash(v) }
480
+ end
481
+ elsif value.respond_to? :to_hash
482
+ value.to_hash
483
+ else
484
+ value
485
+ end
486
+ end
487
+
488
+ end
489
+
490
+ end