ultracart_api 3.11.39 → 3.11.41

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