ultracart_api 4.1.170 → 4.1.171
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 +29 -2
- data/docs/SfvbApi.md +890 -37
- data/docs/SfvbPageResponse.md +2 -0
- data/docs/SfvbUpsellItemLogic.md +24 -0
- data/docs/SfvbUpsellItemLogicItem.md +22 -0
- data/docs/SfvbUpsellOffer.md +118 -8
- data/docs/SfvbUpsellPath.md +48 -0
- data/docs/SfvbUpsellPathDuplicateRequest.md +18 -0
- data/docs/SfvbUpsellPathMoveRequest.md +18 -0
- data/docs/SfvbUpsellPathsResponse.md +28 -0
- data/docs/SfvbUpsellStats.md +54 -0
- data/docs/SfvbUpsellStep.md +22 -0
- data/docs/SfvbUpsellStepOffer.md +32 -0
- data/docs/SfvbUpsellTowerData.md +20 -0
- data/docs/SfvbUpsellVariation.md +22 -0
- data/lib/ultracart_api/api/sfvb_api.rb +1256 -78
- data/lib/ultracart_api/models/sfvb_page_response.rb +11 -1
- data/lib/ultracart_api/models/sfvb_upsell_item_logic.rb +252 -0
- data/lib/ultracart_api/models/sfvb_upsell_item_logic_item.rb +240 -0
- data/lib/ultracart_api/models/sfvb_upsell_offer.rb +598 -9
- data/lib/ultracart_api/models/sfvb_upsell_path.rb +373 -0
- data/lib/ultracart_api/models/sfvb_upsell_path_duplicate_request.rb +220 -0
- data/lib/ultracart_api/models/sfvb_upsell_path_move_request.rb +220 -0
- data/lib/ultracart_api/models/sfvb_upsell_paths_response.rb +272 -0
- data/lib/ultracart_api/models/sfvb_upsell_stats.rb +400 -0
- data/lib/ultracart_api/models/sfvb_upsell_step.rb +241 -0
- data/lib/ultracart_api/models/sfvb_upsell_step_offer.rb +288 -0
- data/lib/ultracart_api/models/sfvb_upsell_tower_data.rb +234 -0
- data/lib/ultracart_api/models/sfvb_upsell_variation.rb +241 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +11 -0
- metadata +24 -2
|
@@ -0,0 +1,373 @@
|
|
|
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 SfvbUpsellPath
|
|
18
|
+
# Whether the path runs. Setting it true, or changing a path that is active, needs the sfvb_publish scope.
|
|
19
|
+
attr_accessor :active
|
|
20
|
+
|
|
21
|
+
# Read only here. Filed out of the default list. Change it with the archive and unarchive calls.
|
|
22
|
+
attr_accessor :archived
|
|
23
|
+
|
|
24
|
+
# Which customers the path runs for. all (the default), new or existing.
|
|
25
|
+
attr_accessor :customer_type
|
|
26
|
+
|
|
27
|
+
# Read only. Hash of the path's writable fields. Send it in If-Match on an update.
|
|
28
|
+
attr_accessor :hash_sha256
|
|
29
|
+
|
|
30
|
+
attr_accessor :item_logic_suppression
|
|
31
|
+
|
|
32
|
+
attr_accessor :item_logic_trigger
|
|
33
|
+
|
|
34
|
+
# Where in checkout the path runs. pre checkout or post checkout (the default).
|
|
35
|
+
attr_accessor :location
|
|
36
|
+
|
|
37
|
+
# Most offers one shopper is shown on this path. Omitted or null for no limit.
|
|
38
|
+
attr_accessor :maximum_offers
|
|
39
|
+
|
|
40
|
+
# Path name, at most 100 characters.
|
|
41
|
+
attr_accessor :name
|
|
42
|
+
|
|
43
|
+
# Read only here. Position among this storefront's paths, first to last. Change it with the move call.
|
|
44
|
+
attr_accessor :path_order
|
|
45
|
+
|
|
46
|
+
# cascading (the default) or single.
|
|
47
|
+
attr_accessor :path_type
|
|
48
|
+
|
|
49
|
+
attr_accessor :towerdata_trigger
|
|
50
|
+
|
|
51
|
+
# Read only. The legacy flat trigger list, derived from item_logic_trigger when its logic is contains_any and empty otherwise.
|
|
52
|
+
attr_accessor :trigger_item_ids
|
|
53
|
+
|
|
54
|
+
# Customer tags that trigger the path.
|
|
55
|
+
attr_accessor :trigger_tags
|
|
56
|
+
|
|
57
|
+
# Read only. Upsell path oid.
|
|
58
|
+
attr_accessor :upsell_path_oid
|
|
59
|
+
|
|
60
|
+
# The variations shoppers are split between. At least one.
|
|
61
|
+
attr_accessor :variations
|
|
62
|
+
|
|
63
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
64
|
+
def self.attribute_map
|
|
65
|
+
{
|
|
66
|
+
:'active' => :'active',
|
|
67
|
+
:'archived' => :'archived',
|
|
68
|
+
:'customer_type' => :'customer_type',
|
|
69
|
+
:'hash_sha256' => :'hash_sha256',
|
|
70
|
+
:'item_logic_suppression' => :'item_logic_suppression',
|
|
71
|
+
:'item_logic_trigger' => :'item_logic_trigger',
|
|
72
|
+
:'location' => :'location',
|
|
73
|
+
:'maximum_offers' => :'maximum_offers',
|
|
74
|
+
:'name' => :'name',
|
|
75
|
+
:'path_order' => :'path_order',
|
|
76
|
+
:'path_type' => :'path_type',
|
|
77
|
+
:'towerdata_trigger' => :'towerdata_trigger',
|
|
78
|
+
:'trigger_item_ids' => :'trigger_item_ids',
|
|
79
|
+
:'trigger_tags' => :'trigger_tags',
|
|
80
|
+
:'upsell_path_oid' => :'upsell_path_oid',
|
|
81
|
+
:'variations' => :'variations'
|
|
82
|
+
}
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Returns all the JSON keys this model knows about
|
|
86
|
+
def self.acceptable_attributes
|
|
87
|
+
attribute_map.values
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Attribute type mapping.
|
|
91
|
+
def self.openapi_types
|
|
92
|
+
{
|
|
93
|
+
:'active' => :'Boolean',
|
|
94
|
+
:'archived' => :'Boolean',
|
|
95
|
+
:'customer_type' => :'String',
|
|
96
|
+
:'hash_sha256' => :'String',
|
|
97
|
+
:'item_logic_suppression' => :'SfvbUpsellItemLogic',
|
|
98
|
+
:'item_logic_trigger' => :'SfvbUpsellItemLogic',
|
|
99
|
+
:'location' => :'String',
|
|
100
|
+
:'maximum_offers' => :'Integer',
|
|
101
|
+
:'name' => :'String',
|
|
102
|
+
:'path_order' => :'Integer',
|
|
103
|
+
:'path_type' => :'String',
|
|
104
|
+
:'towerdata_trigger' => :'SfvbUpsellTowerData',
|
|
105
|
+
:'trigger_item_ids' => :'Array<String>',
|
|
106
|
+
:'trigger_tags' => :'Array<String>',
|
|
107
|
+
:'upsell_path_oid' => :'Integer',
|
|
108
|
+
:'variations' => :'Array<SfvbUpsellVariation>'
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# List of attributes with nullable: true
|
|
113
|
+
def self.openapi_nullable
|
|
114
|
+
Set.new([
|
|
115
|
+
])
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Initializes the object
|
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
120
|
+
def initialize(attributes = {})
|
|
121
|
+
if (!attributes.is_a?(Hash))
|
|
122
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbUpsellPath` initialize method"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
127
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
128
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbUpsellPath`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
129
|
+
end
|
|
130
|
+
h[k.to_sym] = v
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'active')
|
|
134
|
+
self.active = attributes[:'active']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'archived')
|
|
138
|
+
self.archived = attributes[:'archived']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'customer_type')
|
|
142
|
+
self.customer_type = attributes[:'customer_type']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'hash_sha256')
|
|
146
|
+
self.hash_sha256 = attributes[:'hash_sha256']
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'item_logic_suppression')
|
|
150
|
+
self.item_logic_suppression = attributes[:'item_logic_suppression']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'item_logic_trigger')
|
|
154
|
+
self.item_logic_trigger = attributes[:'item_logic_trigger']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'location')
|
|
158
|
+
self.location = attributes[:'location']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'maximum_offers')
|
|
162
|
+
self.maximum_offers = attributes[:'maximum_offers']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'name')
|
|
166
|
+
self.name = attributes[:'name']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'path_order')
|
|
170
|
+
self.path_order = attributes[:'path_order']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'path_type')
|
|
174
|
+
self.path_type = attributes[:'path_type']
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
if attributes.key?(:'towerdata_trigger')
|
|
178
|
+
self.towerdata_trigger = attributes[:'towerdata_trigger']
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
if attributes.key?(:'trigger_item_ids')
|
|
182
|
+
if (value = attributes[:'trigger_item_ids']).is_a?(Array)
|
|
183
|
+
self.trigger_item_ids = value
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
if attributes.key?(:'trigger_tags')
|
|
188
|
+
if (value = attributes[:'trigger_tags']).is_a?(Array)
|
|
189
|
+
self.trigger_tags = value
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
if attributes.key?(:'upsell_path_oid')
|
|
194
|
+
self.upsell_path_oid = attributes[:'upsell_path_oid']
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
if attributes.key?(:'variations')
|
|
198
|
+
if (value = attributes[:'variations']).is_a?(Array)
|
|
199
|
+
self.variations = value
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
205
|
+
# @return Array for valid properties with the reasons
|
|
206
|
+
def list_invalid_properties
|
|
207
|
+
invalid_properties = Array.new
|
|
208
|
+
invalid_properties
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Check to see if the all the properties in the model are valid
|
|
212
|
+
# @return true if the model is valid
|
|
213
|
+
def valid?
|
|
214
|
+
true
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Checks equality by comparing each attribute.
|
|
218
|
+
# @param [Object] Object to be compared
|
|
219
|
+
def ==(o)
|
|
220
|
+
return true if self.equal?(o)
|
|
221
|
+
self.class == o.class &&
|
|
222
|
+
active == o.active &&
|
|
223
|
+
archived == o.archived &&
|
|
224
|
+
customer_type == o.customer_type &&
|
|
225
|
+
hash_sha256 == o.hash_sha256 &&
|
|
226
|
+
item_logic_suppression == o.item_logic_suppression &&
|
|
227
|
+
item_logic_trigger == o.item_logic_trigger &&
|
|
228
|
+
location == o.location &&
|
|
229
|
+
maximum_offers == o.maximum_offers &&
|
|
230
|
+
name == o.name &&
|
|
231
|
+
path_order == o.path_order &&
|
|
232
|
+
path_type == o.path_type &&
|
|
233
|
+
towerdata_trigger == o.towerdata_trigger &&
|
|
234
|
+
trigger_item_ids == o.trigger_item_ids &&
|
|
235
|
+
trigger_tags == o.trigger_tags &&
|
|
236
|
+
upsell_path_oid == o.upsell_path_oid &&
|
|
237
|
+
variations == o.variations
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# @see the `==` method
|
|
241
|
+
# @param [Object] Object to be compared
|
|
242
|
+
def eql?(o)
|
|
243
|
+
self == o
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Calculates hash code according to all attributes.
|
|
247
|
+
# @return [Integer] Hash code
|
|
248
|
+
def hash
|
|
249
|
+
[active, archived, customer_type, hash_sha256, item_logic_suppression, item_logic_trigger, location, maximum_offers, name, path_order, path_type, towerdata_trigger, trigger_item_ids, trigger_tags, upsell_path_oid, variations].hash
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Builds the object from hash
|
|
253
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
254
|
+
# @return [Object] Returns the model itself
|
|
255
|
+
def self.build_from_hash(attributes)
|
|
256
|
+
new.build_from_hash(attributes)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Builds the object from hash
|
|
260
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
261
|
+
# @return [Object] Returns the model itself
|
|
262
|
+
def build_from_hash(attributes)
|
|
263
|
+
return nil unless attributes.is_a?(Hash)
|
|
264
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
265
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
266
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
267
|
+
self.send("#{key}=", nil)
|
|
268
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
269
|
+
# check to ensure the input is an array given that the attribute
|
|
270
|
+
# is documented as an array but the input is not
|
|
271
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
272
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
273
|
+
end
|
|
274
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
275
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
self
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Deserializes the data based on type
|
|
283
|
+
# @param string type Data type
|
|
284
|
+
# @param string value Value to be deserialized
|
|
285
|
+
# @return [Object] Deserialized data
|
|
286
|
+
def _deserialize(type, value)
|
|
287
|
+
case type.to_sym
|
|
288
|
+
when :Time
|
|
289
|
+
Time.parse(value)
|
|
290
|
+
when :Date
|
|
291
|
+
Date.parse(value)
|
|
292
|
+
when :String
|
|
293
|
+
value.to_s
|
|
294
|
+
when :Integer
|
|
295
|
+
value.to_i
|
|
296
|
+
when :Float
|
|
297
|
+
value.to_f
|
|
298
|
+
when :Boolean
|
|
299
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
300
|
+
true
|
|
301
|
+
else
|
|
302
|
+
false
|
|
303
|
+
end
|
|
304
|
+
when :Object
|
|
305
|
+
# generic object (usually a Hash), return directly
|
|
306
|
+
value
|
|
307
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
308
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
309
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
310
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
311
|
+
k_type = Regexp.last_match[:k_type]
|
|
312
|
+
v_type = Regexp.last_match[:v_type]
|
|
313
|
+
{}.tap do |hash|
|
|
314
|
+
value.each do |k, v|
|
|
315
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
else # model
|
|
319
|
+
# models (e.g. Pet) or oneOf
|
|
320
|
+
klass = UltracartClient.const_get(type)
|
|
321
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
322
|
+
end
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Returns the string representation of the object
|
|
326
|
+
# @return [String] String presentation of the object
|
|
327
|
+
def to_s
|
|
328
|
+
to_hash.to_s
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
332
|
+
# @return [Hash] Returns the object in the form of hash
|
|
333
|
+
def to_body
|
|
334
|
+
to_hash
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# Returns the object in the form of hash
|
|
338
|
+
# @return [Hash] Returns the object in the form of hash
|
|
339
|
+
def to_hash
|
|
340
|
+
hash = {}
|
|
341
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
342
|
+
value = self.send(attr)
|
|
343
|
+
if value.nil?
|
|
344
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
345
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
hash[param] = _to_hash(value)
|
|
349
|
+
end
|
|
350
|
+
hash
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Outputs non-array value in the form of hash
|
|
354
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
355
|
+
# @param [Object] value Any valid value
|
|
356
|
+
# @return [Hash] Returns the value in the form of hash
|
|
357
|
+
def _to_hash(value)
|
|
358
|
+
if value.is_a?(Array)
|
|
359
|
+
value.compact.map { |v| _to_hash(v) }
|
|
360
|
+
elsif value.is_a?(Hash)
|
|
361
|
+
{}.tap do |hash|
|
|
362
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
363
|
+
end
|
|
364
|
+
elsif value.respond_to? :to_hash
|
|
365
|
+
value.to_hash
|
|
366
|
+
else
|
|
367
|
+
value
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
end
|
|
@@ -0,0 +1,220 @@
|
|
|
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 SfvbUpsellPathDuplicateRequest
|
|
18
|
+
# Zero-based index into the path's variations. When set, that variation is copied and appended to the same path. Omitted or null copies the whole path, placed right after it.
|
|
19
|
+
attr_accessor :variation
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'variation' => :'variation'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'variation' => :'Integer'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbUpsellPathDuplicateRequest` initialize method"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbUpsellPathDuplicateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'variation')
|
|
62
|
+
self.variation = attributes[:'variation']
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
67
|
+
# @return Array for valid properties with the reasons
|
|
68
|
+
def list_invalid_properties
|
|
69
|
+
invalid_properties = Array.new
|
|
70
|
+
invalid_properties
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Check to see if the all the properties in the model are valid
|
|
74
|
+
# @return true if the model is valid
|
|
75
|
+
def valid?
|
|
76
|
+
true
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Checks equality by comparing each attribute.
|
|
80
|
+
# @param [Object] Object to be compared
|
|
81
|
+
def ==(o)
|
|
82
|
+
return true if self.equal?(o)
|
|
83
|
+
self.class == o.class &&
|
|
84
|
+
variation == o.variation
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @see the `==` method
|
|
88
|
+
# @param [Object] Object to be compared
|
|
89
|
+
def eql?(o)
|
|
90
|
+
self == o
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Calculates hash code according to all attributes.
|
|
94
|
+
# @return [Integer] Hash code
|
|
95
|
+
def hash
|
|
96
|
+
[variation].hash
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Builds the object from hash
|
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
101
|
+
# @return [Object] Returns the model itself
|
|
102
|
+
def self.build_from_hash(attributes)
|
|
103
|
+
new.build_from_hash(attributes)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Builds the object from hash
|
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
108
|
+
# @return [Object] Returns the model itself
|
|
109
|
+
def build_from_hash(attributes)
|
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
|
111
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
112
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
113
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
114
|
+
self.send("#{key}=", nil)
|
|
115
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
116
|
+
# check to ensure the input is an array given that the attribute
|
|
117
|
+
# is documented as an array but the input is not
|
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
120
|
+
end
|
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
self
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Deserializes the data based on type
|
|
130
|
+
# @param string type Data type
|
|
131
|
+
# @param string value Value to be deserialized
|
|
132
|
+
# @return [Object] Deserialized data
|
|
133
|
+
def _deserialize(type, value)
|
|
134
|
+
case type.to_sym
|
|
135
|
+
when :Time
|
|
136
|
+
Time.parse(value)
|
|
137
|
+
when :Date
|
|
138
|
+
Date.parse(value)
|
|
139
|
+
when :String
|
|
140
|
+
value.to_s
|
|
141
|
+
when :Integer
|
|
142
|
+
value.to_i
|
|
143
|
+
when :Float
|
|
144
|
+
value.to_f
|
|
145
|
+
when :Boolean
|
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
147
|
+
true
|
|
148
|
+
else
|
|
149
|
+
false
|
|
150
|
+
end
|
|
151
|
+
when :Object
|
|
152
|
+
# generic object (usually a Hash), return directly
|
|
153
|
+
value
|
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
|
160
|
+
{}.tap do |hash|
|
|
161
|
+
value.each do |k, v|
|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
else # model
|
|
166
|
+
# models (e.g. Pet) or oneOf
|
|
167
|
+
klass = UltracartClient.const_get(type)
|
|
168
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Returns the string representation of the object
|
|
173
|
+
# @return [String] String presentation of the object
|
|
174
|
+
def to_s
|
|
175
|
+
to_hash.to_s
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
|
180
|
+
def to_body
|
|
181
|
+
to_hash
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Returns the object in the form of hash
|
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
|
186
|
+
def to_hash
|
|
187
|
+
hash = {}
|
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
189
|
+
value = self.send(attr)
|
|
190
|
+
if value.nil?
|
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
hash[param] = _to_hash(value)
|
|
196
|
+
end
|
|
197
|
+
hash
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Outputs non-array value in the form of hash
|
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
202
|
+
# @param [Object] value Any valid value
|
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
|
204
|
+
def _to_hash(value)
|
|
205
|
+
if value.is_a?(Array)
|
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
|
207
|
+
elsif value.is_a?(Hash)
|
|
208
|
+
{}.tap do |hash|
|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
210
|
+
end
|
|
211
|
+
elsif value.respond_to? :to_hash
|
|
212
|
+
value.to_hash
|
|
213
|
+
else
|
|
214
|
+
value
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
end
|