ultracart_api 4.1.176 → 4.1.178

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,364 @@
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 SfvbBlogPostDetail
18
+ # Whether shoppers may comment.
19
+ attr_accessor :allow_comments
20
+
21
+ # The post author.
22
+ attr_accessor :author
23
+
24
+ # The blog post's oid. This is what a page's blog post assignment names.
25
+ attr_accessor :blog_post_oid
26
+
27
+ # The post body as HTML, exactly as stored.
28
+ attr_accessor :body
29
+
30
+ # When the post was created (ISO 8601, UTC).
31
+ attr_accessor :created_dts
32
+
33
+ # The post excerpt as HTML, exactly as stored.
34
+ attr_accessor :excerpt
35
+
36
+ # The post's images, the default image first.
37
+ attr_accessor :images
38
+
39
+ # When the post was last changed (ISO 8601, UTC), or null if it never was.
40
+ attr_accessor :last_modified_dts
41
+
42
+ # When the post is published (ISO 8601, UTC), or null for a draft.
43
+ attr_accessor :publication_dts
44
+
45
+ # The post's tags.
46
+ attr_accessor :tags
47
+
48
+ # The post title.
49
+ attr_accessor :title
50
+
51
+ # True when no page shows this post yet.
52
+ attr_accessor :unassigned
53
+
54
+ # The post's name in its URL.
55
+ attr_accessor :url_part
56
+
57
+ # The post's address on the storefront, or null until a page shows it.
58
+ attr_accessor :view_url
59
+
60
+ # P public, L logged in customers only, D draft.
61
+ attr_accessor :visibility
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ :'allow_comments' => :'allow_comments',
67
+ :'author' => :'author',
68
+ :'blog_post_oid' => :'blog_post_oid',
69
+ :'body' => :'body',
70
+ :'created_dts' => :'created_dts',
71
+ :'excerpt' => :'excerpt',
72
+ :'images' => :'images',
73
+ :'last_modified_dts' => :'last_modified_dts',
74
+ :'publication_dts' => :'publication_dts',
75
+ :'tags' => :'tags',
76
+ :'title' => :'title',
77
+ :'unassigned' => :'unassigned',
78
+ :'url_part' => :'url_part',
79
+ :'view_url' => :'view_url',
80
+ :'visibility' => :'visibility'
81
+ }
82
+ end
83
+
84
+ # Returns all the JSON keys this model knows about
85
+ def self.acceptable_attributes
86
+ attribute_map.values
87
+ end
88
+
89
+ # Attribute type mapping.
90
+ def self.openapi_types
91
+ {
92
+ :'allow_comments' => :'Boolean',
93
+ :'author' => :'String',
94
+ :'blog_post_oid' => :'Integer',
95
+ :'body' => :'String',
96
+ :'created_dts' => :'String',
97
+ :'excerpt' => :'String',
98
+ :'images' => :'Array<SfvbBlogPostImage>',
99
+ :'last_modified_dts' => :'String',
100
+ :'publication_dts' => :'String',
101
+ :'tags' => :'Array<String>',
102
+ :'title' => :'String',
103
+ :'unassigned' => :'Boolean',
104
+ :'url_part' => :'String',
105
+ :'view_url' => :'String',
106
+ :'visibility' => :'String'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ ])
114
+ end
115
+
116
+ # Initializes the object
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ def initialize(attributes = {})
119
+ if (!attributes.is_a?(Hash))
120
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbBlogPostDetail` initialize method"
121
+ end
122
+
123
+ # check to see if the attribute exists and convert string to symbol for hash key
124
+ attributes = attributes.each_with_object({}) { |(k, v), h|
125
+ if (!self.class.attribute_map.key?(k.to_sym))
126
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbBlogPostDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
127
+ end
128
+ h[k.to_sym] = v
129
+ }
130
+
131
+ if attributes.key?(:'allow_comments')
132
+ self.allow_comments = attributes[:'allow_comments']
133
+ end
134
+
135
+ if attributes.key?(:'author')
136
+ self.author = attributes[:'author']
137
+ end
138
+
139
+ if attributes.key?(:'blog_post_oid')
140
+ self.blog_post_oid = attributes[:'blog_post_oid']
141
+ end
142
+
143
+ if attributes.key?(:'body')
144
+ self.body = attributes[:'body']
145
+ end
146
+
147
+ if attributes.key?(:'created_dts')
148
+ self.created_dts = attributes[:'created_dts']
149
+ end
150
+
151
+ if attributes.key?(:'excerpt')
152
+ self.excerpt = attributes[:'excerpt']
153
+ end
154
+
155
+ if attributes.key?(:'images')
156
+ if (value = attributes[:'images']).is_a?(Array)
157
+ self.images = value
158
+ end
159
+ end
160
+
161
+ if attributes.key?(:'last_modified_dts')
162
+ self.last_modified_dts = attributes[:'last_modified_dts']
163
+ end
164
+
165
+ if attributes.key?(:'publication_dts')
166
+ self.publication_dts = attributes[:'publication_dts']
167
+ end
168
+
169
+ if attributes.key?(:'tags')
170
+ if (value = attributes[:'tags']).is_a?(Array)
171
+ self.tags = value
172
+ end
173
+ end
174
+
175
+ if attributes.key?(:'title')
176
+ self.title = attributes[:'title']
177
+ end
178
+
179
+ if attributes.key?(:'unassigned')
180
+ self.unassigned = attributes[:'unassigned']
181
+ end
182
+
183
+ if attributes.key?(:'url_part')
184
+ self.url_part = attributes[:'url_part']
185
+ end
186
+
187
+ if attributes.key?(:'view_url')
188
+ self.view_url = attributes[:'view_url']
189
+ end
190
+
191
+ if attributes.key?(:'visibility')
192
+ self.visibility = attributes[:'visibility']
193
+ end
194
+ end
195
+
196
+ # Show invalid properties with the reasons. Usually used together with valid?
197
+ # @return Array for valid properties with the reasons
198
+ def list_invalid_properties
199
+ invalid_properties = Array.new
200
+ invalid_properties
201
+ end
202
+
203
+ # Check to see if the all the properties in the model are valid
204
+ # @return true if the model is valid
205
+ def valid?
206
+ true
207
+ end
208
+
209
+ # Checks equality by comparing each attribute.
210
+ # @param [Object] Object to be compared
211
+ def ==(o)
212
+ return true if self.equal?(o)
213
+ self.class == o.class &&
214
+ allow_comments == o.allow_comments &&
215
+ author == o.author &&
216
+ blog_post_oid == o.blog_post_oid &&
217
+ body == o.body &&
218
+ created_dts == o.created_dts &&
219
+ excerpt == o.excerpt &&
220
+ images == o.images &&
221
+ last_modified_dts == o.last_modified_dts &&
222
+ publication_dts == o.publication_dts &&
223
+ tags == o.tags &&
224
+ title == o.title &&
225
+ unassigned == o.unassigned &&
226
+ url_part == o.url_part &&
227
+ view_url == o.view_url &&
228
+ visibility == o.visibility
229
+ end
230
+
231
+ # @see the `==` method
232
+ # @param [Object] Object to be compared
233
+ def eql?(o)
234
+ self == o
235
+ end
236
+
237
+ # Calculates hash code according to all attributes.
238
+ # @return [Integer] Hash code
239
+ def hash
240
+ [allow_comments, author, blog_post_oid, body, created_dts, excerpt, images, last_modified_dts, publication_dts, tags, title, unassigned, url_part, view_url, visibility].hash
241
+ end
242
+
243
+ # Builds the object from hash
244
+ # @param [Hash] attributes Model attributes in the form of hash
245
+ # @return [Object] Returns the model itself
246
+ def self.build_from_hash(attributes)
247
+ new.build_from_hash(attributes)
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ attributes = attributes.transform_keys(&:to_sym)
256
+ self.class.openapi_types.each_pair do |key, type|
257
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
258
+ self.send("#{key}=", nil)
259
+ elsif type =~ /\AArray<(.*)>/i
260
+ # check to ensure the input is an array given that the attribute
261
+ # is documented as an array but the input is not
262
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
263
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
264
+ end
265
+ elsif !attributes[self.class.attribute_map[key]].nil?
266
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
267
+ end
268
+ end
269
+
270
+ self
271
+ end
272
+
273
+ # Deserializes the data based on type
274
+ # @param string type Data type
275
+ # @param string value Value to be deserialized
276
+ # @return [Object] Deserialized data
277
+ def _deserialize(type, value)
278
+ case type.to_sym
279
+ when :Time
280
+ Time.parse(value)
281
+ when :Date
282
+ Date.parse(value)
283
+ when :String
284
+ value.to_s
285
+ when :Integer
286
+ value.to_i
287
+ when :Float
288
+ value.to_f
289
+ when :Boolean
290
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
291
+ true
292
+ else
293
+ false
294
+ end
295
+ when :Object
296
+ # generic object (usually a Hash), return directly
297
+ value
298
+ when /\AArray<(?<inner_type>.+)>\z/
299
+ inner_type = Regexp.last_match[:inner_type]
300
+ value.map { |v| _deserialize(inner_type, v) }
301
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
302
+ k_type = Regexp.last_match[:k_type]
303
+ v_type = Regexp.last_match[:v_type]
304
+ {}.tap do |hash|
305
+ value.each do |k, v|
306
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
307
+ end
308
+ end
309
+ else # model
310
+ # models (e.g. Pet) or oneOf
311
+ klass = UltracartClient.const_get(type)
312
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
313
+ end
314
+ end
315
+
316
+ # Returns the string representation of the object
317
+ # @return [String] String presentation of the object
318
+ def to_s
319
+ to_hash.to_s
320
+ end
321
+
322
+ # to_body is an alias to to_hash (backward compatibility)
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_body
325
+ to_hash
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ self.class.attribute_map.each_pair do |attr, param|
333
+ value = self.send(attr)
334
+ if value.nil?
335
+ is_nullable = self.class.openapi_nullable.include?(attr)
336
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
337
+ end
338
+
339
+ hash[param] = _to_hash(value)
340
+ end
341
+ hash
342
+ end
343
+
344
+ # Outputs non-array value in the form of hash
345
+ # For object, use to_hash. Otherwise, just return the value
346
+ # @param [Object] value Any valid value
347
+ # @return [Hash] Returns the value in the form of hash
348
+ def _to_hash(value)
349
+ if value.is_a?(Array)
350
+ value.compact.map { |v| _to_hash(v) }
351
+ elsif value.is_a?(Hash)
352
+ {}.tap do |hash|
353
+ value.each { |k, v| hash[k] = _to_hash(v) }
354
+ end
355
+ elsif value.respond_to? :to_hash
356
+ value.to_hash
357
+ else
358
+ value
359
+ end
360
+ end
361
+
362
+ end
363
+
364
+ end
@@ -0,0 +1,290 @@
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 SfvbBlogPostImage
18
+ # The image's oid. Detach names it this way.
19
+ attr_accessor :blog_post_multimedia_oid
20
+
21
+ # The image code, or null for the default image and for an image used only in the body.
22
+ attr_accessor :code
23
+
24
+ # True for the post's default image, which a blogpostimage element and og image use.
25
+ attr_accessor :default_image
26
+
27
+ # The description stored with the image, used as its alt text.
28
+ attr_accessor :description
29
+
30
+ # The image's file name.
31
+ attr_accessor :filename
32
+
33
+ # Height in pixels, when it could be measured.
34
+ attr_accessor :height
35
+
36
+ # The address to use in the post body, for example in an img src. The storefront serves it from its image CDN once the image has been copied there.
37
+ attr_accessor :url
38
+
39
+ # Width in pixels, when it could be measured.
40
+ attr_accessor :width
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'blog_post_multimedia_oid' => :'blog_post_multimedia_oid',
46
+ :'code' => :'code',
47
+ :'default_image' => :'default_image',
48
+ :'description' => :'description',
49
+ :'filename' => :'filename',
50
+ :'height' => :'height',
51
+ :'url' => :'url',
52
+ :'width' => :'width'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'blog_post_multimedia_oid' => :'Integer',
65
+ :'code' => :'String',
66
+ :'default_image' => :'Boolean',
67
+ :'description' => :'String',
68
+ :'filename' => :'String',
69
+ :'height' => :'Integer',
70
+ :'url' => :'String',
71
+ :'width' => :'Integer'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbBlogPostImage` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbBlogPostImage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'blog_post_multimedia_oid')
97
+ self.blog_post_multimedia_oid = attributes[:'blog_post_multimedia_oid']
98
+ end
99
+
100
+ if attributes.key?(:'code')
101
+ self.code = attributes[:'code']
102
+ end
103
+
104
+ if attributes.key?(:'default_image')
105
+ self.default_image = attributes[:'default_image']
106
+ end
107
+
108
+ if attributes.key?(:'description')
109
+ self.description = attributes[:'description']
110
+ end
111
+
112
+ if attributes.key?(:'filename')
113
+ self.filename = attributes[:'filename']
114
+ end
115
+
116
+ if attributes.key?(:'height')
117
+ self.height = attributes[:'height']
118
+ end
119
+
120
+ if attributes.key?(:'url')
121
+ self.url = attributes[:'url']
122
+ end
123
+
124
+ if attributes.key?(:'width')
125
+ self.width = attributes[:'width']
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ blog_post_multimedia_oid == o.blog_post_multimedia_oid &&
148
+ code == o.code &&
149
+ default_image == o.default_image &&
150
+ description == o.description &&
151
+ filename == o.filename &&
152
+ height == o.height &&
153
+ url == o.url &&
154
+ width == o.width
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [blog_post_multimedia_oid, code, default_image, description, filename, height, url, width].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ new.build_from_hash(attributes)
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ self.class.openapi_types.each_pair do |key, type|
183
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
184
+ self.send("#{key}=", nil)
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = UltracartClient.const_get(type)
238
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end