ultracart_api 4.1.155 → 4.1.156
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 +10 -2
- data/docs/SfvbApi.md +166 -0
- data/docs/SfvbMenu.md +30 -0
- data/docs/SfvbMenuItem.md +36 -0
- data/docs/SfvbMenuWriteRequest.md +20 -0
- data/docs/SfvbMenusResponse.md +18 -0
- data/docs/SfvbPreviewAccessResponse.md +1 -1
- data/docs/SfvbVersionResponse.md +4 -0
- data/lib/ultracart_api/api/sfvb_api.rb +218 -0
- data/lib/ultracart_api/models/sfvb_menu.rb +282 -0
- data/lib/ultracart_api/models/sfvb_menu_item.rb +370 -0
- data/lib/ultracart_api/models/sfvb_menu_write_request.rb +232 -0
- data/lib/ultracart_api/models/sfvb_menus_response.rb +222 -0
- data/lib/ultracart_api/models/sfvb_preview_access_response.rb +1 -1
- data/lib/ultracart_api/models/sfvb_version_response.rb +21 -1
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +4 -0
- metadata +10 -2
|
@@ -0,0 +1,282 @@
|
|
|
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 SfvbMenu
|
|
18
|
+
# The menu's code, which is the value a menu element's menuName refers to. Compare case insensitively.
|
|
19
|
+
attr_accessor :code
|
|
20
|
+
|
|
21
|
+
# Content hash of the menu as stored. Send it back as If-Match when writing.
|
|
22
|
+
attr_accessor :hash_sha256
|
|
23
|
+
|
|
24
|
+
# How many entries the menu holds in total, counting every level of the tree.
|
|
25
|
+
attr_accessor :item_count
|
|
26
|
+
|
|
27
|
+
# The menu's entries, in the order they render. Omitted from the list endpoint, which returns each menu's identity and counts only.
|
|
28
|
+
attr_accessor :items
|
|
29
|
+
|
|
30
|
+
# The menu's own label, shown in the store admin rather than on the storefront. Trimmed to 250 characters.
|
|
31
|
+
attr_accessor :title
|
|
32
|
+
|
|
33
|
+
# True when a template names this code but no menu has been created for it. Such a code renders an empty list today. Write it to create it.
|
|
34
|
+
attr_accessor :unconfigured
|
|
35
|
+
|
|
36
|
+
# True when no template on the storefront names this code. The menu is stored and editable, but nothing renders it, which usually means a menu element's menuName is misspelled.
|
|
37
|
+
attr_accessor :undeclared
|
|
38
|
+
|
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
40
|
+
def self.attribute_map
|
|
41
|
+
{
|
|
42
|
+
:'code' => :'code',
|
|
43
|
+
:'hash_sha256' => :'hash_sha256',
|
|
44
|
+
:'item_count' => :'item_count',
|
|
45
|
+
:'items' => :'items',
|
|
46
|
+
:'title' => :'title',
|
|
47
|
+
:'unconfigured' => :'unconfigured',
|
|
48
|
+
:'undeclared' => :'undeclared'
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Returns all the JSON keys this model knows about
|
|
53
|
+
def self.acceptable_attributes
|
|
54
|
+
attribute_map.values
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Attribute type mapping.
|
|
58
|
+
def self.openapi_types
|
|
59
|
+
{
|
|
60
|
+
:'code' => :'String',
|
|
61
|
+
:'hash_sha256' => :'String',
|
|
62
|
+
:'item_count' => :'Integer',
|
|
63
|
+
:'items' => :'Array<SfvbMenuItem>',
|
|
64
|
+
:'title' => :'String',
|
|
65
|
+
:'unconfigured' => :'Boolean',
|
|
66
|
+
:'undeclared' => :'Boolean'
|
|
67
|
+
}
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# List of attributes with nullable: true
|
|
71
|
+
def self.openapi_nullable
|
|
72
|
+
Set.new([
|
|
73
|
+
])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Initializes the object
|
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
+
def initialize(attributes = {})
|
|
79
|
+
if (!attributes.is_a?(Hash))
|
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbMenu` initialize method"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbMenu`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
87
|
+
end
|
|
88
|
+
h[k.to_sym] = v
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'code')
|
|
92
|
+
self.code = attributes[:'code']
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'hash_sha256')
|
|
96
|
+
self.hash_sha256 = attributes[:'hash_sha256']
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if attributes.key?(:'item_count')
|
|
100
|
+
self.item_count = attributes[:'item_count']
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
if attributes.key?(:'items')
|
|
104
|
+
if (value = attributes[:'items']).is_a?(Array)
|
|
105
|
+
self.items = value
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
if attributes.key?(:'title')
|
|
110
|
+
self.title = attributes[:'title']
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
if attributes.key?(:'unconfigured')
|
|
114
|
+
self.unconfigured = attributes[:'unconfigured']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
if attributes.key?(:'undeclared')
|
|
118
|
+
self.undeclared = attributes[:'undeclared']
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
123
|
+
# @return Array for valid properties with the reasons
|
|
124
|
+
def list_invalid_properties
|
|
125
|
+
invalid_properties = Array.new
|
|
126
|
+
invalid_properties
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Check to see if the all the properties in the model are valid
|
|
130
|
+
# @return true if the model is valid
|
|
131
|
+
def valid?
|
|
132
|
+
true
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Checks equality by comparing each attribute.
|
|
136
|
+
# @param [Object] Object to be compared
|
|
137
|
+
def ==(o)
|
|
138
|
+
return true if self.equal?(o)
|
|
139
|
+
self.class == o.class &&
|
|
140
|
+
code == o.code &&
|
|
141
|
+
hash_sha256 == o.hash_sha256 &&
|
|
142
|
+
item_count == o.item_count &&
|
|
143
|
+
items == o.items &&
|
|
144
|
+
title == o.title &&
|
|
145
|
+
unconfigured == o.unconfigured &&
|
|
146
|
+
undeclared == o.undeclared
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# @see the `==` method
|
|
150
|
+
# @param [Object] Object to be compared
|
|
151
|
+
def eql?(o)
|
|
152
|
+
self == o
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Calculates hash code according to all attributes.
|
|
156
|
+
# @return [Integer] Hash code
|
|
157
|
+
def hash
|
|
158
|
+
[code, hash_sha256, item_count, items, title, unconfigured, undeclared].hash
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Builds the object from hash
|
|
162
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
163
|
+
# @return [Object] Returns the model itself
|
|
164
|
+
def self.build_from_hash(attributes)
|
|
165
|
+
new.build_from_hash(attributes)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Builds the object from hash
|
|
169
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
170
|
+
# @return [Object] Returns the model itself
|
|
171
|
+
def build_from_hash(attributes)
|
|
172
|
+
return nil unless attributes.is_a?(Hash)
|
|
173
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
174
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
175
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
176
|
+
self.send("#{key}=", nil)
|
|
177
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
178
|
+
# check to ensure the input is an array given that the attribute
|
|
179
|
+
# is documented as an array but the input is not
|
|
180
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
181
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
182
|
+
end
|
|
183
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
184
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
self
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Deserializes the data based on type
|
|
192
|
+
# @param string type Data type
|
|
193
|
+
# @param string value Value to be deserialized
|
|
194
|
+
# @return [Object] Deserialized data
|
|
195
|
+
def _deserialize(type, value)
|
|
196
|
+
case type.to_sym
|
|
197
|
+
when :Time
|
|
198
|
+
Time.parse(value)
|
|
199
|
+
when :Date
|
|
200
|
+
Date.parse(value)
|
|
201
|
+
when :String
|
|
202
|
+
value.to_s
|
|
203
|
+
when :Integer
|
|
204
|
+
value.to_i
|
|
205
|
+
when :Float
|
|
206
|
+
value.to_f
|
|
207
|
+
when :Boolean
|
|
208
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
209
|
+
true
|
|
210
|
+
else
|
|
211
|
+
false
|
|
212
|
+
end
|
|
213
|
+
when :Object
|
|
214
|
+
# generic object (usually a Hash), return directly
|
|
215
|
+
value
|
|
216
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
217
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
218
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
219
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
220
|
+
k_type = Regexp.last_match[:k_type]
|
|
221
|
+
v_type = Regexp.last_match[:v_type]
|
|
222
|
+
{}.tap do |hash|
|
|
223
|
+
value.each do |k, v|
|
|
224
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
else # model
|
|
228
|
+
# models (e.g. Pet) or oneOf
|
|
229
|
+
klass = UltracartClient.const_get(type)
|
|
230
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Returns the string representation of the object
|
|
235
|
+
# @return [String] String presentation of the object
|
|
236
|
+
def to_s
|
|
237
|
+
to_hash.to_s
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
|
242
|
+
def to_body
|
|
243
|
+
to_hash
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Returns the object in the form of hash
|
|
247
|
+
# @return [Hash] Returns the object in the form of hash
|
|
248
|
+
def to_hash
|
|
249
|
+
hash = {}
|
|
250
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
251
|
+
value = self.send(attr)
|
|
252
|
+
if value.nil?
|
|
253
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
254
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
hash[param] = _to_hash(value)
|
|
258
|
+
end
|
|
259
|
+
hash
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# Outputs non-array value in the form of hash
|
|
263
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
264
|
+
# @param [Object] value Any valid value
|
|
265
|
+
# @return [Hash] Returns the value in the form of hash
|
|
266
|
+
def _to_hash(value)
|
|
267
|
+
if value.is_a?(Array)
|
|
268
|
+
value.compact.map { |v| _to_hash(v) }
|
|
269
|
+
elsif value.is_a?(Hash)
|
|
270
|
+
{}.tap do |hash|
|
|
271
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
272
|
+
end
|
|
273
|
+
elsif value.respond_to? :to_hash
|
|
274
|
+
value.to_hash
|
|
275
|
+
else
|
|
276
|
+
value
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
end
|
|
@@ -0,0 +1,370 @@
|
|
|
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 SfvbMenuItem
|
|
18
|
+
# The catalog group page_path resolved to. Returned for reference and ignored on a write - send page_path, which is the identifier the rest of this API uses.
|
|
19
|
+
attr_accessor :catalog_group_oid
|
|
20
|
+
|
|
21
|
+
# The link text, and the only field every type needs. Required.
|
|
22
|
+
attr_accessor :description
|
|
23
|
+
|
|
24
|
+
# This entry's sub menu, in the order it renders. Omit or send an empty array for a leaf.
|
|
25
|
+
attr_accessor :items
|
|
26
|
+
|
|
27
|
+
# The item an item entry opens, by merchant item id rather than by oid.
|
|
28
|
+
attr_accessor :merchant_item_id
|
|
29
|
+
|
|
30
|
+
# True to open the link in a new window or tab.
|
|
31
|
+
attr_accessor :open_in_new_window
|
|
32
|
+
|
|
33
|
+
# The page a page entry opens, normalized to begin and end with a slash. This is the same path the pages endpoints take. Sent on a write and returned on a read.
|
|
34
|
+
attr_accessor :page_path
|
|
35
|
+
|
|
36
|
+
# Which social network a social entry opens. The URL comes from the storefront's social settings.
|
|
37
|
+
attr_accessor :social_page_type
|
|
38
|
+
|
|
39
|
+
# Which built in page a system page entry opens. The storefront resolves the URL, so these keep working when the checkout or account paths change.
|
|
40
|
+
attr_accessor :system_page_type
|
|
41
|
+
|
|
42
|
+
# What the entry points at, which decides which one of the other fields is required. custom needs url, item needs merchant_item_id, page needs page_path, social needs social_page_type, and system page needs system_page_type. The legacy spelling group is accepted and stored as page.
|
|
43
|
+
attr_accessor :type
|
|
44
|
+
|
|
45
|
+
# Where a custom entry goes. Any URL the storefront can link to, absolute or site relative.
|
|
46
|
+
attr_accessor :url
|
|
47
|
+
|
|
48
|
+
class EnumAttributeValidator
|
|
49
|
+
attr_reader :datatype
|
|
50
|
+
attr_reader :allowable_values
|
|
51
|
+
|
|
52
|
+
def initialize(datatype, allowable_values)
|
|
53
|
+
@allowable_values = allowable_values.map do |value|
|
|
54
|
+
case datatype.to_s
|
|
55
|
+
when /Integer/i
|
|
56
|
+
value.to_i
|
|
57
|
+
when /Float/i
|
|
58
|
+
value.to_f
|
|
59
|
+
else
|
|
60
|
+
value
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def valid?(value)
|
|
66
|
+
!value || allowable_values.include?(value)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
71
|
+
def self.attribute_map
|
|
72
|
+
{
|
|
73
|
+
:'catalog_group_oid' => :'catalog_group_oid',
|
|
74
|
+
:'description' => :'description',
|
|
75
|
+
:'items' => :'items',
|
|
76
|
+
:'merchant_item_id' => :'merchant_item_id',
|
|
77
|
+
:'open_in_new_window' => :'open_in_new_window',
|
|
78
|
+
:'page_path' => :'page_path',
|
|
79
|
+
:'social_page_type' => :'social_page_type',
|
|
80
|
+
:'system_page_type' => :'system_page_type',
|
|
81
|
+
:'type' => :'type',
|
|
82
|
+
:'url' => :'url'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Returns all the JSON keys this model knows about
|
|
87
|
+
def self.acceptable_attributes
|
|
88
|
+
attribute_map.values
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Attribute type mapping.
|
|
92
|
+
def self.openapi_types
|
|
93
|
+
{
|
|
94
|
+
:'catalog_group_oid' => :'Integer',
|
|
95
|
+
:'description' => :'String',
|
|
96
|
+
:'items' => :'Array<SfvbMenuItem>',
|
|
97
|
+
:'merchant_item_id' => :'String',
|
|
98
|
+
:'open_in_new_window' => :'Boolean',
|
|
99
|
+
:'page_path' => :'String',
|
|
100
|
+
:'social_page_type' => :'String',
|
|
101
|
+
:'system_page_type' => :'String',
|
|
102
|
+
:'type' => :'String',
|
|
103
|
+
:'url' => :'String'
|
|
104
|
+
}
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# List of attributes with nullable: true
|
|
108
|
+
def self.openapi_nullable
|
|
109
|
+
Set.new([
|
|
110
|
+
])
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Initializes the object
|
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
115
|
+
def initialize(attributes = {})
|
|
116
|
+
if (!attributes.is_a?(Hash))
|
|
117
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbMenuItem` initialize method"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
121
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
122
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
123
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbMenuItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
124
|
+
end
|
|
125
|
+
h[k.to_sym] = v
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'catalog_group_oid')
|
|
129
|
+
self.catalog_group_oid = attributes[:'catalog_group_oid']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'description')
|
|
133
|
+
self.description = attributes[:'description']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'items')
|
|
137
|
+
if (value = attributes[:'items']).is_a?(Array)
|
|
138
|
+
self.items = value
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if attributes.key?(:'merchant_item_id')
|
|
143
|
+
self.merchant_item_id = attributes[:'merchant_item_id']
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if attributes.key?(:'open_in_new_window')
|
|
147
|
+
self.open_in_new_window = attributes[:'open_in_new_window']
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if attributes.key?(:'page_path')
|
|
151
|
+
self.page_path = attributes[:'page_path']
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if attributes.key?(:'social_page_type')
|
|
155
|
+
self.social_page_type = attributes[:'social_page_type']
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if attributes.key?(:'system_page_type')
|
|
159
|
+
self.system_page_type = attributes[:'system_page_type']
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if attributes.key?(:'type')
|
|
163
|
+
self.type = attributes[:'type']
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if attributes.key?(:'url')
|
|
167
|
+
self.url = attributes[:'url']
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
172
|
+
# @return Array for valid properties with the reasons
|
|
173
|
+
def list_invalid_properties
|
|
174
|
+
invalid_properties = Array.new
|
|
175
|
+
invalid_properties
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Check to see if the all the properties in the model are valid
|
|
179
|
+
# @return true if the model is valid
|
|
180
|
+
def valid?
|
|
181
|
+
social_page_type_validator = EnumAttributeValidator.new('String', ["Twitter", "Facebook", "Instagram", "LinkedIn", "Pinterest", "Tumblr", "YouTube"])
|
|
182
|
+
return false unless social_page_type_validator.valid?(@social_page_type)
|
|
183
|
+
system_page_type_validator = EnumAttributeValidator.new('String', ["Access Account", "Account Login", "Account Logout", "Affiliate Login", "Affiliate Signup", "Change Password", "My Account Main Page", "My Account Orders", "My Account Reviews", "My Account Settings", "My Account Loyalty", "Search", "Single Page Checkout", "View Cart", "Wholesale Signup"])
|
|
184
|
+
return false unless system_page_type_validator.valid?(@system_page_type)
|
|
185
|
+
type_validator = EnumAttributeValidator.new('String', ["custom", "item", "page", "social", "system page"])
|
|
186
|
+
return false unless type_validator.valid?(@type)
|
|
187
|
+
true
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
191
|
+
# @param [Object] social_page_type Object to be assigned
|
|
192
|
+
def social_page_type=(social_page_type)
|
|
193
|
+
validator = EnumAttributeValidator.new('String', ["Twitter", "Facebook", "Instagram", "LinkedIn", "Pinterest", "Tumblr", "YouTube"])
|
|
194
|
+
unless validator.valid?(social_page_type)
|
|
195
|
+
fail ArgumentError, "invalid value for \"social_page_type\", must be one of #{validator.allowable_values}."
|
|
196
|
+
end
|
|
197
|
+
@social_page_type = social_page_type
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
201
|
+
# @param [Object] system_page_type Object to be assigned
|
|
202
|
+
def system_page_type=(system_page_type)
|
|
203
|
+
validator = EnumAttributeValidator.new('String', ["Access Account", "Account Login", "Account Logout", "Affiliate Login", "Affiliate Signup", "Change Password", "My Account Main Page", "My Account Orders", "My Account Reviews", "My Account Settings", "My Account Loyalty", "Search", "Single Page Checkout", "View Cart", "Wholesale Signup"])
|
|
204
|
+
unless validator.valid?(system_page_type)
|
|
205
|
+
fail ArgumentError, "invalid value for \"system_page_type\", must be one of #{validator.allowable_values}."
|
|
206
|
+
end
|
|
207
|
+
@system_page_type = system_page_type
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
211
|
+
# @param [Object] type Object to be assigned
|
|
212
|
+
def type=(type)
|
|
213
|
+
validator = EnumAttributeValidator.new('String', ["custom", "item", "page", "social", "system page"])
|
|
214
|
+
unless validator.valid?(type)
|
|
215
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
|
216
|
+
end
|
|
217
|
+
@type = type
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# Checks equality by comparing each attribute.
|
|
221
|
+
# @param [Object] Object to be compared
|
|
222
|
+
def ==(o)
|
|
223
|
+
return true if self.equal?(o)
|
|
224
|
+
self.class == o.class &&
|
|
225
|
+
catalog_group_oid == o.catalog_group_oid &&
|
|
226
|
+
description == o.description &&
|
|
227
|
+
items == o.items &&
|
|
228
|
+
merchant_item_id == o.merchant_item_id &&
|
|
229
|
+
open_in_new_window == o.open_in_new_window &&
|
|
230
|
+
page_path == o.page_path &&
|
|
231
|
+
social_page_type == o.social_page_type &&
|
|
232
|
+
system_page_type == o.system_page_type &&
|
|
233
|
+
type == o.type &&
|
|
234
|
+
url == o.url
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# @see the `==` method
|
|
238
|
+
# @param [Object] Object to be compared
|
|
239
|
+
def eql?(o)
|
|
240
|
+
self == o
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
# Calculates hash code according to all attributes.
|
|
244
|
+
# @return [Integer] Hash code
|
|
245
|
+
def hash
|
|
246
|
+
[catalog_group_oid, description, items, merchant_item_id, open_in_new_window, page_path, social_page_type, system_page_type, type, url].hash
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
# Builds the object from hash
|
|
250
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
251
|
+
# @return [Object] Returns the model itself
|
|
252
|
+
def self.build_from_hash(attributes)
|
|
253
|
+
new.build_from_hash(attributes)
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Builds the object from hash
|
|
257
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
258
|
+
# @return [Object] Returns the model itself
|
|
259
|
+
def build_from_hash(attributes)
|
|
260
|
+
return nil unless attributes.is_a?(Hash)
|
|
261
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
262
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
263
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
264
|
+
self.send("#{key}=", nil)
|
|
265
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
266
|
+
# check to ensure the input is an array given that the attribute
|
|
267
|
+
# is documented as an array but the input is not
|
|
268
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
269
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
270
|
+
end
|
|
271
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
272
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
self
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Deserializes the data based on type
|
|
280
|
+
# @param string type Data type
|
|
281
|
+
# @param string value Value to be deserialized
|
|
282
|
+
# @return [Object] Deserialized data
|
|
283
|
+
def _deserialize(type, value)
|
|
284
|
+
case type.to_sym
|
|
285
|
+
when :Time
|
|
286
|
+
Time.parse(value)
|
|
287
|
+
when :Date
|
|
288
|
+
Date.parse(value)
|
|
289
|
+
when :String
|
|
290
|
+
value.to_s
|
|
291
|
+
when :Integer
|
|
292
|
+
value.to_i
|
|
293
|
+
when :Float
|
|
294
|
+
value.to_f
|
|
295
|
+
when :Boolean
|
|
296
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
297
|
+
true
|
|
298
|
+
else
|
|
299
|
+
false
|
|
300
|
+
end
|
|
301
|
+
when :Object
|
|
302
|
+
# generic object (usually a Hash), return directly
|
|
303
|
+
value
|
|
304
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
305
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
306
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
307
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
308
|
+
k_type = Regexp.last_match[:k_type]
|
|
309
|
+
v_type = Regexp.last_match[:v_type]
|
|
310
|
+
{}.tap do |hash|
|
|
311
|
+
value.each do |k, v|
|
|
312
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
else # model
|
|
316
|
+
# models (e.g. Pet) or oneOf
|
|
317
|
+
klass = UltracartClient.const_get(type)
|
|
318
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
# Returns the string representation of the object
|
|
323
|
+
# @return [String] String presentation of the object
|
|
324
|
+
def to_s
|
|
325
|
+
to_hash.to_s
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
329
|
+
# @return [Hash] Returns the object in the form of hash
|
|
330
|
+
def to_body
|
|
331
|
+
to_hash
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
# Returns the object in the form of hash
|
|
335
|
+
# @return [Hash] Returns the object in the form of hash
|
|
336
|
+
def to_hash
|
|
337
|
+
hash = {}
|
|
338
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
339
|
+
value = self.send(attr)
|
|
340
|
+
if value.nil?
|
|
341
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
342
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
hash[param] = _to_hash(value)
|
|
346
|
+
end
|
|
347
|
+
hash
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
# Outputs non-array value in the form of hash
|
|
351
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
352
|
+
# @param [Object] value Any valid value
|
|
353
|
+
# @return [Hash] Returns the value in the form of hash
|
|
354
|
+
def _to_hash(value)
|
|
355
|
+
if value.is_a?(Array)
|
|
356
|
+
value.compact.map { |v| _to_hash(v) }
|
|
357
|
+
elsif value.is_a?(Hash)
|
|
358
|
+
{}.tap do |hash|
|
|
359
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
360
|
+
end
|
|
361
|
+
elsif value.respond_to? :to_hash
|
|
362
|
+
value.to_hash
|
|
363
|
+
else
|
|
364
|
+
value
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
end
|