ultracart_api 3.11.56 → 3.11.57

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,224 @@
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 ConversationPbxClassOfServicesResponse
17
+ # Array of class of service records
18
+ attr_accessor :classes_of_services
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :metadata
23
+
24
+ # Indicates if API call was successful
25
+ attr_accessor :success
26
+
27
+ attr_accessor :warning
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'classes_of_services' => :'classes_of_services',
33
+ :'error' => :'error',
34
+ :'metadata' => :'metadata',
35
+ :'success' => :'success',
36
+ :'warning' => :'warning'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'classes_of_services' => :'Array<ConversationPbxClassOfService>',
44
+ :'error' => :'Error',
45
+ :'metadata' => :'ResponseMetadata',
46
+ :'success' => :'BOOLEAN',
47
+ :'warning' => :'Warning'
48
+ }
49
+ end
50
+
51
+ # Initializes the object
52
+ # @param [Hash] attributes Model attributes in the form of hash
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ if attributes.has_key?(:'classes_of_services')
60
+ if (value = attributes[:'classes_of_services']).is_a?(Array)
61
+ self.classes_of_services = value
62
+ end
63
+ end
64
+
65
+ if attributes.has_key?(:'error')
66
+ self.error = attributes[:'error']
67
+ end
68
+
69
+ if attributes.has_key?(:'metadata')
70
+ self.metadata = attributes[:'metadata']
71
+ end
72
+
73
+ if attributes.has_key?(:'success')
74
+ self.success = attributes[:'success']
75
+ end
76
+
77
+ if attributes.has_key?(:'warning')
78
+ self.warning = attributes[:'warning']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ classes_of_services == o.classes_of_services &&
101
+ error == o.error &&
102
+ metadata == o.metadata &&
103
+ success == o.success &&
104
+ warning == o.warning
105
+ end
106
+
107
+ # @see the `==` method
108
+ # @param [Object] Object to be compared
109
+ def eql?(o)
110
+ self == o
111
+ end
112
+
113
+ # Calculates hash code according to all attributes.
114
+ # @return [Fixnum] Hash code
115
+ def hash
116
+ [classes_of_services, error, metadata, success, warning].hash
117
+ end
118
+
119
+ # Builds the object from hash
120
+ # @param [Hash] attributes Model attributes in the form of hash
121
+ # @return [Object] Returns the model itself
122
+ def build_from_hash(attributes)
123
+ return nil unless attributes.is_a?(Hash)
124
+ self.class.swagger_types.each_pair do |key, type|
125
+ if type =~ /\AArray<(.*)>/i
126
+ # check to ensure the input is an array given that the attribute
127
+ # is documented as an array but the input is not
128
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
129
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
130
+ end
131
+ elsif !attributes[self.class.attribute_map[key]].nil?
132
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
133
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
134
+ end
135
+
136
+ self
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def _deserialize(type, value)
144
+ case type.to_sym
145
+ when :DateTime
146
+ DateTime.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :BOOLEAN
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ temp_model = UltracartClient.const_get(type).new
177
+ temp_model.build_from_hash(value)
178
+ end
179
+ end
180
+
181
+ # Returns the string representation of the object
182
+ # @return [String] String presentation of the object
183
+ def to_s
184
+ to_hash.to_s
185
+ end
186
+
187
+ # to_body is an alias to to_hash (backward compatibility)
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_body
190
+ to_hash
191
+ end
192
+
193
+ # Returns the object in the form of hash
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_hash
196
+ hash = {}
197
+ self.class.attribute_map.each_pair do |attr, param|
198
+ value = self.send(attr)
199
+ next if value.nil?
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+ end
@@ -0,0 +1,336 @@
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 ConversationPbxCosAuditLog
17
+ # Action taken
18
+ attr_accessor :action
19
+
20
+ # Login of the agent who attempted the call
21
+ attr_accessor :agent_login
22
+
23
+ # Audit log entry unique identifier
24
+ attr_accessor :audit_log_uuid
25
+
26
+ # Name of the class of service (denormalized for display)
27
+ attr_accessor :class_of_service_name
28
+
29
+ # UUID of the class of service that was evaluated
30
+ attr_accessor :class_of_service_uuid
31
+
32
+ # Phone number the agent tried to dial
33
+ attr_accessor :destination
34
+
35
+ # Merchant Id
36
+ attr_accessor :merchant_id
37
+
38
+ # Rule that triggered the action
39
+ attr_accessor :rule_triggered
40
+
41
+ # Login of supervisor who approved/denied (null for timeouts and direct blocks)
42
+ attr_accessor :supervisor_login
43
+
44
+ # ISO 8601 timestamp of the event
45
+ attr_accessor :timestamp
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'action' => :'action',
73
+ :'agent_login' => :'agent_login',
74
+ :'audit_log_uuid' => :'audit_log_uuid',
75
+ :'class_of_service_name' => :'class_of_service_name',
76
+ :'class_of_service_uuid' => :'class_of_service_uuid',
77
+ :'destination' => :'destination',
78
+ :'merchant_id' => :'merchant_id',
79
+ :'rule_triggered' => :'rule_triggered',
80
+ :'supervisor_login' => :'supervisor_login',
81
+ :'timestamp' => :'timestamp'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'action' => :'String',
89
+ :'agent_login' => :'String',
90
+ :'audit_log_uuid' => :'String',
91
+ :'class_of_service_name' => :'String',
92
+ :'class_of_service_uuid' => :'String',
93
+ :'destination' => :'String',
94
+ :'merchant_id' => :'String',
95
+ :'rule_triggered' => :'String',
96
+ :'supervisor_login' => :'String',
97
+ :'timestamp' => :'String'
98
+ }
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ return unless attributes.is_a?(Hash)
105
+
106
+ # convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
108
+
109
+ if attributes.has_key?(:'action')
110
+ self.action = attributes[:'action']
111
+ end
112
+
113
+ if attributes.has_key?(:'agent_login')
114
+ self.agent_login = attributes[:'agent_login']
115
+ end
116
+
117
+ if attributes.has_key?(:'audit_log_uuid')
118
+ self.audit_log_uuid = attributes[:'audit_log_uuid']
119
+ end
120
+
121
+ if attributes.has_key?(:'class_of_service_name')
122
+ self.class_of_service_name = attributes[:'class_of_service_name']
123
+ end
124
+
125
+ if attributes.has_key?(:'class_of_service_uuid')
126
+ self.class_of_service_uuid = attributes[:'class_of_service_uuid']
127
+ end
128
+
129
+ if attributes.has_key?(:'destination')
130
+ self.destination = attributes[:'destination']
131
+ end
132
+
133
+ if attributes.has_key?(:'merchant_id')
134
+ self.merchant_id = attributes[:'merchant_id']
135
+ end
136
+
137
+ if attributes.has_key?(:'rule_triggered')
138
+ self.rule_triggered = attributes[:'rule_triggered']
139
+ end
140
+
141
+ if attributes.has_key?(:'supervisor_login')
142
+ self.supervisor_login = attributes[:'supervisor_login']
143
+ end
144
+
145
+ if attributes.has_key?(:'timestamp')
146
+ self.timestamp = attributes[:'timestamp']
147
+ end
148
+ end
149
+
150
+ # Show invalid properties with the reasons. Usually used together with valid?
151
+ # @return Array for valid properties with the reasons
152
+ def list_invalid_properties
153
+ invalid_properties = Array.new
154
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
155
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
156
+ end
157
+
158
+ invalid_properties
159
+ end
160
+
161
+ # Check to see if the all the properties in the model are valid
162
+ # @return true if the model is valid
163
+ def valid?
164
+ action_validator = EnumAttributeValidator.new('String', ['blocked', 'override_requested', 'override_approved', 'override_denied', 'override_timeout'])
165
+ return false unless action_validator.valid?(@action)
166
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
167
+ rule_triggered_validator = EnumAttributeValidator.new('String', ['outbound_disabled', 'time_range', 'country_blocked', 'premium_blocked'])
168
+ return false unless rule_triggered_validator.valid?(@rule_triggered)
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method checking allowed values (enum).
173
+ # @param [Object] action Object to be assigned
174
+ def action=(action)
175
+ validator = EnumAttributeValidator.new('String', ['blocked', 'override_requested', 'override_approved', 'override_denied', 'override_timeout'])
176
+ unless validator.valid?(action)
177
+ fail ArgumentError, 'invalid value for "action", must be one of #{validator.allowable_values}.'
178
+ end
179
+ @action = action
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] merchant_id Value to be assigned
184
+ def merchant_id=(merchant_id)
185
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
186
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
187
+ end
188
+
189
+ @merchant_id = merchant_id
190
+ end
191
+
192
+ # Custom attribute writer method checking allowed values (enum).
193
+ # @param [Object] rule_triggered Object to be assigned
194
+ def rule_triggered=(rule_triggered)
195
+ validator = EnumAttributeValidator.new('String', ['outbound_disabled', 'time_range', 'country_blocked', 'premium_blocked'])
196
+ unless validator.valid?(rule_triggered)
197
+ fail ArgumentError, 'invalid value for "rule_triggered", must be one of #{validator.allowable_values}.'
198
+ end
199
+ @rule_triggered = rule_triggered
200
+ end
201
+
202
+ # Checks equality by comparing each attribute.
203
+ # @param [Object] Object to be compared
204
+ def ==(o)
205
+ return true if self.equal?(o)
206
+ self.class == o.class &&
207
+ action == o.action &&
208
+ agent_login == o.agent_login &&
209
+ audit_log_uuid == o.audit_log_uuid &&
210
+ class_of_service_name == o.class_of_service_name &&
211
+ class_of_service_uuid == o.class_of_service_uuid &&
212
+ destination == o.destination &&
213
+ merchant_id == o.merchant_id &&
214
+ rule_triggered == o.rule_triggered &&
215
+ supervisor_login == o.supervisor_login &&
216
+ timestamp == o.timestamp
217
+ end
218
+
219
+ # @see the `==` method
220
+ # @param [Object] Object to be compared
221
+ def eql?(o)
222
+ self == o
223
+ end
224
+
225
+ # Calculates hash code according to all attributes.
226
+ # @return [Fixnum] Hash code
227
+ def hash
228
+ [action, agent_login, audit_log_uuid, class_of_service_name, class_of_service_uuid, destination, merchant_id, rule_triggered, supervisor_login, timestamp].hash
229
+ end
230
+
231
+ # Builds the object from hash
232
+ # @param [Hash] attributes Model attributes in the form of hash
233
+ # @return [Object] Returns the model itself
234
+ def build_from_hash(attributes)
235
+ return nil unless attributes.is_a?(Hash)
236
+ self.class.swagger_types.each_pair do |key, type|
237
+ if type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
241
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
242
+ end
243
+ elsif !attributes[self.class.attribute_map[key]].nil?
244
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
245
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
246
+ end
247
+
248
+ self
249
+ end
250
+
251
+ # Deserializes the data based on type
252
+ # @param string type Data type
253
+ # @param string value Value to be deserialized
254
+ # @return [Object] Deserialized data
255
+ def _deserialize(type, value)
256
+ case type.to_sym
257
+ when :DateTime
258
+ DateTime.parse(value)
259
+ when :Date
260
+ Date.parse(value)
261
+ when :String
262
+ value.to_s
263
+ when :Integer
264
+ value.to_i
265
+ when :Float
266
+ value.to_f
267
+ when :BOOLEAN
268
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
269
+ true
270
+ else
271
+ false
272
+ end
273
+ when :Object
274
+ # generic object (usually a Hash), return directly
275
+ value
276
+ when /\AArray<(?<inner_type>.+)>\z/
277
+ inner_type = Regexp.last_match[:inner_type]
278
+ value.map { |v| _deserialize(inner_type, v) }
279
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
280
+ k_type = Regexp.last_match[:k_type]
281
+ v_type = Regexp.last_match[:v_type]
282
+ {}.tap do |hash|
283
+ value.each do |k, v|
284
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
285
+ end
286
+ end
287
+ else # model
288
+ temp_model = UltracartClient.const_get(type).new
289
+ temp_model.build_from_hash(value)
290
+ end
291
+ end
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # to_body is an alias to to_hash (backward compatibility)
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_body
302
+ to_hash
303
+ end
304
+
305
+ # Returns the object in the form of hash
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_hash
308
+ hash = {}
309
+ self.class.attribute_map.each_pair do |attr, param|
310
+ value = self.send(attr)
311
+ next if value.nil?
312
+ hash[param] = _to_hash(value)
313
+ end
314
+ hash
315
+ end
316
+
317
+ # Outputs non-array value in the form of hash
318
+ # For object, use to_hash. Otherwise, just return the value
319
+ # @param [Object] value Any valid value
320
+ # @return [Hash] Returns the value in the form of hash
321
+ def _to_hash(value)
322
+ if value.is_a?(Array)
323
+ value.compact.map { |v| _to_hash(v) }
324
+ elsif value.is_a?(Hash)
325
+ {}.tap do |hash|
326
+ value.each { |k, v| hash[k] = _to_hash(v) }
327
+ end
328
+ elsif value.respond_to? :to_hash
329
+ value.to_hash
330
+ else
331
+ value
332
+ end
333
+ end
334
+
335
+ end
336
+ end