ultracart_api 4.1.199 → 4.1.200
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 +21 -2
- data/docs/SfvbApi.md +465 -11
- data/docs/SfvbApprovalCreateRequest.md +6 -0
- data/docs/SfvbApprovalParams.md +23 -3
- data/docs/SfvbItemAttributeBatchRequest.md +20 -0
- data/docs/SfvbItemAttributeBatchResponse.md +40 -0
- data/docs/SfvbItemAttributeBatchRow.md +30 -0
- data/docs/SfvbItemAttributeBatchRowResult.md +36 -0
- data/docs/SfvbItemPricing.md +38 -0
- data/docs/SfvbItemPricingRequest.md +32 -0
- data/docs/SfvbItemRelated.md +28 -0
- data/docs/SfvbItemRelatedItem.md +22 -0
- data/docs/SfvbItemRelatedRequest.md +22 -0
- data/docs/SfvbItemVolumeDiscount.md +20 -0
- data/lib/ultracart_api/api/sfvb_api.rb +640 -16
- data/lib/ultracart_api/models/sfvb_approval_create_request.rb +33 -3
- data/lib/ultracart_api/models/sfvb_approval_params.rb +142 -6
- data/lib/ultracart_api/models/sfvb_item_attribute_batch_request.rb +232 -0
- data/lib/ultracart_api/models/sfvb_item_attribute_batch_response.rb +332 -0
- data/lib/ultracart_api/models/sfvb_item_attribute_batch_row.rb +280 -0
- data/lib/ultracart_api/models/sfvb_item_attribute_batch_row_result.rb +344 -0
- data/lib/ultracart_api/models/sfvb_item_pricing.rb +322 -0
- data/lib/ultracart_api/models/sfvb_item_pricing_request.rb +292 -0
- data/lib/ultracart_api/models/sfvb_item_related.rb +272 -0
- data/lib/ultracart_api/models/sfvb_item_related_item.rb +274 -0
- data/lib/ultracart_api/models/sfvb_item_related_request.rb +242 -0
- data/lib/ultracart_api/models/sfvb_item_volume_discount.rb +230 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +10 -0
- metadata +22 -2
|
@@ -0,0 +1,344 @@
|
|
|
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 SfvbItemAttributeBatchRowResult
|
|
18
|
+
# Whether the item had the attribute before this batch.
|
|
19
|
+
attr_accessor :current_present
|
|
20
|
+
|
|
21
|
+
# The hash of the value before this batch. Send it back with the row to apply.
|
|
22
|
+
attr_accessor :current_sha256
|
|
23
|
+
|
|
24
|
+
# The value before this batch, for a backup. Empty when the item has no such attribute.
|
|
25
|
+
attr_accessor :current_value
|
|
26
|
+
|
|
27
|
+
# The item's merchant item id. Absent when not_found.
|
|
28
|
+
attr_accessor :merchant_item_id
|
|
29
|
+
|
|
30
|
+
# The item. Absent when not_found.
|
|
31
|
+
attr_accessor :merchant_item_oid
|
|
32
|
+
|
|
33
|
+
# Why a row is invalid, stale or error.
|
|
34
|
+
attr_accessor :message
|
|
35
|
+
|
|
36
|
+
# The attribute name as sent.
|
|
37
|
+
attr_accessor :name
|
|
38
|
+
|
|
39
|
+
# change or unchanged from a dry run, updated after an apply, stale (the value differs from expected_value or changed since the dry run), not_found, invalid, or error when the item could not be saved.
|
|
40
|
+
attr_accessor :result
|
|
41
|
+
|
|
42
|
+
# The row's position in the request, from 1.
|
|
43
|
+
attr_accessor :row
|
|
44
|
+
|
|
45
|
+
# The type the value is checked and stored as - the declaring template's, else the one sent.
|
|
46
|
+
attr_accessor :type
|
|
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
|
+
:'current_present' => :'current_present',
|
|
74
|
+
:'current_sha256' => :'current_sha256',
|
|
75
|
+
:'current_value' => :'current_value',
|
|
76
|
+
:'merchant_item_id' => :'merchant_item_id',
|
|
77
|
+
:'merchant_item_oid' => :'merchant_item_oid',
|
|
78
|
+
:'message' => :'message',
|
|
79
|
+
:'name' => :'name',
|
|
80
|
+
:'result' => :'result',
|
|
81
|
+
:'row' => :'row',
|
|
82
|
+
:'type' => :'type'
|
|
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
|
+
:'current_present' => :'Boolean',
|
|
95
|
+
:'current_sha256' => :'String',
|
|
96
|
+
:'current_value' => :'String',
|
|
97
|
+
:'merchant_item_id' => :'String',
|
|
98
|
+
:'merchant_item_oid' => :'Integer',
|
|
99
|
+
:'message' => :'String',
|
|
100
|
+
:'name' => :'String',
|
|
101
|
+
:'result' => :'String',
|
|
102
|
+
:'row' => :'Integer',
|
|
103
|
+
:'type' => :'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::SfvbItemAttributeBatchRowResult` 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::SfvbItemAttributeBatchRowResult`. 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?(:'current_present')
|
|
129
|
+
self.current_present = attributes[:'current_present']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'current_sha256')
|
|
133
|
+
self.current_sha256 = attributes[:'current_sha256']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'current_value')
|
|
137
|
+
self.current_value = attributes[:'current_value']
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'merchant_item_id')
|
|
141
|
+
self.merchant_item_id = attributes[:'merchant_item_id']
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if attributes.key?(:'merchant_item_oid')
|
|
145
|
+
self.merchant_item_oid = attributes[:'merchant_item_oid']
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if attributes.key?(:'message')
|
|
149
|
+
self.message = attributes[:'message']
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
if attributes.key?(:'name')
|
|
153
|
+
self.name = attributes[:'name']
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if attributes.key?(:'result')
|
|
157
|
+
self.result = attributes[:'result']
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if attributes.key?(:'row')
|
|
161
|
+
self.row = attributes[:'row']
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
if attributes.key?(:'type')
|
|
165
|
+
self.type = attributes[:'type']
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
170
|
+
# @return Array for valid properties with the reasons
|
|
171
|
+
def list_invalid_properties
|
|
172
|
+
invalid_properties = Array.new
|
|
173
|
+
invalid_properties
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Check to see if the all the properties in the model are valid
|
|
177
|
+
# @return true if the model is valid
|
|
178
|
+
def valid?
|
|
179
|
+
result_validator = EnumAttributeValidator.new('String', ["change", "unchanged", "updated", "stale", "not_found", "invalid", "error"])
|
|
180
|
+
return false unless result_validator.valid?(@result)
|
|
181
|
+
true
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
185
|
+
# @param [Object] result Object to be assigned
|
|
186
|
+
def result=(result)
|
|
187
|
+
validator = EnumAttributeValidator.new('String', ["change", "unchanged", "updated", "stale", "not_found", "invalid", "error"])
|
|
188
|
+
unless validator.valid?(result)
|
|
189
|
+
fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}."
|
|
190
|
+
end
|
|
191
|
+
@result = result
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# Checks equality by comparing each attribute.
|
|
195
|
+
# @param [Object] Object to be compared
|
|
196
|
+
def ==(o)
|
|
197
|
+
return true if self.equal?(o)
|
|
198
|
+
self.class == o.class &&
|
|
199
|
+
current_present == o.current_present &&
|
|
200
|
+
current_sha256 == o.current_sha256 &&
|
|
201
|
+
current_value == o.current_value &&
|
|
202
|
+
merchant_item_id == o.merchant_item_id &&
|
|
203
|
+
merchant_item_oid == o.merchant_item_oid &&
|
|
204
|
+
message == o.message &&
|
|
205
|
+
name == o.name &&
|
|
206
|
+
result == o.result &&
|
|
207
|
+
row == o.row &&
|
|
208
|
+
type == o.type
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# @see the `==` method
|
|
212
|
+
# @param [Object] Object to be compared
|
|
213
|
+
def eql?(o)
|
|
214
|
+
self == o
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Calculates hash code according to all attributes.
|
|
218
|
+
# @return [Integer] Hash code
|
|
219
|
+
def hash
|
|
220
|
+
[current_present, current_sha256, current_value, merchant_item_id, merchant_item_oid, message, name, result, row, type].hash
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
# Builds the object from hash
|
|
224
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
225
|
+
# @return [Object] Returns the model itself
|
|
226
|
+
def self.build_from_hash(attributes)
|
|
227
|
+
new.build_from_hash(attributes)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Builds the object from hash
|
|
231
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
232
|
+
# @return [Object] Returns the model itself
|
|
233
|
+
def build_from_hash(attributes)
|
|
234
|
+
return nil unless attributes.is_a?(Hash)
|
|
235
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
236
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
237
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
238
|
+
self.send("#{key}=", nil)
|
|
239
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
240
|
+
# check to ensure the input is an array given that the attribute
|
|
241
|
+
# is documented as an array but the input is not
|
|
242
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
243
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
244
|
+
end
|
|
245
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
246
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
self
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Deserializes the data based on type
|
|
254
|
+
# @param string type Data type
|
|
255
|
+
# @param string value Value to be deserialized
|
|
256
|
+
# @return [Object] Deserialized data
|
|
257
|
+
def _deserialize(type, value)
|
|
258
|
+
case type.to_sym
|
|
259
|
+
when :Time
|
|
260
|
+
Time.parse(value)
|
|
261
|
+
when :Date
|
|
262
|
+
Date.parse(value)
|
|
263
|
+
when :String
|
|
264
|
+
value.to_s
|
|
265
|
+
when :Integer
|
|
266
|
+
value.to_i
|
|
267
|
+
when :Float
|
|
268
|
+
value.to_f
|
|
269
|
+
when :Boolean
|
|
270
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
271
|
+
true
|
|
272
|
+
else
|
|
273
|
+
false
|
|
274
|
+
end
|
|
275
|
+
when :Object
|
|
276
|
+
# generic object (usually a Hash), return directly
|
|
277
|
+
value
|
|
278
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
279
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
280
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
281
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
282
|
+
k_type = Regexp.last_match[:k_type]
|
|
283
|
+
v_type = Regexp.last_match[:v_type]
|
|
284
|
+
{}.tap do |hash|
|
|
285
|
+
value.each do |k, v|
|
|
286
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
else # model
|
|
290
|
+
# models (e.g. Pet) or oneOf
|
|
291
|
+
klass = UltracartClient.const_get(type)
|
|
292
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Returns the string representation of the object
|
|
297
|
+
# @return [String] String presentation of the object
|
|
298
|
+
def to_s
|
|
299
|
+
to_hash.to_s
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
303
|
+
# @return [Hash] Returns the object in the form of hash
|
|
304
|
+
def to_body
|
|
305
|
+
to_hash
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Returns the object in the form of hash
|
|
309
|
+
# @return [Hash] Returns the object in the form of hash
|
|
310
|
+
def to_hash
|
|
311
|
+
hash = {}
|
|
312
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
313
|
+
value = self.send(attr)
|
|
314
|
+
if value.nil?
|
|
315
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
316
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
hash[param] = _to_hash(value)
|
|
320
|
+
end
|
|
321
|
+
hash
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Outputs non-array value in the form of hash
|
|
325
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
326
|
+
# @param [Object] value Any valid value
|
|
327
|
+
# @return [Hash] Returns the value in the form of hash
|
|
328
|
+
def _to_hash(value)
|
|
329
|
+
if value.is_a?(Array)
|
|
330
|
+
value.compact.map { |v| _to_hash(v) }
|
|
331
|
+
elsif value.is_a?(Hash)
|
|
332
|
+
{}.tap do |hash|
|
|
333
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
334
|
+
end
|
|
335
|
+
elsif value.respond_to? :to_hash
|
|
336
|
+
value.to_hash
|
|
337
|
+
else
|
|
338
|
+
value
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
end
|
|
@@ -0,0 +1,322 @@
|
|
|
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 SfvbItemPricing
|
|
18
|
+
# The price.
|
|
19
|
+
attr_accessor :cost
|
|
20
|
+
|
|
21
|
+
# The currency every amount is in. Read only here.
|
|
22
|
+
attr_accessor :currency_code
|
|
23
|
+
|
|
24
|
+
# The hash of the pricing above. Send it as If-Match to change it.
|
|
25
|
+
attr_accessor :hash_sha256
|
|
26
|
+
|
|
27
|
+
# The item's merchant item id.
|
|
28
|
+
attr_accessor :merchant_item_id
|
|
29
|
+
|
|
30
|
+
# The item.
|
|
31
|
+
attr_accessor :merchant_item_oid
|
|
32
|
+
|
|
33
|
+
# The manufacturer suggested retail price, when set.
|
|
34
|
+
attr_accessor :msrp
|
|
35
|
+
|
|
36
|
+
# Whether the sale price applies right now.
|
|
37
|
+
attr_accessor :sale_active
|
|
38
|
+
|
|
39
|
+
# The sale price, when a sale is set.
|
|
40
|
+
attr_accessor :sale_cost
|
|
41
|
+
|
|
42
|
+
# When the sale ends, ISO 8601.
|
|
43
|
+
attr_accessor :sale_end
|
|
44
|
+
|
|
45
|
+
# When the sale starts, ISO 8601.
|
|
46
|
+
attr_accessor :sale_start
|
|
47
|
+
|
|
48
|
+
# Retail quantity breaks, lowest quantity first. Wholesale pricing tiers are not shown or changed here.
|
|
49
|
+
attr_accessor :volume_discounts
|
|
50
|
+
|
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
52
|
+
def self.attribute_map
|
|
53
|
+
{
|
|
54
|
+
:'cost' => :'cost',
|
|
55
|
+
:'currency_code' => :'currency_code',
|
|
56
|
+
:'hash_sha256' => :'hash_sha256',
|
|
57
|
+
:'merchant_item_id' => :'merchant_item_id',
|
|
58
|
+
:'merchant_item_oid' => :'merchant_item_oid',
|
|
59
|
+
:'msrp' => :'msrp',
|
|
60
|
+
:'sale_active' => :'sale_active',
|
|
61
|
+
:'sale_cost' => :'sale_cost',
|
|
62
|
+
:'sale_end' => :'sale_end',
|
|
63
|
+
:'sale_start' => :'sale_start',
|
|
64
|
+
:'volume_discounts' => :'volume_discounts'
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Returns all the JSON keys this model knows about
|
|
69
|
+
def self.acceptable_attributes
|
|
70
|
+
attribute_map.values
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute type mapping.
|
|
74
|
+
def self.openapi_types
|
|
75
|
+
{
|
|
76
|
+
:'cost' => :'Float',
|
|
77
|
+
:'currency_code' => :'String',
|
|
78
|
+
:'hash_sha256' => :'String',
|
|
79
|
+
:'merchant_item_id' => :'String',
|
|
80
|
+
:'merchant_item_oid' => :'Integer',
|
|
81
|
+
:'msrp' => :'Float',
|
|
82
|
+
:'sale_active' => :'Boolean',
|
|
83
|
+
:'sale_cost' => :'Float',
|
|
84
|
+
:'sale_end' => :'String',
|
|
85
|
+
:'sale_start' => :'String',
|
|
86
|
+
:'volume_discounts' => :'Array<SfvbItemVolumeDiscount>'
|
|
87
|
+
}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# List of attributes with nullable: true
|
|
91
|
+
def self.openapi_nullable
|
|
92
|
+
Set.new([
|
|
93
|
+
])
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Initializes the object
|
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
98
|
+
def initialize(attributes = {})
|
|
99
|
+
if (!attributes.is_a?(Hash))
|
|
100
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemPricing` initialize method"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
104
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
105
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
106
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemPricing`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
107
|
+
end
|
|
108
|
+
h[k.to_sym] = v
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if attributes.key?(:'cost')
|
|
112
|
+
self.cost = attributes[:'cost']
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if attributes.key?(:'currency_code')
|
|
116
|
+
self.currency_code = attributes[:'currency_code']
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if attributes.key?(:'hash_sha256')
|
|
120
|
+
self.hash_sha256 = attributes[:'hash_sha256']
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if attributes.key?(:'merchant_item_id')
|
|
124
|
+
self.merchant_item_id = attributes[:'merchant_item_id']
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if attributes.key?(:'merchant_item_oid')
|
|
128
|
+
self.merchant_item_oid = attributes[:'merchant_item_oid']
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'msrp')
|
|
132
|
+
self.msrp = attributes[:'msrp']
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
if attributes.key?(:'sale_active')
|
|
136
|
+
self.sale_active = attributes[:'sale_active']
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if attributes.key?(:'sale_cost')
|
|
140
|
+
self.sale_cost = attributes[:'sale_cost']
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'sale_end')
|
|
144
|
+
self.sale_end = attributes[:'sale_end']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'sale_start')
|
|
148
|
+
self.sale_start = attributes[:'sale_start']
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
if attributes.key?(:'volume_discounts')
|
|
152
|
+
if (value = attributes[:'volume_discounts']).is_a?(Array)
|
|
153
|
+
self.volume_discounts = value
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
159
|
+
# @return Array for valid properties with the reasons
|
|
160
|
+
def list_invalid_properties
|
|
161
|
+
invalid_properties = Array.new
|
|
162
|
+
invalid_properties
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Check to see if the all the properties in the model are valid
|
|
166
|
+
# @return true if the model is valid
|
|
167
|
+
def valid?
|
|
168
|
+
true
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Checks equality by comparing each attribute.
|
|
172
|
+
# @param [Object] Object to be compared
|
|
173
|
+
def ==(o)
|
|
174
|
+
return true if self.equal?(o)
|
|
175
|
+
self.class == o.class &&
|
|
176
|
+
cost == o.cost &&
|
|
177
|
+
currency_code == o.currency_code &&
|
|
178
|
+
hash_sha256 == o.hash_sha256 &&
|
|
179
|
+
merchant_item_id == o.merchant_item_id &&
|
|
180
|
+
merchant_item_oid == o.merchant_item_oid &&
|
|
181
|
+
msrp == o.msrp &&
|
|
182
|
+
sale_active == o.sale_active &&
|
|
183
|
+
sale_cost == o.sale_cost &&
|
|
184
|
+
sale_end == o.sale_end &&
|
|
185
|
+
sale_start == o.sale_start &&
|
|
186
|
+
volume_discounts == o.volume_discounts
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# @see the `==` method
|
|
190
|
+
# @param [Object] Object to be compared
|
|
191
|
+
def eql?(o)
|
|
192
|
+
self == o
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Calculates hash code according to all attributes.
|
|
196
|
+
# @return [Integer] Hash code
|
|
197
|
+
def hash
|
|
198
|
+
[cost, currency_code, hash_sha256, merchant_item_id, merchant_item_oid, msrp, sale_active, sale_cost, sale_end, sale_start, volume_discounts].hash
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Builds the object from hash
|
|
202
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
203
|
+
# @return [Object] Returns the model itself
|
|
204
|
+
def self.build_from_hash(attributes)
|
|
205
|
+
new.build_from_hash(attributes)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Builds the object from hash
|
|
209
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
210
|
+
# @return [Object] Returns the model itself
|
|
211
|
+
def build_from_hash(attributes)
|
|
212
|
+
return nil unless attributes.is_a?(Hash)
|
|
213
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
214
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
215
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
216
|
+
self.send("#{key}=", nil)
|
|
217
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
218
|
+
# check to ensure the input is an array given that the attribute
|
|
219
|
+
# is documented as an array but the input is not
|
|
220
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
221
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
222
|
+
end
|
|
223
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
224
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
self
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Deserializes the data based on type
|
|
232
|
+
# @param string type Data type
|
|
233
|
+
# @param string value Value to be deserialized
|
|
234
|
+
# @return [Object] Deserialized data
|
|
235
|
+
def _deserialize(type, value)
|
|
236
|
+
case type.to_sym
|
|
237
|
+
when :Time
|
|
238
|
+
Time.parse(value)
|
|
239
|
+
when :Date
|
|
240
|
+
Date.parse(value)
|
|
241
|
+
when :String
|
|
242
|
+
value.to_s
|
|
243
|
+
when :Integer
|
|
244
|
+
value.to_i
|
|
245
|
+
when :Float
|
|
246
|
+
value.to_f
|
|
247
|
+
when :Boolean
|
|
248
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
249
|
+
true
|
|
250
|
+
else
|
|
251
|
+
false
|
|
252
|
+
end
|
|
253
|
+
when :Object
|
|
254
|
+
# generic object (usually a Hash), return directly
|
|
255
|
+
value
|
|
256
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
257
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
258
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
259
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
260
|
+
k_type = Regexp.last_match[:k_type]
|
|
261
|
+
v_type = Regexp.last_match[:v_type]
|
|
262
|
+
{}.tap do |hash|
|
|
263
|
+
value.each do |k, v|
|
|
264
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
else # model
|
|
268
|
+
# models (e.g. Pet) or oneOf
|
|
269
|
+
klass = UltracartClient.const_get(type)
|
|
270
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Returns the string representation of the object
|
|
275
|
+
# @return [String] String presentation of the object
|
|
276
|
+
def to_s
|
|
277
|
+
to_hash.to_s
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
281
|
+
# @return [Hash] Returns the object in the form of hash
|
|
282
|
+
def to_body
|
|
283
|
+
to_hash
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Returns the object in the form of hash
|
|
287
|
+
# @return [Hash] Returns the object in the form of hash
|
|
288
|
+
def to_hash
|
|
289
|
+
hash = {}
|
|
290
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
291
|
+
value = self.send(attr)
|
|
292
|
+
if value.nil?
|
|
293
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
294
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
hash[param] = _to_hash(value)
|
|
298
|
+
end
|
|
299
|
+
hash
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Outputs non-array value in the form of hash
|
|
303
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
304
|
+
# @param [Object] value Any valid value
|
|
305
|
+
# @return [Hash] Returns the value in the form of hash
|
|
306
|
+
def _to_hash(value)
|
|
307
|
+
if value.is_a?(Array)
|
|
308
|
+
value.compact.map { |v| _to_hash(v) }
|
|
309
|
+
elsif value.is_a?(Hash)
|
|
310
|
+
{}.tap do |hash|
|
|
311
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
312
|
+
end
|
|
313
|
+
elsif value.respond_to? :to_hash
|
|
314
|
+
value.to_hash
|
|
315
|
+
else
|
|
316
|
+
value
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
end
|