Class: UltracartClient::ItemOptionValue
- Inherits:
-
Object
- Object
- UltracartClient::ItemOptionValue
- Defined in:
- lib/ultracart_api/models/item_option_value.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#additional_dimension_application ⇒ Object
Additional dimensions application.
-
#additional_items ⇒ Object
Additional items to add to the order if this value is selected.
-
#cost_change ⇒ Object
Cost change.
-
#default_value ⇒ Object
True if default value.
-
#digital_items ⇒ Object
Digital items to allow the customer to download if this option value is selected.
-
#height ⇒ Object
Returns the value of attribute height.
-
#length ⇒ Object
Returns the value of attribute length.
-
#merchant_item_multimedia_oid ⇒ Object
Multimedia object identifier associated with this option value.
-
#option_value_oid ⇒ Object
Option value object identifier.
-
#percent_cost_change ⇒ Object
Percentage cost change.
-
#translated_text_instance_oid ⇒ Object
Translated text instance id.
-
#value ⇒ Object
Value.
-
#weight_change ⇒ Object
Returns the value of attribute weight_change.
-
#weight_change_percent ⇒ Object
Percentage weight change.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ItemOptionValue
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ItemOptionValue
Initializes the object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 124 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'additional_dimension_application') self.additional_dimension_application = attributes[:'additional_dimension_application'] end if attributes.has_key?(:'additional_items') if (value = attributes[:'additional_items']).is_a?(Array) self.additional_items = value end end if attributes.has_key?(:'cost_change') self.cost_change = attributes[:'cost_change'] end if attributes.has_key?(:'default_value') self.default_value = attributes[:'default_value'] end if attributes.has_key?(:'digital_items') if (value = attributes[:'digital_items']).is_a?(Array) self.digital_items = value end end if attributes.has_key?(:'height') self.height = attributes[:'height'] end if attributes.has_key?(:'length') self.length = attributes[:'length'] end if attributes.has_key?(:'merchant_item_multimedia_oid') self.merchant_item_multimedia_oid = attributes[:'merchant_item_multimedia_oid'] end if attributes.has_key?(:'option_value_oid') self.option_value_oid = attributes[:'option_value_oid'] end if attributes.has_key?(:'percent_cost_change') self.percent_cost_change = attributes[:'percent_cost_change'] end if attributes.has_key?(:'translated_text_instance_oid') self.translated_text_instance_oid = attributes[:'translated_text_instance_oid'] end if attributes.has_key?(:'value') self.value = attributes[:'value'] end if attributes.has_key?(:'weight_change') self.weight_change = attributes[:'weight_change'] end if attributes.has_key?(:'weight_change_percent') self.weight_change_percent = attributes[:'weight_change_percent'] end if attributes.has_key?(:'width') self.width = attributes[:'width'] end end |
Instance Attribute Details
#additional_dimension_application ⇒ Object
Additional dimensions application
18 19 20 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 18 def additional_dimension_application @additional_dimension_application end |
#additional_items ⇒ Object
Additional items to add to the order if this value is selected
21 22 23 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 21 def additional_items @additional_items end |
#cost_change ⇒ Object
Cost change
24 25 26 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 24 def cost_change @cost_change end |
#default_value ⇒ Object
True if default value
27 28 29 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 27 def default_value @default_value end |
#digital_items ⇒ Object
Digital items to allow the customer to download if this option value is selected
30 31 32 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 30 def digital_items @digital_items end |
#height ⇒ Object
Returns the value of attribute height.
32 33 34 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 32 def height @height end |
#length ⇒ Object
Returns the value of attribute length.
34 35 36 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 34 def length @length end |
#merchant_item_multimedia_oid ⇒ Object
Multimedia object identifier associated with this option value
37 38 39 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 37 def merchant_item_multimedia_oid @merchant_item_multimedia_oid end |
#option_value_oid ⇒ Object
Option value object identifier
40 41 42 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 40 def option_value_oid @option_value_oid end |
#percent_cost_change ⇒ Object
Percentage cost change
43 44 45 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 43 def percent_cost_change @percent_cost_change end |
#translated_text_instance_oid ⇒ Object
Translated text instance id
46 47 48 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 46 def translated_text_instance_oid @translated_text_instance_oid end |
#value ⇒ Object
Value
49 50 51 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 49 def value @value end |
#weight_change ⇒ Object
Returns the value of attribute weight_change.
51 52 53 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 51 def weight_change @weight_change end |
#weight_change_percent ⇒ Object
Percentage weight change
54 55 56 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 54 def weight_change_percent @weight_change_percent end |
#width ⇒ Object
Returns the value of attribute width.
56 57 58 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 56 def width @width end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 81 def self.attribute_map { :'additional_dimension_application' => :'additional_dimension_application', :'additional_items' => :'additional_items', :'cost_change' => :'cost_change', :'default_value' => :'default_value', :'digital_items' => :'digital_items', :'height' => :'height', :'length' => :'length', :'merchant_item_multimedia_oid' => :'merchant_item_multimedia_oid', :'option_value_oid' => :'option_value_oid', :'percent_cost_change' => :'percent_cost_change', :'translated_text_instance_oid' => :'translated_text_instance_oid', :'value' => :'value', :'weight_change' => :'weight_change', :'weight_change_percent' => :'weight_change_percent', :'width' => :'width' } end |
.swagger_types ⇒ Object
Attribute type mapping.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 102 def self.swagger_types { :'additional_dimension_application' => :'String', :'additional_items' => :'Array<ItemOptionValueAdditionalItem>', :'cost_change' => :'Float', :'default_value' => :'BOOLEAN', :'digital_items' => :'Array<ItemOptionValueDigitalItem>', :'height' => :'Distance', :'length' => :'Distance', :'merchant_item_multimedia_oid' => :'Integer', :'option_value_oid' => :'Integer', :'percent_cost_change' => :'Float', :'translated_text_instance_oid' => :'Integer', :'value' => :'String', :'weight_change' => :'Weight', :'weight_change_percent' => :'Float', :'width' => :'Distance' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 237 def ==(o) return true if self.equal?(o) self.class == o.class && additional_dimension_application == o.additional_dimension_application && additional_items == o.additional_items && cost_change == o.cost_change && default_value == o.default_value && digital_items == o.digital_items && height == o.height && length == o.length && merchant_item_multimedia_oid == o.merchant_item_multimedia_oid && option_value_oid == o.option_value_oid && percent_cost_change == o.percent_cost_change && translated_text_instance_oid == o.translated_text_instance_oid && value == o.value && weight_change == o.weight_change && weight_change_percent == o.weight_change_percent && width == o.width end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 293 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = UltracartClient.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 359 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 272 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
259 260 261 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 259 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
265 266 267 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 265 def hash [additional_dimension_application, additional_items, cost_change, default_value, digital_items, height, length, merchant_item_multimedia_oid, option_value_oid, percent_cost_change, translated_text_instance_oid, value, weight_change, weight_change_percent, width].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
197 198 199 200 201 202 203 204 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 197 def list_invalid_properties invalid_properties = Array.new if !@value.nil? && @value.to_s.length > 1024 invalid_properties.push('invalid value for "value", the character length must be smaller than or equal to 1024.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
339 340 341 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 339 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
345 346 347 348 349 350 351 352 353 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 345 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
333 334 335 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 333 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
208 209 210 211 212 213 |
# File 'lib/ultracart_api/models/item_option_value.rb', line 208 def valid? additional_dimension_application_validator = EnumAttributeValidator.new('String', ['none', 'set item to', 'add item']) return false unless additional_dimension_application_validator.valid?(@additional_dimension_application) return false if !@value.nil? && @value.to_s.length > 1024 true end |