ultracart_api 4.1.219 → 4.1.221

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,302 @@
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 SfvbPostcardProofRequest
18
+ # The recipient street address. Without address1, city, state and postal_code, a sample address is used.
19
+ attr_accessor :address1
20
+
21
+ # The recipient second address line.
22
+ attr_accessor :address2
23
+
24
+ # Item ids for the cart a cart flow card renders with. The cart is made for the proof and deleted after it.
25
+ attr_accessor :cart_item_ids
26
+
27
+ # The recipient city.
28
+ attr_accessor :city
29
+
30
+ # The recipient name the card greets and is addressed to. Defaults to the signed in user.
31
+ attr_accessor :customer_name
32
+
33
+ # True to return only the rendered HTML of both sides, with no print vendor render. The default, false, also returns the images that would print and the vendor proof PDF.
34
+ attr_accessor :html_only
35
+
36
+ # A test order for an order flow card. Real orders are refused. Without one, an order flow card renders with a made up order.
37
+ attr_accessor :order_id
38
+
39
+ # The recipient postal code.
40
+ attr_accessor :postal_code
41
+
42
+ # The recipient state.
43
+ attr_accessor :state
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ :'address1' => :'address1',
49
+ :'address2' => :'address2',
50
+ :'cart_item_ids' => :'cart_item_ids',
51
+ :'city' => :'city',
52
+ :'customer_name' => :'customer_name',
53
+ :'html_only' => :'html_only',
54
+ :'order_id' => :'order_id',
55
+ :'postal_code' => :'postal_code',
56
+ :'state' => :'state'
57
+ }
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'address1' => :'String',
69
+ :'address2' => :'String',
70
+ :'cart_item_ids' => :'Array<String>',
71
+ :'city' => :'String',
72
+ :'customer_name' => :'String',
73
+ :'html_only' => :'Boolean',
74
+ :'order_id' => :'String',
75
+ :'postal_code' => :'String',
76
+ :'state' => :'String'
77
+ }
78
+ end
79
+
80
+ # List of attributes with nullable: true
81
+ def self.openapi_nullable
82
+ Set.new([
83
+ ])
84
+ end
85
+
86
+ # Initializes the object
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ def initialize(attributes = {})
89
+ if (!attributes.is_a?(Hash))
90
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPostcardProofRequest` initialize method"
91
+ end
92
+
93
+ # check to see if the attribute exists and convert string to symbol for hash key
94
+ attributes = attributes.each_with_object({}) { |(k, v), h|
95
+ if (!self.class.attribute_map.key?(k.to_sym))
96
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPostcardProofRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ end
98
+ h[k.to_sym] = v
99
+ }
100
+
101
+ if attributes.key?(:'address1')
102
+ self.address1 = attributes[:'address1']
103
+ end
104
+
105
+ if attributes.key?(:'address2')
106
+ self.address2 = attributes[:'address2']
107
+ end
108
+
109
+ if attributes.key?(:'cart_item_ids')
110
+ if (value = attributes[:'cart_item_ids']).is_a?(Array)
111
+ self.cart_item_ids = value
112
+ end
113
+ end
114
+
115
+ if attributes.key?(:'city')
116
+ self.city = attributes[:'city']
117
+ end
118
+
119
+ if attributes.key?(:'customer_name')
120
+ self.customer_name = attributes[:'customer_name']
121
+ end
122
+
123
+ if attributes.key?(:'html_only')
124
+ self.html_only = attributes[:'html_only']
125
+ end
126
+
127
+ if attributes.key?(:'order_id')
128
+ self.order_id = attributes[:'order_id']
129
+ end
130
+
131
+ if attributes.key?(:'postal_code')
132
+ self.postal_code = attributes[:'postal_code']
133
+ end
134
+
135
+ if attributes.key?(:'state')
136
+ self.state = attributes[:'state']
137
+ end
138
+ end
139
+
140
+ # Show invalid properties with the reasons. Usually used together with valid?
141
+ # @return Array for valid properties with the reasons
142
+ def list_invalid_properties
143
+ invalid_properties = Array.new
144
+ invalid_properties
145
+ end
146
+
147
+ # Check to see if the all the properties in the model are valid
148
+ # @return true if the model is valid
149
+ def valid?
150
+ true
151
+ end
152
+
153
+ # Checks equality by comparing each attribute.
154
+ # @param [Object] Object to be compared
155
+ def ==(o)
156
+ return true if self.equal?(o)
157
+ self.class == o.class &&
158
+ address1 == o.address1 &&
159
+ address2 == o.address2 &&
160
+ cart_item_ids == o.cart_item_ids &&
161
+ city == o.city &&
162
+ customer_name == o.customer_name &&
163
+ html_only == o.html_only &&
164
+ order_id == o.order_id &&
165
+ postal_code == o.postal_code &&
166
+ state == o.state
167
+ end
168
+
169
+ # @see the `==` method
170
+ # @param [Object] Object to be compared
171
+ def eql?(o)
172
+ self == o
173
+ end
174
+
175
+ # Calculates hash code according to all attributes.
176
+ # @return [Integer] Hash code
177
+ def hash
178
+ [address1, address2, cart_item_ids, city, customer_name, html_only, order_id, postal_code, state].hash
179
+ end
180
+
181
+ # Builds the object from hash
182
+ # @param [Hash] attributes Model attributes in the form of hash
183
+ # @return [Object] Returns the model itself
184
+ def self.build_from_hash(attributes)
185
+ new.build_from_hash(attributes)
186
+ end
187
+
188
+ # Builds the object from hash
189
+ # @param [Hash] attributes Model attributes in the form of hash
190
+ # @return [Object] Returns the model itself
191
+ def build_from_hash(attributes)
192
+ return nil unless attributes.is_a?(Hash)
193
+ attributes = attributes.transform_keys(&:to_sym)
194
+ self.class.openapi_types.each_pair do |key, type|
195
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
196
+ self.send("#{key}=", nil)
197
+ elsif type =~ /\AArray<(.*)>/i
198
+ # check to ensure the input is an array given that the attribute
199
+ # is documented as an array but the input is not
200
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
201
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
202
+ end
203
+ elsif !attributes[self.class.attribute_map[key]].nil?
204
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
205
+ end
206
+ end
207
+
208
+ self
209
+ end
210
+
211
+ # Deserializes the data based on type
212
+ # @param string type Data type
213
+ # @param string value Value to be deserialized
214
+ # @return [Object] Deserialized data
215
+ def _deserialize(type, value)
216
+ case type.to_sym
217
+ when :Time
218
+ Time.parse(value)
219
+ when :Date
220
+ Date.parse(value)
221
+ when :String
222
+ value.to_s
223
+ when :Integer
224
+ value.to_i
225
+ when :Float
226
+ value.to_f
227
+ when :Boolean
228
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
229
+ true
230
+ else
231
+ false
232
+ end
233
+ when :Object
234
+ # generic object (usually a Hash), return directly
235
+ value
236
+ when /\AArray<(?<inner_type>.+)>\z/
237
+ inner_type = Regexp.last_match[:inner_type]
238
+ value.map { |v| _deserialize(inner_type, v) }
239
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
240
+ k_type = Regexp.last_match[:k_type]
241
+ v_type = Regexp.last_match[:v_type]
242
+ {}.tap do |hash|
243
+ value.each do |k, v|
244
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
245
+ end
246
+ end
247
+ else # model
248
+ # models (e.g. Pet) or oneOf
249
+ klass = UltracartClient.const_get(type)
250
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
251
+ end
252
+ end
253
+
254
+ # Returns the string representation of the object
255
+ # @return [String] String presentation of the object
256
+ def to_s
257
+ to_hash.to_s
258
+ end
259
+
260
+ # to_body is an alias to to_hash (backward compatibility)
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_body
263
+ to_hash
264
+ end
265
+
266
+ # Returns the object in the form of hash
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_hash
269
+ hash = {}
270
+ self.class.attribute_map.each_pair do |attr, param|
271
+ value = self.send(attr)
272
+ if value.nil?
273
+ is_nullable = self.class.openapi_nullable.include?(attr)
274
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
275
+ end
276
+
277
+ hash[param] = _to_hash(value)
278
+ end
279
+ hash
280
+ end
281
+
282
+ # Outputs non-array value in the form of hash
283
+ # For object, use to_hash. Otherwise, just return the value
284
+ # @param [Object] value Any valid value
285
+ # @return [Hash] Returns the value in the form of hash
286
+ def _to_hash(value)
287
+ if value.is_a?(Array)
288
+ value.compact.map { |v| _to_hash(v) }
289
+ elsif value.is_a?(Hash)
290
+ {}.tap do |hash|
291
+ value.each { |k, v| hash[k] = _to_hash(v) }
292
+ end
293
+ elsif value.respond_to? :to_hash
294
+ value.to_hash
295
+ else
296
+ value
297
+ end
298
+ end
299
+
300
+ end
301
+
302
+ end
@@ -0,0 +1,356 @@
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 SfvbPostcardProofResponse
18
+ # The back as the send renders it, after the name tokens are filled.
19
+ attr_accessor :back_html
20
+
21
+ # The back as the PNG image the print vendor prints from. A public url.
22
+ attr_accessor :back_image_url
23
+
24
+ # The print vendor thumbnail of the back.
25
+ attr_accessor :back_thumbnail_url
26
+
27
+ # The front as the send renders it, after the name tokens are filled.
28
+ attr_accessor :front_html
29
+
30
+ # The front as the PNG image the print vendor prints from. A public url.
31
+ attr_accessor :front_image_url
32
+
33
+ # The print vendor thumbnail of the front.
34
+ attr_accessor :front_thumbnail_url
35
+
36
+ # Where the order came from. test for the order_id given, dummy for a made up one, none for no order.
37
+ attr_accessor :order_source
38
+
39
+ # The postcard the step mails.
40
+ attr_accessor :postcard_uuid
41
+
42
+ # The print vendor proof PDF of both sides.
43
+ attr_accessor :rendered_pdf_url
44
+
45
+ # True when the print vendor rendered the card, so the image and PDF urls are set.
46
+ attr_accessor :vendor_rendered
47
+
48
+ # Where the proof differs from a send, such as a placeholder coupon code or a sample address, and anything that would make a send skip the card.
49
+ attr_accessor :warnings
50
+
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'back_html' => :'back_html',
77
+ :'back_image_url' => :'back_image_url',
78
+ :'back_thumbnail_url' => :'back_thumbnail_url',
79
+ :'front_html' => :'front_html',
80
+ :'front_image_url' => :'front_image_url',
81
+ :'front_thumbnail_url' => :'front_thumbnail_url',
82
+ :'order_source' => :'order_source',
83
+ :'postcard_uuid' => :'postcard_uuid',
84
+ :'rendered_pdf_url' => :'rendered_pdf_url',
85
+ :'vendor_rendered' => :'vendor_rendered',
86
+ :'warnings' => :'warnings'
87
+ }
88
+ end
89
+
90
+ # Returns all the JSON keys this model knows about
91
+ def self.acceptable_attributes
92
+ attribute_map.values
93
+ end
94
+
95
+ # Attribute type mapping.
96
+ def self.openapi_types
97
+ {
98
+ :'back_html' => :'String',
99
+ :'back_image_url' => :'String',
100
+ :'back_thumbnail_url' => :'String',
101
+ :'front_html' => :'String',
102
+ :'front_image_url' => :'String',
103
+ :'front_thumbnail_url' => :'String',
104
+ :'order_source' => :'String',
105
+ :'postcard_uuid' => :'String',
106
+ :'rendered_pdf_url' => :'String',
107
+ :'vendor_rendered' => :'Boolean',
108
+ :'warnings' => :'Array<SfvbErrorDetail>'
109
+ }
110
+ end
111
+
112
+ # List of attributes with nullable: true
113
+ def self.openapi_nullable
114
+ Set.new([
115
+ ])
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPostcardProofResponse` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h|
127
+ if (!self.class.attribute_map.key?(k.to_sym))
128
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPostcardProofResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
129
+ end
130
+ h[k.to_sym] = v
131
+ }
132
+
133
+ if attributes.key?(:'back_html')
134
+ self.back_html = attributes[:'back_html']
135
+ end
136
+
137
+ if attributes.key?(:'back_image_url')
138
+ self.back_image_url = attributes[:'back_image_url']
139
+ end
140
+
141
+ if attributes.key?(:'back_thumbnail_url')
142
+ self.back_thumbnail_url = attributes[:'back_thumbnail_url']
143
+ end
144
+
145
+ if attributes.key?(:'front_html')
146
+ self.front_html = attributes[:'front_html']
147
+ end
148
+
149
+ if attributes.key?(:'front_image_url')
150
+ self.front_image_url = attributes[:'front_image_url']
151
+ end
152
+
153
+ if attributes.key?(:'front_thumbnail_url')
154
+ self.front_thumbnail_url = attributes[:'front_thumbnail_url']
155
+ end
156
+
157
+ if attributes.key?(:'order_source')
158
+ self.order_source = attributes[:'order_source']
159
+ end
160
+
161
+ if attributes.key?(:'postcard_uuid')
162
+ self.postcard_uuid = attributes[:'postcard_uuid']
163
+ end
164
+
165
+ if attributes.key?(:'rendered_pdf_url')
166
+ self.rendered_pdf_url = attributes[:'rendered_pdf_url']
167
+ end
168
+
169
+ if attributes.key?(:'vendor_rendered')
170
+ self.vendor_rendered = attributes[:'vendor_rendered']
171
+ end
172
+
173
+ if attributes.key?(:'warnings')
174
+ if (value = attributes[:'warnings']).is_a?(Array)
175
+ self.warnings = value
176
+ end
177
+ end
178
+ end
179
+
180
+ # Show invalid properties with the reasons. Usually used together with valid?
181
+ # @return Array for valid properties with the reasons
182
+ def list_invalid_properties
183
+ invalid_properties = Array.new
184
+ invalid_properties
185
+ end
186
+
187
+ # Check to see if the all the properties in the model are valid
188
+ # @return true if the model is valid
189
+ def valid?
190
+ order_source_validator = EnumAttributeValidator.new('String', ["test", "dummy", "none"])
191
+ return false unless order_source_validator.valid?(@order_source)
192
+ true
193
+ end
194
+
195
+ # Custom attribute writer method checking allowed values (enum).
196
+ # @param [Object] order_source Object to be assigned
197
+ def order_source=(order_source)
198
+ validator = EnumAttributeValidator.new('String', ["test", "dummy", "none"])
199
+ unless validator.valid?(order_source)
200
+ fail ArgumentError, "invalid value for \"order_source\", must be one of #{validator.allowable_values}."
201
+ end
202
+ @order_source = order_source
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ back_html == o.back_html &&
211
+ back_image_url == o.back_image_url &&
212
+ back_thumbnail_url == o.back_thumbnail_url &&
213
+ front_html == o.front_html &&
214
+ front_image_url == o.front_image_url &&
215
+ front_thumbnail_url == o.front_thumbnail_url &&
216
+ order_source == o.order_source &&
217
+ postcard_uuid == o.postcard_uuid &&
218
+ rendered_pdf_url == o.rendered_pdf_url &&
219
+ vendor_rendered == o.vendor_rendered &&
220
+ warnings == o.warnings
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Integer] Hash code
231
+ def hash
232
+ [back_html, back_image_url, back_thumbnail_url, front_html, front_image_url, front_thumbnail_url, order_source, postcard_uuid, rendered_pdf_url, vendor_rendered, warnings].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def self.build_from_hash(attributes)
239
+ new.build_from_hash(attributes)
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def build_from_hash(attributes)
246
+ return nil unless attributes.is_a?(Hash)
247
+ attributes = attributes.transform_keys(&:to_sym)
248
+ self.class.openapi_types.each_pair do |key, type|
249
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
250
+ self.send("#{key}=", nil)
251
+ elsif type =~ /\AArray<(.*)>/i
252
+ # check to ensure the input is an array given that the attribute
253
+ # is documented as an array but the input is not
254
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
255
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
256
+ end
257
+ elsif !attributes[self.class.attribute_map[key]].nil?
258
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
259
+ end
260
+ end
261
+
262
+ self
263
+ end
264
+
265
+ # Deserializes the data based on type
266
+ # @param string type Data type
267
+ # @param string value Value to be deserialized
268
+ # @return [Object] Deserialized data
269
+ def _deserialize(type, value)
270
+ case type.to_sym
271
+ when :Time
272
+ Time.parse(value)
273
+ when :Date
274
+ Date.parse(value)
275
+ when :String
276
+ value.to_s
277
+ when :Integer
278
+ value.to_i
279
+ when :Float
280
+ value.to_f
281
+ when :Boolean
282
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
283
+ true
284
+ else
285
+ false
286
+ end
287
+ when :Object
288
+ # generic object (usually a Hash), return directly
289
+ value
290
+ when /\AArray<(?<inner_type>.+)>\z/
291
+ inner_type = Regexp.last_match[:inner_type]
292
+ value.map { |v| _deserialize(inner_type, v) }
293
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
294
+ k_type = Regexp.last_match[:k_type]
295
+ v_type = Regexp.last_match[:v_type]
296
+ {}.tap do |hash|
297
+ value.each do |k, v|
298
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
299
+ end
300
+ end
301
+ else # model
302
+ # models (e.g. Pet) or oneOf
303
+ klass = UltracartClient.const_get(type)
304
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
305
+ end
306
+ end
307
+
308
+ # Returns the string representation of the object
309
+ # @return [String] String presentation of the object
310
+ def to_s
311
+ to_hash.to_s
312
+ end
313
+
314
+ # to_body is an alias to to_hash (backward compatibility)
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_body
317
+ to_hash
318
+ end
319
+
320
+ # Returns the object in the form of hash
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_hash
323
+ hash = {}
324
+ self.class.attribute_map.each_pair do |attr, param|
325
+ value = self.send(attr)
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ # Outputs non-array value in the form of hash
337
+ # For object, use to_hash. Otherwise, just return the value
338
+ # @param [Object] value Any valid value
339
+ # @return [Hash] Returns the value in the form of hash
340
+ def _to_hash(value)
341
+ if value.is_a?(Array)
342
+ value.compact.map { |v| _to_hash(v) }
343
+ elsif value.is_a?(Hash)
344
+ {}.tap do |hash|
345
+ value.each { |k, v| hash[k] = _to_hash(v) }
346
+ end
347
+ elsif value.respond_to? :to_hash
348
+ value.to_hash
349
+ else
350
+ value
351
+ end
352
+ end
353
+
354
+ end
355
+
356
+ end