ultracart_api 4.1.169 → 4.1.170
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 +18 -2
- data/docs/SfvbApi.md +342 -0
- data/docs/SfvbItemAttribute.md +34 -0
- data/docs/SfvbItemAttributeUpdate.md +22 -0
- data/docs/SfvbItemAttributeUpdateRequest.md +18 -0
- data/docs/SfvbItemContentRequest.md +20 -0
- data/docs/SfvbItemMultimedia.md +34 -0
- data/docs/SfvbItemMultimediaRequest.md +24 -0
- data/docs/SfvbItemResponse.md +32 -0
- data/docs/SfvbItemSeo.md +34 -0
- data/docs/SfvbItemSeoRequest.md +22 -0
- data/lib/ultracart_api/api/sfvb_api.rb +470 -0
- data/lib/ultracart_api/models/sfvb_item_attribute.rb +336 -0
- data/lib/ultracart_api/models/sfvb_item_attribute_update.rb +274 -0
- data/lib/ultracart_api/models/sfvb_item_attribute_update_request.rb +222 -0
- data/lib/ultracart_api/models/sfvb_item_content_request.rb +230 -0
- data/lib/ultracart_api/models/sfvb_item_multimedia.rb +334 -0
- data/lib/ultracart_api/models/sfvb_item_multimedia_request.rb +250 -0
- data/lib/ultracart_api/models/sfvb_item_response.rb +295 -0
- data/lib/ultracart_api/models/sfvb_item_seo.rb +358 -0
- data/lib/ultracart_api/models/sfvb_item_seo_request.rb +240 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +9 -0
- metadata +19 -1
|
@@ -0,0 +1,295 @@
|
|
|
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 SfvbItemResponse
|
|
18
|
+
# Every attribute a template declares for this item plus every one stored on it, so the list answers what can be set as well as what is set.
|
|
19
|
+
attr_accessor :attributes
|
|
20
|
+
|
|
21
|
+
# What an itemdescription element renders, the item's extended description. Like title this is the catalog's own field rather than a storefront copy of it.
|
|
22
|
+
attr_accessor :description
|
|
23
|
+
|
|
24
|
+
# The page paths this item is assigned to on this storefront. The templates behind those pages are what the attribute and image declarations were reconciled against, so an empty list is why an item can report no declared attributes at all.
|
|
25
|
+
attr_accessor :groups
|
|
26
|
+
|
|
27
|
+
# The item id a storefront carries, and the one data-context-item-id holds.
|
|
28
|
+
attr_accessor :merchant_item_id
|
|
29
|
+
|
|
30
|
+
# The item's internal oid, which appears nowhere on a rendered storefront.
|
|
31
|
+
attr_accessor :merchant_item_oid
|
|
32
|
+
|
|
33
|
+
# Every image slot a template declares plus every image attached to the item.
|
|
34
|
+
attr_accessor :multimedia
|
|
35
|
+
|
|
36
|
+
attr_accessor :seo
|
|
37
|
+
|
|
38
|
+
# What an itemtitle element renders. This is the item's short description in the catalog, not a storefront only field, so changing it changes the item everywhere.
|
|
39
|
+
attr_accessor :title
|
|
40
|
+
|
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
42
|
+
def self.attribute_map
|
|
43
|
+
{
|
|
44
|
+
:'attributes' => :'attributes',
|
|
45
|
+
:'description' => :'description',
|
|
46
|
+
:'groups' => :'groups',
|
|
47
|
+
:'merchant_item_id' => :'merchant_item_id',
|
|
48
|
+
:'merchant_item_oid' => :'merchant_item_oid',
|
|
49
|
+
:'multimedia' => :'multimedia',
|
|
50
|
+
:'seo' => :'seo',
|
|
51
|
+
:'title' => :'title'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Returns all the JSON keys this model knows about
|
|
56
|
+
def self.acceptable_attributes
|
|
57
|
+
attribute_map.values
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute type mapping.
|
|
61
|
+
def self.openapi_types
|
|
62
|
+
{
|
|
63
|
+
:'attributes' => :'Array<SfvbItemAttribute>',
|
|
64
|
+
:'description' => :'String',
|
|
65
|
+
:'groups' => :'Array<String>',
|
|
66
|
+
:'merchant_item_id' => :'String',
|
|
67
|
+
:'merchant_item_oid' => :'Integer',
|
|
68
|
+
:'multimedia' => :'Array<SfvbItemMultimedia>',
|
|
69
|
+
:'seo' => :'SfvbItemSeo',
|
|
70
|
+
:'title' => :'String'
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# List of attributes with nullable: true
|
|
75
|
+
def self.openapi_nullable
|
|
76
|
+
Set.new([
|
|
77
|
+
])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Initializes the object
|
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
82
|
+
def initialize(attributes = {})
|
|
83
|
+
if (!attributes.is_a?(Hash))
|
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemResponse` initialize method"
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
91
|
+
end
|
|
92
|
+
h[k.to_sym] = v
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'attributes')
|
|
96
|
+
if (value = attributes[:'attributes']).is_a?(Array)
|
|
97
|
+
self.attributes = value
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
if attributes.key?(:'description')
|
|
102
|
+
self.description = attributes[:'description']
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if attributes.key?(:'groups')
|
|
106
|
+
if (value = attributes[:'groups']).is_a?(Array)
|
|
107
|
+
self.groups = value
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'merchant_item_id')
|
|
112
|
+
self.merchant_item_id = attributes[:'merchant_item_id']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'merchant_item_oid')
|
|
116
|
+
self.merchant_item_oid = attributes[:'merchant_item_oid']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'multimedia')
|
|
120
|
+
if (value = attributes[:'multimedia']).is_a?(Array)
|
|
121
|
+
self.multimedia = value
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'seo')
|
|
126
|
+
self.seo = attributes[:'seo']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'title')
|
|
130
|
+
self.title = attributes[:'title']
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
135
|
+
# @return Array for valid properties with the reasons
|
|
136
|
+
def list_invalid_properties
|
|
137
|
+
invalid_properties = Array.new
|
|
138
|
+
invalid_properties
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Check to see if the all the properties in the model are valid
|
|
142
|
+
# @return true if the model is valid
|
|
143
|
+
def valid?
|
|
144
|
+
true
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Checks equality by comparing each attribute.
|
|
148
|
+
# @param [Object] Object to be compared
|
|
149
|
+
def ==(o)
|
|
150
|
+
return true if self.equal?(o)
|
|
151
|
+
self.class == o.class &&
|
|
152
|
+
attributes == o.attributes &&
|
|
153
|
+
description == o.description &&
|
|
154
|
+
groups == o.groups &&
|
|
155
|
+
merchant_item_id == o.merchant_item_id &&
|
|
156
|
+
merchant_item_oid == o.merchant_item_oid &&
|
|
157
|
+
multimedia == o.multimedia &&
|
|
158
|
+
seo == o.seo &&
|
|
159
|
+
title == o.title
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# @see the `==` method
|
|
163
|
+
# @param [Object] Object to be compared
|
|
164
|
+
def eql?(o)
|
|
165
|
+
self == o
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Calculates hash code according to all attributes.
|
|
169
|
+
# @return [Integer] Hash code
|
|
170
|
+
def hash
|
|
171
|
+
[attributes, description, groups, merchant_item_id, merchant_item_oid, multimedia, seo, title].hash
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Builds the object from hash
|
|
175
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
176
|
+
# @return [Object] Returns the model itself
|
|
177
|
+
def self.build_from_hash(attributes)
|
|
178
|
+
new.build_from_hash(attributes)
|
|
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 build_from_hash(attributes)
|
|
185
|
+
return nil unless attributes.is_a?(Hash)
|
|
186
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
187
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
188
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
189
|
+
self.send("#{key}=", nil)
|
|
190
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
191
|
+
# check to ensure the input is an array given that the attribute
|
|
192
|
+
# is documented as an array but the input is not
|
|
193
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
194
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
195
|
+
end
|
|
196
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
197
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
self
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Deserializes the data based on type
|
|
205
|
+
# @param string type Data type
|
|
206
|
+
# @param string value Value to be deserialized
|
|
207
|
+
# @return [Object] Deserialized data
|
|
208
|
+
def _deserialize(type, value)
|
|
209
|
+
case type.to_sym
|
|
210
|
+
when :Time
|
|
211
|
+
Time.parse(value)
|
|
212
|
+
when :Date
|
|
213
|
+
Date.parse(value)
|
|
214
|
+
when :String
|
|
215
|
+
value.to_s
|
|
216
|
+
when :Integer
|
|
217
|
+
value.to_i
|
|
218
|
+
when :Float
|
|
219
|
+
value.to_f
|
|
220
|
+
when :Boolean
|
|
221
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
222
|
+
true
|
|
223
|
+
else
|
|
224
|
+
false
|
|
225
|
+
end
|
|
226
|
+
when :Object
|
|
227
|
+
# generic object (usually a Hash), return directly
|
|
228
|
+
value
|
|
229
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
230
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
231
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
232
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
233
|
+
k_type = Regexp.last_match[:k_type]
|
|
234
|
+
v_type = Regexp.last_match[:v_type]
|
|
235
|
+
{}.tap do |hash|
|
|
236
|
+
value.each do |k, v|
|
|
237
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
else # model
|
|
241
|
+
# models (e.g. Pet) or oneOf
|
|
242
|
+
klass = UltracartClient.const_get(type)
|
|
243
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Returns the string representation of the object
|
|
248
|
+
# @return [String] String presentation of the object
|
|
249
|
+
def to_s
|
|
250
|
+
to_hash.to_s
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
|
255
|
+
def to_body
|
|
256
|
+
to_hash
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Returns the object in the form of hash
|
|
260
|
+
# @return [Hash] Returns the object in the form of hash
|
|
261
|
+
def to_hash
|
|
262
|
+
hash = {}
|
|
263
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
264
|
+
value = self.send(attr)
|
|
265
|
+
if value.nil?
|
|
266
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
267
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
hash[param] = _to_hash(value)
|
|
271
|
+
end
|
|
272
|
+
hash
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Outputs non-array value in the form of hash
|
|
276
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
277
|
+
# @param [Object] value Any valid value
|
|
278
|
+
# @return [Hash] Returns the value in the form of hash
|
|
279
|
+
def _to_hash(value)
|
|
280
|
+
if value.is_a?(Array)
|
|
281
|
+
value.compact.map { |v| _to_hash(v) }
|
|
282
|
+
elsif value.is_a?(Hash)
|
|
283
|
+
{}.tap do |hash|
|
|
284
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
285
|
+
end
|
|
286
|
+
elsif value.respond_to? :to_hash
|
|
287
|
+
value.to_hash
|
|
288
|
+
else
|
|
289
|
+
value
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
end
|
|
@@ -0,0 +1,358 @@
|
|
|
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 SfvbItemSeo
|
|
18
|
+
# storefrontSEODescription as stored on this item. Empty when it has never been set.
|
|
19
|
+
attr_accessor :description
|
|
20
|
+
|
|
21
|
+
# Where effective_description comes from.
|
|
22
|
+
attr_accessor :description_source
|
|
23
|
+
|
|
24
|
+
# What the meta description renders as, after the item to page to site fallback.
|
|
25
|
+
attr_accessor :effective_description
|
|
26
|
+
|
|
27
|
+
# What the meta keywords render as, after the item to page to site fallback.
|
|
28
|
+
attr_accessor :effective_keywords
|
|
29
|
+
|
|
30
|
+
# What the document title renders as.
|
|
31
|
+
attr_accessor :effective_title
|
|
32
|
+
|
|
33
|
+
# storefrontSEOKeywords as stored on this item. Empty when it has never been set.
|
|
34
|
+
attr_accessor :keywords
|
|
35
|
+
|
|
36
|
+
# Where effective_keywords comes from.
|
|
37
|
+
attr_accessor :keywords_source
|
|
38
|
+
|
|
39
|
+
# storefrontSEOTitle as stored on this item. Empty when it has never been set.
|
|
40
|
+
attr_accessor :title
|
|
41
|
+
|
|
42
|
+
# Where effective_title comes from. item_description means nothing is set here and the item's own description is being used.
|
|
43
|
+
attr_accessor :title_source
|
|
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
|
+
:'description' => :'description',
|
|
71
|
+
:'description_source' => :'description_source',
|
|
72
|
+
:'effective_description' => :'effective_description',
|
|
73
|
+
:'effective_keywords' => :'effective_keywords',
|
|
74
|
+
:'effective_title' => :'effective_title',
|
|
75
|
+
:'keywords' => :'keywords',
|
|
76
|
+
:'keywords_source' => :'keywords_source',
|
|
77
|
+
:'title' => :'title',
|
|
78
|
+
:'title_source' => :'title_source'
|
|
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
|
+
:'description' => :'String',
|
|
91
|
+
:'description_source' => :'String',
|
|
92
|
+
:'effective_description' => :'String',
|
|
93
|
+
:'effective_keywords' => :'String',
|
|
94
|
+
:'effective_title' => :'String',
|
|
95
|
+
:'keywords' => :'String',
|
|
96
|
+
:'keywords_source' => :'String',
|
|
97
|
+
:'title' => :'String',
|
|
98
|
+
:'title_source' => :'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::SfvbItemSeo` 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::SfvbItemSeo`. 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?(:'description')
|
|
124
|
+
self.description = attributes[:'description']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'description_source')
|
|
128
|
+
self.description_source = attributes[:'description_source']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'effective_description')
|
|
132
|
+
self.effective_description = attributes[:'effective_description']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'effective_keywords')
|
|
136
|
+
self.effective_keywords = attributes[:'effective_keywords']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'effective_title')
|
|
140
|
+
self.effective_title = attributes[:'effective_title']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'keywords')
|
|
144
|
+
self.keywords = attributes[:'keywords']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'keywords_source')
|
|
148
|
+
self.keywords_source = attributes[:'keywords_source']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'title')
|
|
152
|
+
self.title = attributes[:'title']
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
if attributes.key?(:'title_source')
|
|
156
|
+
self.title_source = attributes[:'title_source']
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
161
|
+
# @return Array for valid properties with the reasons
|
|
162
|
+
def list_invalid_properties
|
|
163
|
+
invalid_properties = Array.new
|
|
164
|
+
invalid_properties
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Check to see if the all the properties in the model are valid
|
|
168
|
+
# @return true if the model is valid
|
|
169
|
+
def valid?
|
|
170
|
+
description_source_validator = EnumAttributeValidator.new('String', ["item", "group", "site", "none"])
|
|
171
|
+
return false unless description_source_validator.valid?(@description_source)
|
|
172
|
+
keywords_source_validator = EnumAttributeValidator.new('String', ["item", "group", "site", "none"])
|
|
173
|
+
return false unless keywords_source_validator.valid?(@keywords_source)
|
|
174
|
+
title_source_validator = EnumAttributeValidator.new('String', ["item", "item_description", "none"])
|
|
175
|
+
return false unless title_source_validator.valid?(@title_source)
|
|
176
|
+
true
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
180
|
+
# @param [Object] description_source Object to be assigned
|
|
181
|
+
def description_source=(description_source)
|
|
182
|
+
validator = EnumAttributeValidator.new('String', ["item", "group", "site", "none"])
|
|
183
|
+
unless validator.valid?(description_source)
|
|
184
|
+
fail ArgumentError, "invalid value for \"description_source\", must be one of #{validator.allowable_values}."
|
|
185
|
+
end
|
|
186
|
+
@description_source = description_source
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
190
|
+
# @param [Object] keywords_source Object to be assigned
|
|
191
|
+
def keywords_source=(keywords_source)
|
|
192
|
+
validator = EnumAttributeValidator.new('String', ["item", "group", "site", "none"])
|
|
193
|
+
unless validator.valid?(keywords_source)
|
|
194
|
+
fail ArgumentError, "invalid value for \"keywords_source\", must be one of #{validator.allowable_values}."
|
|
195
|
+
end
|
|
196
|
+
@keywords_source = keywords_source
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
200
|
+
# @param [Object] title_source Object to be assigned
|
|
201
|
+
def title_source=(title_source)
|
|
202
|
+
validator = EnumAttributeValidator.new('String', ["item", "item_description", "none"])
|
|
203
|
+
unless validator.valid?(title_source)
|
|
204
|
+
fail ArgumentError, "invalid value for \"title_source\", must be one of #{validator.allowable_values}."
|
|
205
|
+
end
|
|
206
|
+
@title_source = title_source
|
|
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
|
+
description == o.description &&
|
|
215
|
+
description_source == o.description_source &&
|
|
216
|
+
effective_description == o.effective_description &&
|
|
217
|
+
effective_keywords == o.effective_keywords &&
|
|
218
|
+
effective_title == o.effective_title &&
|
|
219
|
+
keywords == o.keywords &&
|
|
220
|
+
keywords_source == o.keywords_source &&
|
|
221
|
+
title == o.title &&
|
|
222
|
+
title_source == o.title_source
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# @see the `==` method
|
|
226
|
+
# @param [Object] Object to be compared
|
|
227
|
+
def eql?(o)
|
|
228
|
+
self == o
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Calculates hash code according to all attributes.
|
|
232
|
+
# @return [Integer] Hash code
|
|
233
|
+
def hash
|
|
234
|
+
[description, description_source, effective_description, effective_keywords, effective_title, keywords, keywords_source, title, title_source].hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Builds the object from hash
|
|
238
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
239
|
+
# @return [Object] Returns the model itself
|
|
240
|
+
def self.build_from_hash(attributes)
|
|
241
|
+
new.build_from_hash(attributes)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Builds the object from hash
|
|
245
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
246
|
+
# @return [Object] Returns the model itself
|
|
247
|
+
def build_from_hash(attributes)
|
|
248
|
+
return nil unless attributes.is_a?(Hash)
|
|
249
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
250
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
251
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
252
|
+
self.send("#{key}=", nil)
|
|
253
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
254
|
+
# check to ensure the input is an array given that the attribute
|
|
255
|
+
# is documented as an array but the input is not
|
|
256
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
257
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
258
|
+
end
|
|
259
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
260
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
self
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# Deserializes the data based on type
|
|
268
|
+
# @param string type Data type
|
|
269
|
+
# @param string value Value to be deserialized
|
|
270
|
+
# @return [Object] Deserialized data
|
|
271
|
+
def _deserialize(type, value)
|
|
272
|
+
case type.to_sym
|
|
273
|
+
when :Time
|
|
274
|
+
Time.parse(value)
|
|
275
|
+
when :Date
|
|
276
|
+
Date.parse(value)
|
|
277
|
+
when :String
|
|
278
|
+
value.to_s
|
|
279
|
+
when :Integer
|
|
280
|
+
value.to_i
|
|
281
|
+
when :Float
|
|
282
|
+
value.to_f
|
|
283
|
+
when :Boolean
|
|
284
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
285
|
+
true
|
|
286
|
+
else
|
|
287
|
+
false
|
|
288
|
+
end
|
|
289
|
+
when :Object
|
|
290
|
+
# generic object (usually a Hash), return directly
|
|
291
|
+
value
|
|
292
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
293
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
294
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
295
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
296
|
+
k_type = Regexp.last_match[:k_type]
|
|
297
|
+
v_type = Regexp.last_match[:v_type]
|
|
298
|
+
{}.tap do |hash|
|
|
299
|
+
value.each do |k, v|
|
|
300
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
else # model
|
|
304
|
+
# models (e.g. Pet) or oneOf
|
|
305
|
+
klass = UltracartClient.const_get(type)
|
|
306
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Returns the string representation of the object
|
|
311
|
+
# @return [String] String presentation of the object
|
|
312
|
+
def to_s
|
|
313
|
+
to_hash.to_s
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
317
|
+
# @return [Hash] Returns the object in the form of hash
|
|
318
|
+
def to_body
|
|
319
|
+
to_hash
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Returns the object in the form of hash
|
|
323
|
+
# @return [Hash] Returns the object in the form of hash
|
|
324
|
+
def to_hash
|
|
325
|
+
hash = {}
|
|
326
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
327
|
+
value = self.send(attr)
|
|
328
|
+
if value.nil?
|
|
329
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
330
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
hash[param] = _to_hash(value)
|
|
334
|
+
end
|
|
335
|
+
hash
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# Outputs non-array value in the form of hash
|
|
339
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
340
|
+
# @param [Object] value Any valid value
|
|
341
|
+
# @return [Hash] Returns the value in the form of hash
|
|
342
|
+
def _to_hash(value)
|
|
343
|
+
if value.is_a?(Array)
|
|
344
|
+
value.compact.map { |v| _to_hash(v) }
|
|
345
|
+
elsif value.is_a?(Hash)
|
|
346
|
+
{}.tap do |hash|
|
|
347
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
348
|
+
end
|
|
349
|
+
elsif value.respond_to? :to_hash
|
|
350
|
+
value.to_hash
|
|
351
|
+
else
|
|
352
|
+
value
|
|
353
|
+
end
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
end
|