ultracart_api 4.1.206 → 4.1.207

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,270 @@
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 SfvbCommsPostcard
18
+ # The back side container uuid (owner type postcardback).
19
+ attr_accessor :back_container_uuid
20
+
21
+ # When either side was last changed (ISO 8601, UTC).
22
+ attr_accessor :container_last_modified_dts
23
+
24
+ # True when the postcard was deleted.
25
+ attr_accessor :deleted
26
+
27
+ # The front side container uuid (owner type postcardfront).
28
+ attr_accessor :front_container_uuid
29
+
30
+ # The postcard uuid.
31
+ attr_accessor :postcard_uuid
32
+
33
+ # The step that sends this postcard.
34
+ attr_accessor :step_uuid
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'back_container_uuid' => :'back_container_uuid',
40
+ :'container_last_modified_dts' => :'container_last_modified_dts',
41
+ :'deleted' => :'deleted',
42
+ :'front_container_uuid' => :'front_container_uuid',
43
+ :'postcard_uuid' => :'postcard_uuid',
44
+ :'step_uuid' => :'step_uuid'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'back_container_uuid' => :'String',
57
+ :'container_last_modified_dts' => :'String',
58
+ :'deleted' => :'Boolean',
59
+ :'front_container_uuid' => :'String',
60
+ :'postcard_uuid' => :'String',
61
+ :'step_uuid' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCommsPostcard` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCommsPostcard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'back_container_uuid')
87
+ self.back_container_uuid = attributes[:'back_container_uuid']
88
+ end
89
+
90
+ if attributes.key?(:'container_last_modified_dts')
91
+ self.container_last_modified_dts = attributes[:'container_last_modified_dts']
92
+ end
93
+
94
+ if attributes.key?(:'deleted')
95
+ self.deleted = attributes[:'deleted']
96
+ end
97
+
98
+ if attributes.key?(:'front_container_uuid')
99
+ self.front_container_uuid = attributes[:'front_container_uuid']
100
+ end
101
+
102
+ if attributes.key?(:'postcard_uuid')
103
+ self.postcard_uuid = attributes[:'postcard_uuid']
104
+ end
105
+
106
+ if attributes.key?(:'step_uuid')
107
+ self.step_uuid = attributes[:'step_uuid']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ back_container_uuid == o.back_container_uuid &&
130
+ container_last_modified_dts == o.container_last_modified_dts &&
131
+ deleted == o.deleted &&
132
+ front_container_uuid == o.front_container_uuid &&
133
+ postcard_uuid == o.postcard_uuid &&
134
+ step_uuid == o.step_uuid
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [back_container_uuid, container_last_modified_dts, deleted, front_container_uuid, postcard_uuid, step_uuid].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = UltracartClient.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end
@@ -0,0 +1,334 @@
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 SfvbFlow
18
+ # The communication sequence the steps belong to.
19
+ attr_accessor :communication_sequence_uuid
20
+
21
+ # When the flow was created (ISO 8601, UTC).
22
+ attr_accessor :created_dts
23
+
24
+ # True when the flow was deleted.
25
+ attr_accessor :deleted
26
+
27
+ # Its emails, in step order.
28
+ attr_accessor :emails
29
+
30
+ # The flow uuid.
31
+ attr_accessor :flow_uuid
32
+
33
+ # True when the emails and postcards reach customers now, so a change to one shows at once. False only in a status that sends nothing.
34
+ attr_accessor :live
35
+
36
+ # The flow name.
37
+ attr_accessor :name
38
+
39
+ # Its postcards, in step order.
40
+ attr_accessor :postcards
41
+
42
+ # The status, such as draft, active, paused, draining or inactive.
43
+ attr_accessor :status
44
+
45
+ # When the status last changed (ISO 8601, UTC).
46
+ attr_accessor :status_dts
47
+
48
+ # The name of the trigger parameter, when the trigger takes one.
49
+ attr_accessor :trigger_parameter_name
50
+
51
+ # What starts the flow, such as cart abandon or an order.
52
+ attr_accessor :trigger_type
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'communication_sequence_uuid' => :'communication_sequence_uuid',
58
+ :'created_dts' => :'created_dts',
59
+ :'deleted' => :'deleted',
60
+ :'emails' => :'emails',
61
+ :'flow_uuid' => :'flow_uuid',
62
+ :'live' => :'live',
63
+ :'name' => :'name',
64
+ :'postcards' => :'postcards',
65
+ :'status' => :'status',
66
+ :'status_dts' => :'status_dts',
67
+ :'trigger_parameter_name' => :'trigger_parameter_name',
68
+ :'trigger_type' => :'trigger_type'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'communication_sequence_uuid' => :'String',
81
+ :'created_dts' => :'String',
82
+ :'deleted' => :'Boolean',
83
+ :'emails' => :'Array<SfvbCommsEmail>',
84
+ :'flow_uuid' => :'String',
85
+ :'live' => :'Boolean',
86
+ :'name' => :'String',
87
+ :'postcards' => :'Array<SfvbCommsPostcard>',
88
+ :'status' => :'String',
89
+ :'status_dts' => :'String',
90
+ :'trigger_parameter_name' => :'String',
91
+ :'trigger_type' => :'String'
92
+ }
93
+ end
94
+
95
+ # List of attributes with nullable: true
96
+ def self.openapi_nullable
97
+ Set.new([
98
+ ])
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ if (!attributes.is_a?(Hash))
105
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbFlow` initialize method"
106
+ end
107
+
108
+ # check to see if the attribute exists and convert string to symbol for hash key
109
+ attributes = attributes.each_with_object({}) { |(k, v), h|
110
+ if (!self.class.attribute_map.key?(k.to_sym))
111
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbFlow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
112
+ end
113
+ h[k.to_sym] = v
114
+ }
115
+
116
+ if attributes.key?(:'communication_sequence_uuid')
117
+ self.communication_sequence_uuid = attributes[:'communication_sequence_uuid']
118
+ end
119
+
120
+ if attributes.key?(:'created_dts')
121
+ self.created_dts = attributes[:'created_dts']
122
+ end
123
+
124
+ if attributes.key?(:'deleted')
125
+ self.deleted = attributes[:'deleted']
126
+ end
127
+
128
+ if attributes.key?(:'emails')
129
+ if (value = attributes[:'emails']).is_a?(Array)
130
+ self.emails = value
131
+ end
132
+ end
133
+
134
+ if attributes.key?(:'flow_uuid')
135
+ self.flow_uuid = attributes[:'flow_uuid']
136
+ end
137
+
138
+ if attributes.key?(:'live')
139
+ self.live = attributes[:'live']
140
+ end
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+ if attributes.key?(:'postcards')
147
+ if (value = attributes[:'postcards']).is_a?(Array)
148
+ self.postcards = value
149
+ end
150
+ end
151
+
152
+ if attributes.key?(:'status')
153
+ self.status = attributes[:'status']
154
+ end
155
+
156
+ if attributes.key?(:'status_dts')
157
+ self.status_dts = attributes[:'status_dts']
158
+ end
159
+
160
+ if attributes.key?(:'trigger_parameter_name')
161
+ self.trigger_parameter_name = attributes[:'trigger_parameter_name']
162
+ end
163
+
164
+ if attributes.key?(:'trigger_type')
165
+ self.trigger_type = attributes[:'trigger_type']
166
+ end
167
+ end
168
+
169
+ # Show invalid properties with the reasons. Usually used together with valid?
170
+ # @return Array for valid properties with the reasons
171
+ def list_invalid_properties
172
+ invalid_properties = Array.new
173
+ invalid_properties
174
+ end
175
+
176
+ # Check to see if the all the properties in the model are valid
177
+ # @return true if the model is valid
178
+ def valid?
179
+ true
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ communication_sequence_uuid == o.communication_sequence_uuid &&
188
+ created_dts == o.created_dts &&
189
+ deleted == o.deleted &&
190
+ emails == o.emails &&
191
+ flow_uuid == o.flow_uuid &&
192
+ live == o.live &&
193
+ name == o.name &&
194
+ postcards == o.postcards &&
195
+ status == o.status &&
196
+ status_dts == o.status_dts &&
197
+ trigger_parameter_name == o.trigger_parameter_name &&
198
+ trigger_type == o.trigger_type
199
+ end
200
+
201
+ # @see the `==` method
202
+ # @param [Object] Object to be compared
203
+ def eql?(o)
204
+ self == o
205
+ end
206
+
207
+ # Calculates hash code according to all attributes.
208
+ # @return [Integer] Hash code
209
+ def hash
210
+ [communication_sequence_uuid, created_dts, deleted, emails, flow_uuid, live, name, postcards, status, status_dts, trigger_parameter_name, trigger_type].hash
211
+ end
212
+
213
+ # Builds the object from hash
214
+ # @param [Hash] attributes Model attributes in the form of hash
215
+ # @return [Object] Returns the model itself
216
+ def self.build_from_hash(attributes)
217
+ new.build_from_hash(attributes)
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ attributes = attributes.transform_keys(&:to_sym)
226
+ self.class.openapi_types.each_pair do |key, type|
227
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
228
+ self.send("#{key}=", nil)
229
+ elsif type =~ /\AArray<(.*)>/i
230
+ # check to ensure the input is an array given that the attribute
231
+ # is documented as an array but the input is not
232
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
233
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
234
+ end
235
+ elsif !attributes[self.class.attribute_map[key]].nil?
236
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
237
+ end
238
+ end
239
+
240
+ self
241
+ end
242
+
243
+ # Deserializes the data based on type
244
+ # @param string type Data type
245
+ # @param string value Value to be deserialized
246
+ # @return [Object] Deserialized data
247
+ def _deserialize(type, value)
248
+ case type.to_sym
249
+ when :Time
250
+ Time.parse(value)
251
+ when :Date
252
+ Date.parse(value)
253
+ when :String
254
+ value.to_s
255
+ when :Integer
256
+ value.to_i
257
+ when :Float
258
+ value.to_f
259
+ when :Boolean
260
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
261
+ true
262
+ else
263
+ false
264
+ end
265
+ when :Object
266
+ # generic object (usually a Hash), return directly
267
+ value
268
+ when /\AArray<(?<inner_type>.+)>\z/
269
+ inner_type = Regexp.last_match[:inner_type]
270
+ value.map { |v| _deserialize(inner_type, v) }
271
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
272
+ k_type = Regexp.last_match[:k_type]
273
+ v_type = Regexp.last_match[:v_type]
274
+ {}.tap do |hash|
275
+ value.each do |k, v|
276
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
277
+ end
278
+ end
279
+ else # model
280
+ # models (e.g. Pet) or oneOf
281
+ klass = UltracartClient.const_get(type)
282
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
283
+ end
284
+ end
285
+
286
+ # Returns the string representation of the object
287
+ # @return [String] String presentation of the object
288
+ def to_s
289
+ to_hash.to_s
290
+ end
291
+
292
+ # to_body is an alias to to_hash (backward compatibility)
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_body
295
+ to_hash
296
+ end
297
+
298
+ # Returns the object in the form of hash
299
+ # @return [Hash] Returns the object in the form of hash
300
+ def to_hash
301
+ hash = {}
302
+ self.class.attribute_map.each_pair do |attr, param|
303
+ value = self.send(attr)
304
+ if value.nil?
305
+ is_nullable = self.class.openapi_nullable.include?(attr)
306
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
307
+ end
308
+
309
+ hash[param] = _to_hash(value)
310
+ end
311
+ hash
312
+ end
313
+
314
+ # Outputs non-array value in the form of hash
315
+ # For object, use to_hash. Otherwise, just return the value
316
+ # @param [Object] value Any valid value
317
+ # @return [Hash] Returns the value in the form of hash
318
+ def _to_hash(value)
319
+ if value.is_a?(Array)
320
+ value.compact.map { |v| _to_hash(v) }
321
+ elsif value.is_a?(Hash)
322
+ {}.tap do |hash|
323
+ value.each { |k, v| hash[k] = _to_hash(v) }
324
+ end
325
+ elsif value.respond_to? :to_hash
326
+ value.to_hash
327
+ else
328
+ value
329
+ end
330
+ end
331
+
332
+ end
333
+
334
+ end