ultracart_api 4.1.86 → 4.1.87

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,402 @@
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 AutoOrderEmail
18
+ attr_accessor :bounce_diagnostic_code
19
+
20
+ # Date/time that the email was bounced
21
+ attr_accessor :bounce_dts
22
+
23
+ attr_accessor :bounce_sub_type
24
+
25
+ attr_accessor :bounce_type
26
+
27
+ attr_accessor :clicked
28
+
29
+ # Date/time that the email was clicked
30
+ attr_accessor :clicked_dts
31
+
32
+ attr_accessor :delivered
33
+
34
+ # Date/time that the email was delivered
35
+ attr_accessor :delivery_dts
36
+
37
+ # Email
38
+ attr_accessor :email
39
+
40
+ attr_accessor :internal
41
+
42
+ attr_accessor :message_id
43
+
44
+ attr_accessor :opened
45
+
46
+ # Date/time that the email was opened
47
+ attr_accessor :opened_dts
48
+
49
+ attr_accessor :reporting_mta
50
+
51
+ # Date/time that the email was sent
52
+ attr_accessor :send_dts
53
+
54
+ attr_accessor :skip_reason
55
+
56
+ attr_accessor :skipped
57
+
58
+ attr_accessor :smtp_response
59
+
60
+ attr_accessor :subject
61
+
62
+ # Attribute mapping from ruby-style variable name to JSON key.
63
+ def self.attribute_map
64
+ {
65
+ :'bounce_diagnostic_code' => :'bounce_diagnostic_code',
66
+ :'bounce_dts' => :'bounce_dts',
67
+ :'bounce_sub_type' => :'bounce_sub_type',
68
+ :'bounce_type' => :'bounce_type',
69
+ :'clicked' => :'clicked',
70
+ :'clicked_dts' => :'clicked_dts',
71
+ :'delivered' => :'delivered',
72
+ :'delivery_dts' => :'delivery_dts',
73
+ :'email' => :'email',
74
+ :'internal' => :'internal',
75
+ :'message_id' => :'message_id',
76
+ :'opened' => :'opened',
77
+ :'opened_dts' => :'opened_dts',
78
+ :'reporting_mta' => :'reporting_mta',
79
+ :'send_dts' => :'send_dts',
80
+ :'skip_reason' => :'skip_reason',
81
+ :'skipped' => :'skipped',
82
+ :'smtp_response' => :'smtp_response',
83
+ :'subject' => :'subject'
84
+ }
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'bounce_diagnostic_code' => :'String',
96
+ :'bounce_dts' => :'String',
97
+ :'bounce_sub_type' => :'String',
98
+ :'bounce_type' => :'String',
99
+ :'clicked' => :'Boolean',
100
+ :'clicked_dts' => :'String',
101
+ :'delivered' => :'Boolean',
102
+ :'delivery_dts' => :'String',
103
+ :'email' => :'String',
104
+ :'internal' => :'Boolean',
105
+ :'message_id' => :'String',
106
+ :'opened' => :'Boolean',
107
+ :'opened_dts' => :'String',
108
+ :'reporting_mta' => :'String',
109
+ :'send_dts' => :'String',
110
+ :'skip_reason' => :'String',
111
+ :'skipped' => :'Boolean',
112
+ :'smtp_response' => :'String',
113
+ :'subject' => :'String'
114
+ }
115
+ end
116
+
117
+ # List of attributes with nullable: true
118
+ def self.openapi_nullable
119
+ Set.new([
120
+ ])
121
+ end
122
+
123
+ # Initializes the object
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ def initialize(attributes = {})
126
+ if (!attributes.is_a?(Hash))
127
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AutoOrderEmail` initialize method"
128
+ end
129
+
130
+ # check to see if the attribute exists and convert string to symbol for hash key
131
+ attributes = attributes.each_with_object({}) { |(k, v), h|
132
+ if (!self.class.attribute_map.key?(k.to_sym))
133
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AutoOrderEmail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
134
+ end
135
+ h[k.to_sym] = v
136
+ }
137
+
138
+ if attributes.key?(:'bounce_diagnostic_code')
139
+ self.bounce_diagnostic_code = attributes[:'bounce_diagnostic_code']
140
+ end
141
+
142
+ if attributes.key?(:'bounce_dts')
143
+ self.bounce_dts = attributes[:'bounce_dts']
144
+ end
145
+
146
+ if attributes.key?(:'bounce_sub_type')
147
+ self.bounce_sub_type = attributes[:'bounce_sub_type']
148
+ end
149
+
150
+ if attributes.key?(:'bounce_type')
151
+ self.bounce_type = attributes[:'bounce_type']
152
+ end
153
+
154
+ if attributes.key?(:'clicked')
155
+ self.clicked = attributes[:'clicked']
156
+ end
157
+
158
+ if attributes.key?(:'clicked_dts')
159
+ self.clicked_dts = attributes[:'clicked_dts']
160
+ end
161
+
162
+ if attributes.key?(:'delivered')
163
+ self.delivered = attributes[:'delivered']
164
+ end
165
+
166
+ if attributes.key?(:'delivery_dts')
167
+ self.delivery_dts = attributes[:'delivery_dts']
168
+ end
169
+
170
+ if attributes.key?(:'email')
171
+ self.email = attributes[:'email']
172
+ end
173
+
174
+ if attributes.key?(:'internal')
175
+ self.internal = attributes[:'internal']
176
+ end
177
+
178
+ if attributes.key?(:'message_id')
179
+ self.message_id = attributes[:'message_id']
180
+ end
181
+
182
+ if attributes.key?(:'opened')
183
+ self.opened = attributes[:'opened']
184
+ end
185
+
186
+ if attributes.key?(:'opened_dts')
187
+ self.opened_dts = attributes[:'opened_dts']
188
+ end
189
+
190
+ if attributes.key?(:'reporting_mta')
191
+ self.reporting_mta = attributes[:'reporting_mta']
192
+ end
193
+
194
+ if attributes.key?(:'send_dts')
195
+ self.send_dts = attributes[:'send_dts']
196
+ end
197
+
198
+ if attributes.key?(:'skip_reason')
199
+ self.skip_reason = attributes[:'skip_reason']
200
+ end
201
+
202
+ if attributes.key?(:'skipped')
203
+ self.skipped = attributes[:'skipped']
204
+ end
205
+
206
+ if attributes.key?(:'smtp_response')
207
+ self.smtp_response = attributes[:'smtp_response']
208
+ end
209
+
210
+ if attributes.key?(:'subject')
211
+ self.subject = attributes[:'subject']
212
+ end
213
+ end
214
+
215
+ # Show invalid properties with the reasons. Usually used together with valid?
216
+ # @return Array for valid properties with the reasons
217
+ def list_invalid_properties
218
+ invalid_properties = Array.new
219
+ if !@email.nil? && @email.to_s.length > 100
220
+ invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 100.')
221
+ end
222
+
223
+ invalid_properties
224
+ end
225
+
226
+ # Check to see if the all the properties in the model are valid
227
+ # @return true if the model is valid
228
+ def valid?
229
+ return false if !@email.nil? && @email.to_s.length > 100
230
+ true
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] email Value to be assigned
235
+ def email=(email)
236
+ if !email.nil? && email.to_s.length > 100
237
+ fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 100.'
238
+ end
239
+
240
+ @email = email
241
+ end
242
+
243
+ # Checks equality by comparing each attribute.
244
+ # @param [Object] Object to be compared
245
+ def ==(o)
246
+ return true if self.equal?(o)
247
+ self.class == o.class &&
248
+ bounce_diagnostic_code == o.bounce_diagnostic_code &&
249
+ bounce_dts == o.bounce_dts &&
250
+ bounce_sub_type == o.bounce_sub_type &&
251
+ bounce_type == o.bounce_type &&
252
+ clicked == o.clicked &&
253
+ clicked_dts == o.clicked_dts &&
254
+ delivered == o.delivered &&
255
+ delivery_dts == o.delivery_dts &&
256
+ email == o.email &&
257
+ internal == o.internal &&
258
+ message_id == o.message_id &&
259
+ opened == o.opened &&
260
+ opened_dts == o.opened_dts &&
261
+ reporting_mta == o.reporting_mta &&
262
+ send_dts == o.send_dts &&
263
+ skip_reason == o.skip_reason &&
264
+ skipped == o.skipped &&
265
+ smtp_response == o.smtp_response &&
266
+ subject == o.subject
267
+ end
268
+
269
+ # @see the `==` method
270
+ # @param [Object] Object to be compared
271
+ def eql?(o)
272
+ self == o
273
+ end
274
+
275
+ # Calculates hash code according to all attributes.
276
+ # @return [Integer] Hash code
277
+ def hash
278
+ [bounce_diagnostic_code, bounce_dts, bounce_sub_type, bounce_type, clicked, clicked_dts, delivered, delivery_dts, email, internal, message_id, opened, opened_dts, reporting_mta, send_dts, skip_reason, skipped, smtp_response, subject].hash
279
+ end
280
+
281
+ # Builds the object from hash
282
+ # @param [Hash] attributes Model attributes in the form of hash
283
+ # @return [Object] Returns the model itself
284
+ def self.build_from_hash(attributes)
285
+ new.build_from_hash(attributes)
286
+ end
287
+
288
+ # Builds the object from hash
289
+ # @param [Hash] attributes Model attributes in the form of hash
290
+ # @return [Object] Returns the model itself
291
+ def build_from_hash(attributes)
292
+ return nil unless attributes.is_a?(Hash)
293
+ attributes = attributes.transform_keys(&:to_sym)
294
+ self.class.openapi_types.each_pair do |key, type|
295
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
296
+ self.send("#{key}=", nil)
297
+ elsif type =~ /\AArray<(.*)>/i
298
+ # check to ensure the input is an array given that the attribute
299
+ # is documented as an array but the input is not
300
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
301
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
302
+ end
303
+ elsif !attributes[self.class.attribute_map[key]].nil?
304
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
305
+ end
306
+ end
307
+
308
+ self
309
+ end
310
+
311
+ # Deserializes the data based on type
312
+ # @param string type Data type
313
+ # @param string value Value to be deserialized
314
+ # @return [Object] Deserialized data
315
+ def _deserialize(type, value)
316
+ case type.to_sym
317
+ when :Time
318
+ Time.parse(value)
319
+ when :Date
320
+ Date.parse(value)
321
+ when :String
322
+ value.to_s
323
+ when :Integer
324
+ value.to_i
325
+ when :Float
326
+ value.to_f
327
+ when :Boolean
328
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
329
+ true
330
+ else
331
+ false
332
+ end
333
+ when :Object
334
+ # generic object (usually a Hash), return directly
335
+ value
336
+ when /\AArray<(?<inner_type>.+)>\z/
337
+ inner_type = Regexp.last_match[:inner_type]
338
+ value.map { |v| _deserialize(inner_type, v) }
339
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
340
+ k_type = Regexp.last_match[:k_type]
341
+ v_type = Regexp.last_match[:v_type]
342
+ {}.tap do |hash|
343
+ value.each do |k, v|
344
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
345
+ end
346
+ end
347
+ else # model
348
+ # models (e.g. Pet) or oneOf
349
+ klass = UltracartClient.const_get(type)
350
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
351
+ end
352
+ end
353
+
354
+ # Returns the string representation of the object
355
+ # @return [String] String presentation of the object
356
+ def to_s
357
+ to_hash.to_s
358
+ end
359
+
360
+ # to_body is an alias to to_hash (backward compatibility)
361
+ # @return [Hash] Returns the object in the form of hash
362
+ def to_body
363
+ to_hash
364
+ end
365
+
366
+ # Returns the object in the form of hash
367
+ # @return [Hash] Returns the object in the form of hash
368
+ def to_hash
369
+ hash = {}
370
+ self.class.attribute_map.each_pair do |attr, param|
371
+ value = self.send(attr)
372
+ if value.nil?
373
+ is_nullable = self.class.openapi_nullable.include?(attr)
374
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
375
+ end
376
+
377
+ hash[param] = _to_hash(value)
378
+ end
379
+ hash
380
+ end
381
+
382
+ # Outputs non-array value in the form of hash
383
+ # For object, use to_hash. Otherwise, just return the value
384
+ # @param [Object] value Any valid value
385
+ # @return [Hash] Returns the value in the form of hash
386
+ def _to_hash(value)
387
+ if value.is_a?(Array)
388
+ value.compact.map { |v| _to_hash(v) }
389
+ elsif value.is_a?(Hash)
390
+ {}.tap do |hash|
391
+ value.each { |k, v| hash[k] = _to_hash(v) }
392
+ end
393
+ elsif value.respond_to? :to_hash
394
+ value.to_hash
395
+ else
396
+ value
397
+ end
398
+ end
399
+
400
+ end
401
+
402
+ end
@@ -0,0 +1,259 @@
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 AutoOrderEmailsResponse
18
+ # emails
19
+ attr_accessor :emails
20
+
21
+ attr_accessor :error
22
+
23
+ attr_accessor :metadata
24
+
25
+ # Indicates if API call was successful
26
+ attr_accessor :success
27
+
28
+ attr_accessor :warning
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'emails' => :'emails',
34
+ :'error' => :'error',
35
+ :'metadata' => :'metadata',
36
+ :'success' => :'success',
37
+ :'warning' => :'warning'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'emails' => :'Array<AutoOrderEmail>',
50
+ :'error' => :'Error',
51
+ :'metadata' => :'ResponseMetadata',
52
+ :'success' => :'Boolean',
53
+ :'warning' => :'Warning'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AutoOrderEmailsResponse` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AutoOrderEmailsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'emails')
79
+ if (value = attributes[:'emails']).is_a?(Array)
80
+ self.emails = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'error')
85
+ self.error = attributes[:'error']
86
+ end
87
+
88
+ if attributes.key?(:'metadata')
89
+ self.metadata = attributes[:'metadata']
90
+ end
91
+
92
+ if attributes.key?(:'success')
93
+ self.success = attributes[:'success']
94
+ end
95
+
96
+ if attributes.key?(:'warning')
97
+ self.warning = attributes[:'warning']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ emails == o.emails &&
120
+ error == o.error &&
121
+ metadata == o.metadata &&
122
+ success == o.success &&
123
+ warning == o.warning
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [emails, error, metadata, success, warning].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = UltracartClient.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
223
+ # Returns the object in the form of hash
224
+ # @return [Hash] Returns the object in the form of hash
225
+ def to_hash
226
+ hash = {}
227
+ self.class.attribute_map.each_pair do |attr, param|
228
+ value = self.send(attr)
229
+ if value.nil?
230
+ is_nullable = self.class.openapi_nullable.include?(attr)
231
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
232
+ end
233
+
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end