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.
- checksums.yaml +4 -4
- data/README.md +20 -2
- data/docs/SfvbApi.md +447 -0
- data/docs/SfvbBlogPostDetail.md +46 -0
- data/docs/SfvbBlogPostImage.md +32 -0
- data/docs/SfvbBlogPostImageRequest.md +28 -0
- data/docs/SfvbBlogPostRequest.md +34 -0
- data/docs/SfvbPageAttributeUpdate.md +1 -1
- data/docs/SfvbServerLog.md +38 -0
- data/docs/SfvbServerLogDetail.md +26 -0
- data/docs/SfvbServerLogEntry.md +24 -0
- data/docs/SfvbServerLogsResponse.md +26 -0
- data/lib/ultracart_api/api/sfvb_api.rb +607 -0
- data/lib/ultracart_api/models/sfvb_blog_post_detail.rb +364 -0
- data/lib/ultracart_api/models/sfvb_blog_post_image.rb +290 -0
- data/lib/ultracart_api/models/sfvb_blog_post_image_request.rb +270 -0
- data/lib/ultracart_api/models/sfvb_blog_post_request.rb +336 -0
- data/lib/ultracart_api/models/sfvb_page_attribute_update.rb +1 -1
- data/lib/ultracart_api/models/sfvb_server_log.rb +320 -0
- data/lib/ultracart_api/models/sfvb_server_log_detail.rb +261 -0
- data/lib/ultracart_api/models/sfvb_server_log_entry.rb +250 -0
- data/lib/ultracart_api/models/sfvb_server_logs_response.rb +262 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +8 -0
- metadata +18 -2
|
@@ -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 SfvbBlogPostImageRequest
|
|
18
|
+
# Detach only. The oid of the image to remove, as the post's images report it.
|
|
19
|
+
attr_accessor :blog_post_multimedia_oid
|
|
20
|
+
|
|
21
|
+
# An image code. On attach it replaces any image with that code. Leave out both code and default_image on attach to add 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. On attach it replaces any existing default.
|
|
25
|
+
attr_accessor :default_image
|
|
26
|
+
|
|
27
|
+
# Attach only. Stored with the image and used as its alt text, as plain text.
|
|
28
|
+
attr_accessor :description
|
|
29
|
+
|
|
30
|
+
# Attach only. The image's name in its address, for example hero.png, with the same extension the upload was requested with. Letters, digits, dots, hyphens, underscores and parentheses, and not already used by another image on the post.
|
|
31
|
+
attr_accessor :filename
|
|
32
|
+
|
|
33
|
+
# Attach only. The key files/upload_url returned for the image's bytes. A JPEG, PNG, GIF or WebP image. Attaching redeems the key, so it cannot be used again.
|
|
34
|
+
attr_accessor :key
|
|
35
|
+
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
:'blog_post_multimedia_oid' => :'blog_post_multimedia_oid',
|
|
40
|
+
:'code' => :'code',
|
|
41
|
+
:'default_image' => :'default_image',
|
|
42
|
+
:'description' => :'description',
|
|
43
|
+
:'filename' => :'filename',
|
|
44
|
+
:'key' => :'key'
|
|
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
|
+
:'blog_post_multimedia_oid' => :'Integer',
|
|
57
|
+
:'code' => :'String',
|
|
58
|
+
:'default_image' => :'Boolean',
|
|
59
|
+
:'description' => :'String',
|
|
60
|
+
:'filename' => :'String',
|
|
61
|
+
:'key' => :'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::SfvbBlogPostImageRequest` 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::SfvbBlogPostImageRequest`. 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?(:'blog_post_multimedia_oid')
|
|
87
|
+
self.blog_post_multimedia_oid = attributes[:'blog_post_multimedia_oid']
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if attributes.key?(:'code')
|
|
91
|
+
self.code = attributes[:'code']
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
if attributes.key?(:'default_image')
|
|
95
|
+
self.default_image = attributes[:'default_image']
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'description')
|
|
99
|
+
self.description = attributes[:'description']
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
if attributes.key?(:'filename')
|
|
103
|
+
self.filename = attributes[:'filename']
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
if attributes.key?(:'key')
|
|
107
|
+
self.key = attributes[:'key']
|
|
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
|
+
blog_post_multimedia_oid == o.blog_post_multimedia_oid &&
|
|
130
|
+
code == o.code &&
|
|
131
|
+
default_image == o.default_image &&
|
|
132
|
+
description == o.description &&
|
|
133
|
+
filename == o.filename &&
|
|
134
|
+
key == o.key
|
|
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
|
+
[blog_post_multimedia_oid, code, default_image, description, filename, key].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,336 @@
|
|
|
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 SfvbBlogPostRequest
|
|
18
|
+
# Whether shoppers may comment. Defaults to false on create.
|
|
19
|
+
attr_accessor :allow_comments
|
|
20
|
+
|
|
21
|
+
# The author's name as plain text, up to 100 characters, with no quotes or angle brackets.
|
|
22
|
+
attr_accessor :author
|
|
23
|
+
|
|
24
|
+
# The post body as HTML, up to 1 MB, rendered exactly as stored. Refused with sfvb.unsafe_html if it could run script - script and other executable tags, on attributes, links that are not http, https, mailto, tel or relative, and iframes other than YouTube or Vimeo players. Reference an attached image by the url the post's images report.
|
|
25
|
+
attr_accessor :body
|
|
26
|
+
|
|
27
|
+
# The post excerpt as HTML, up to 256 KB. Held to the same rule as body.
|
|
28
|
+
attr_accessor :excerpt
|
|
29
|
+
|
|
30
|
+
# When the post is published, as an ISO 8601 UTC time in the same form publication_dts reads back. Refused on a draft. A post made public without one is published now.
|
|
31
|
+
attr_accessor :publication_dts
|
|
32
|
+
|
|
33
|
+
# The post's tags as plain text, up to 100 characters each, with no quotes or angle brackets and no repeats. On an update the list replaces every tag, and an empty list clears them.
|
|
34
|
+
attr_accessor :tags
|
|
35
|
+
|
|
36
|
+
# The post title, up to 1000 characters. Required on create.
|
|
37
|
+
attr_accessor :title
|
|
38
|
+
|
|
39
|
+
# The post's name in its URL, which is the page path followed by this and .html. Letters, digits, hyphens and underscores, up to 150. Must not be used by another post on the storefront, compared without regard to case, and must not be an item id or an item's url part, because the storefront checks blog posts first and the post would replace the item's page. index and index-N are reserved. Required on create.
|
|
40
|
+
attr_accessor :url_part
|
|
41
|
+
|
|
42
|
+
# P public, L logged in customers only, D draft. Defaults to D on create. Anything but D needs sfvb_publish, and so does any change to a post that is not a draft.
|
|
43
|
+
attr_accessor :visibility
|
|
44
|
+
|
|
45
|
+
class EnumAttributeValidator
|
|
46
|
+
attr_reader :datatype
|
|
47
|
+
attr_reader :allowable_values
|
|
48
|
+
|
|
49
|
+
def initialize(datatype, allowable_values)
|
|
50
|
+
@allowable_values = allowable_values.map do |value|
|
|
51
|
+
case datatype.to_s
|
|
52
|
+
when /Integer/i
|
|
53
|
+
value.to_i
|
|
54
|
+
when /Float/i
|
|
55
|
+
value.to_f
|
|
56
|
+
else
|
|
57
|
+
value
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def valid?(value)
|
|
63
|
+
!value || allowable_values.include?(value)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
68
|
+
def self.attribute_map
|
|
69
|
+
{
|
|
70
|
+
:'allow_comments' => :'allow_comments',
|
|
71
|
+
:'author' => :'author',
|
|
72
|
+
:'body' => :'body',
|
|
73
|
+
:'excerpt' => :'excerpt',
|
|
74
|
+
:'publication_dts' => :'publication_dts',
|
|
75
|
+
:'tags' => :'tags',
|
|
76
|
+
:'title' => :'title',
|
|
77
|
+
:'url_part' => :'url_part',
|
|
78
|
+
:'visibility' => :'visibility'
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns all the JSON keys this model knows about
|
|
83
|
+
def self.acceptable_attributes
|
|
84
|
+
attribute_map.values
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Attribute type mapping.
|
|
88
|
+
def self.openapi_types
|
|
89
|
+
{
|
|
90
|
+
:'allow_comments' => :'Boolean',
|
|
91
|
+
:'author' => :'String',
|
|
92
|
+
:'body' => :'String',
|
|
93
|
+
:'excerpt' => :'String',
|
|
94
|
+
:'publication_dts' => :'String',
|
|
95
|
+
:'tags' => :'Array<String>',
|
|
96
|
+
:'title' => :'String',
|
|
97
|
+
:'url_part' => :'String',
|
|
98
|
+
:'visibility' => :'String'
|
|
99
|
+
}
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# List of attributes with nullable: true
|
|
103
|
+
def self.openapi_nullable
|
|
104
|
+
Set.new([
|
|
105
|
+
])
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Initializes the object
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
def initialize(attributes = {})
|
|
111
|
+
if (!attributes.is_a?(Hash))
|
|
112
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbBlogPostRequest` initialize method"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
116
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
117
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
118
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbBlogPostRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
119
|
+
end
|
|
120
|
+
h[k.to_sym] = v
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'allow_comments')
|
|
124
|
+
self.allow_comments = attributes[:'allow_comments']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'author')
|
|
128
|
+
self.author = attributes[:'author']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'body')
|
|
132
|
+
self.body = attributes[:'body']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'excerpt')
|
|
136
|
+
self.excerpt = attributes[:'excerpt']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'publication_dts')
|
|
140
|
+
self.publication_dts = attributes[:'publication_dts']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'tags')
|
|
144
|
+
if (value = attributes[:'tags']).is_a?(Array)
|
|
145
|
+
self.tags = value
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'title')
|
|
150
|
+
self.title = attributes[:'title']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'url_part')
|
|
154
|
+
self.url_part = attributes[:'url_part']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'visibility')
|
|
158
|
+
self.visibility = attributes[:'visibility']
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
163
|
+
# @return Array for valid properties with the reasons
|
|
164
|
+
def list_invalid_properties
|
|
165
|
+
invalid_properties = Array.new
|
|
166
|
+
invalid_properties
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Check to see if the all the properties in the model are valid
|
|
170
|
+
# @return true if the model is valid
|
|
171
|
+
def valid?
|
|
172
|
+
visibility_validator = EnumAttributeValidator.new('String', ["P", "L", "D"])
|
|
173
|
+
return false unless visibility_validator.valid?(@visibility)
|
|
174
|
+
true
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
178
|
+
# @param [Object] visibility Object to be assigned
|
|
179
|
+
def visibility=(visibility)
|
|
180
|
+
validator = EnumAttributeValidator.new('String', ["P", "L", "D"])
|
|
181
|
+
unless validator.valid?(visibility)
|
|
182
|
+
fail ArgumentError, "invalid value for \"visibility\", must be one of #{validator.allowable_values}."
|
|
183
|
+
end
|
|
184
|
+
@visibility = visibility
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Checks equality by comparing each attribute.
|
|
188
|
+
# @param [Object] Object to be compared
|
|
189
|
+
def ==(o)
|
|
190
|
+
return true if self.equal?(o)
|
|
191
|
+
self.class == o.class &&
|
|
192
|
+
allow_comments == o.allow_comments &&
|
|
193
|
+
author == o.author &&
|
|
194
|
+
body == o.body &&
|
|
195
|
+
excerpt == o.excerpt &&
|
|
196
|
+
publication_dts == o.publication_dts &&
|
|
197
|
+
tags == o.tags &&
|
|
198
|
+
title == o.title &&
|
|
199
|
+
url_part == o.url_part &&
|
|
200
|
+
visibility == o.visibility
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# @see the `==` method
|
|
204
|
+
# @param [Object] Object to be compared
|
|
205
|
+
def eql?(o)
|
|
206
|
+
self == o
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Calculates hash code according to all attributes.
|
|
210
|
+
# @return [Integer] Hash code
|
|
211
|
+
def hash
|
|
212
|
+
[allow_comments, author, body, excerpt, publication_dts, tags, title, url_part, visibility].hash
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Builds the object from hash
|
|
216
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
217
|
+
# @return [Object] Returns the model itself
|
|
218
|
+
def self.build_from_hash(attributes)
|
|
219
|
+
new.build_from_hash(attributes)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Builds the object from hash
|
|
223
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
224
|
+
# @return [Object] Returns the model itself
|
|
225
|
+
def build_from_hash(attributes)
|
|
226
|
+
return nil unless attributes.is_a?(Hash)
|
|
227
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
228
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
229
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
230
|
+
self.send("#{key}=", nil)
|
|
231
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
232
|
+
# check to ensure the input is an array given that the attribute
|
|
233
|
+
# is documented as an array but the input is not
|
|
234
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
235
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
236
|
+
end
|
|
237
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
238
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
self
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
# Deserializes the data based on type
|
|
246
|
+
# @param string type Data type
|
|
247
|
+
# @param string value Value to be deserialized
|
|
248
|
+
# @return [Object] Deserialized data
|
|
249
|
+
def _deserialize(type, value)
|
|
250
|
+
case type.to_sym
|
|
251
|
+
when :Time
|
|
252
|
+
Time.parse(value)
|
|
253
|
+
when :Date
|
|
254
|
+
Date.parse(value)
|
|
255
|
+
when :String
|
|
256
|
+
value.to_s
|
|
257
|
+
when :Integer
|
|
258
|
+
value.to_i
|
|
259
|
+
when :Float
|
|
260
|
+
value.to_f
|
|
261
|
+
when :Boolean
|
|
262
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
263
|
+
true
|
|
264
|
+
else
|
|
265
|
+
false
|
|
266
|
+
end
|
|
267
|
+
when :Object
|
|
268
|
+
# generic object (usually a Hash), return directly
|
|
269
|
+
value
|
|
270
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
271
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
272
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
273
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
274
|
+
k_type = Regexp.last_match[:k_type]
|
|
275
|
+
v_type = Regexp.last_match[:v_type]
|
|
276
|
+
{}.tap do |hash|
|
|
277
|
+
value.each do |k, v|
|
|
278
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
else # model
|
|
282
|
+
# models (e.g. Pet) or oneOf
|
|
283
|
+
klass = UltracartClient.const_get(type)
|
|
284
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Returns the string representation of the object
|
|
289
|
+
# @return [String] String presentation of the object
|
|
290
|
+
def to_s
|
|
291
|
+
to_hash.to_s
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
295
|
+
# @return [Hash] Returns the object in the form of hash
|
|
296
|
+
def to_body
|
|
297
|
+
to_hash
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Returns the object in the form of hash
|
|
301
|
+
# @return [Hash] Returns the object in the form of hash
|
|
302
|
+
def to_hash
|
|
303
|
+
hash = {}
|
|
304
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
305
|
+
value = self.send(attr)
|
|
306
|
+
if value.nil?
|
|
307
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
308
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
hash[param] = _to_hash(value)
|
|
312
|
+
end
|
|
313
|
+
hash
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Outputs non-array value in the form of hash
|
|
317
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
318
|
+
# @param [Object] value Any valid value
|
|
319
|
+
# @return [Hash] Returns the value in the form of hash
|
|
320
|
+
def _to_hash(value)
|
|
321
|
+
if value.is_a?(Array)
|
|
322
|
+
value.compact.map { |v| _to_hash(v) }
|
|
323
|
+
elsif value.is_a?(Hash)
|
|
324
|
+
{}.tap do |hash|
|
|
325
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
326
|
+
end
|
|
327
|
+
elsif value.respond_to? :to_hash
|
|
328
|
+
value.to_hash
|
|
329
|
+
else
|
|
330
|
+
value
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
end
|
|
@@ -21,7 +21,7 @@ module UltracartClient
|
|
|
21
21
|
# Only consulted when creating an attribute no template declares. For a declared attribute the template's type always wins, because the templates decide it and not the caller.
|
|
22
22
|
attr_accessor :type
|
|
23
23
|
|
|
24
|
-
# The value to store. An empty string clears it. For html the markup is stored as given and rendered as given. For boolean send the text true or false.
|
|
24
|
+
# The value to store. An empty string clears it. For html the markup is stored as given and rendered as given. For boolean send the text true or false. For itemset send a comma separated list of merchant item ids in display order, not JSON. An id that does not resolve is dropped.
|
|
25
25
|
attr_accessor :value
|
|
26
26
|
|
|
27
27
|
class EnumAttributeValidator
|