Class: Zippendo::CreateOrderRequestOrderLinesInner
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::CreateOrderRequestOrderLinesInner
- Defined in:
- lib/zippendo/models/create_order_request_order_lines_inner.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#barcode ⇒ Object
Item barcode (EAN/UPC).
-
#country_of_origin ⇒ Object
ISO 3166-1 alpha-2 country of origin.
-
#currency ⇒ Object
ISO 4217 currency code.
-
#gift_card ⇒ Object
Whether the item is a gift card.
-
#hs_code ⇒ Object
Harmonized System customs code (6-13 digits).
-
#image_url ⇒ Object
Product image URL.
-
#name ⇒ Object
Product name.
-
#product_id ⇒ Object
Platform product identifier.
-
#province_of_origin ⇒ Object
ISO 3166-2 province of origin.
-
#quantity ⇒ Object
Quantity ordered.
-
#requires_shipping ⇒ Object
Whether the item requires shipping.
-
#sku ⇒ Object
Stock keeping unit identifier.
-
#taxable ⇒ Object
Whether the item is taxable.
-
#total_price ⇒ Object
Total price for the line.
-
#unit_price ⇒ Object
Price per unit.
-
#variant_id ⇒ Object
Platform variant identifier.
-
#vendor ⇒ Object
Vendor or brand name.
-
#weight ⇒ Object
Item weight in the given unit.
-
#weight_unit ⇒ Object
Unit of the weight value.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateOrderRequestOrderLinesInner
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ CreateOrderRequestOrderLinesInner
Initializes the object
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 182 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateOrderRequestOrderLinesInner` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Zippendo::CreateOrderRequestOrderLinesInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'sku') self.sku = attributes[:'sku'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] else self.quantity = nil end if attributes.key?(:'unit_price') self.unit_price = attributes[:'unit_price'] end if attributes.key?(:'total_price') self.total_price = attributes[:'total_price'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'weight') self.weight = attributes[:'weight'] end if attributes.key?(:'weight_unit') self.weight_unit = attributes[:'weight_unit'] end if attributes.key?(:'variant_id') self.variant_id = attributes[:'variant_id'] end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end if attributes.key?(:'hs_code') self.hs_code = attributes[:'hs_code'] end if attributes.key?(:'country_of_origin') self.country_of_origin = attributes[:'country_of_origin'] end if attributes.key?(:'province_of_origin') self.province_of_origin = attributes[:'province_of_origin'] end if attributes.key?(:'barcode') self. = attributes[:'barcode'] end if attributes.key?(:'requires_shipping') self.requires_shipping = attributes[:'requires_shipping'] end if attributes.key?(:'taxable') self.taxable = attributes[:'taxable'] end if attributes.key?(:'gift_card') self.gift_card = attributes[:'gift_card'] end if attributes.key?(:'vendor') self.vendor = attributes[:'vendor'] end end |
Instance Attribute Details
#barcode ⇒ Object
Item barcode (EAN/UPC).
61 62 63 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 61 def @barcode end |
#country_of_origin ⇒ Object
ISO 3166-1 alpha-2 country of origin.
55 56 57 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 55 def country_of_origin @country_of_origin end |
#currency ⇒ Object
ISO 4217 currency code.
34 35 36 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 34 def currency @currency end |
#gift_card ⇒ Object
Whether the item is a gift card.
70 71 72 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 70 def gift_card @gift_card end |
#hs_code ⇒ Object
Harmonized System customs code (6-13 digits).
52 53 54 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 52 def hs_code @hs_code end |
#image_url ⇒ Object
Product image URL.
49 50 51 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 49 def image_url @image_url end |
#name ⇒ Object
Product name.
22 23 24 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 22 def name @name end |
#product_id ⇒ Object
Platform product identifier.
46 47 48 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 46 def product_id @product_id end |
#province_of_origin ⇒ Object
ISO 3166-2 province of origin.
58 59 60 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 58 def province_of_origin @province_of_origin end |
#quantity ⇒ Object
Quantity ordered.
25 26 27 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 25 def quantity @quantity end |
#requires_shipping ⇒ Object
Whether the item requires shipping.
64 65 66 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 64 def requires_shipping @requires_shipping end |
#sku ⇒ Object
Stock keeping unit identifier.
19 20 21 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 19 def sku @sku end |
#taxable ⇒ Object
Whether the item is taxable.
67 68 69 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 67 def taxable @taxable end |
#total_price ⇒ Object
Total price for the line.
31 32 33 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 31 def total_price @total_price end |
#unit_price ⇒ Object
Price per unit.
28 29 30 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 28 def unit_price @unit_price end |
#variant_id ⇒ Object
Platform variant identifier.
43 44 45 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 43 def variant_id @variant_id end |
#vendor ⇒ Object
Vendor or brand name.
73 74 75 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 73 def vendor @vendor end |
#weight ⇒ Object
Item weight in the given unit.
37 38 39 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 37 def weight @weight end |
#weight_unit ⇒ Object
Unit of the weight value.
40 41 42 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 40 def weight_unit @weight_unit end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
123 124 125 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 123 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
128 129 130 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 128 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 98 def self.attribute_map { :'sku' => :'sku', :'name' => :'name', :'quantity' => :'quantity', :'unit_price' => :'unitPrice', :'total_price' => :'totalPrice', :'currency' => :'currency', :'weight' => :'weight', :'weight_unit' => :'weightUnit', :'variant_id' => :'variantId', :'product_id' => :'productId', :'image_url' => :'imageUrl', :'hs_code' => :'hsCode', :'country_of_origin' => :'countryOfOrigin', :'province_of_origin' => :'provinceOfOrigin', :'barcode' => :'barcode', :'requires_shipping' => :'requiresShipping', :'taxable' => :'taxable', :'gift_card' => :'giftCard', :'vendor' => :'vendor' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 495 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif 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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 158 def self.openapi_nullable Set.new([ :'sku', :'unit_price', :'total_price', :'currency', :'weight', :'weight_unit', :'variant_id', :'product_id', :'image_url', :'hs_code', :'country_of_origin', :'province_of_origin', :'barcode', :'requires_shipping', :'taxable', :'gift_card', :'vendor' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 133 def self.openapi_types { :'sku' => :'String', :'name' => :'String', :'quantity' => :'Integer', :'unit_price' => :'Float', :'total_price' => :'Float', :'currency' => :'String', :'weight' => :'Float', :'weight_unit' => :'String', :'variant_id' => :'String', :'product_id' => :'String', :'image_url' => :'String', :'hs_code' => :'String', :'country_of_origin' => :'String', :'province_of_origin' => :'String', :'barcode' => :'String', :'requires_shipping' => :'Boolean', :'taxable' => :'Boolean', :'gift_card' => :'Boolean', :'vendor' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 456 def ==(o) return true if self.equal?(o) self.class == o.class && sku == o.sku && name == o.name && quantity == o.quantity && unit_price == o.unit_price && total_price == o.total_price && currency == o.currency && weight == o.weight && weight_unit == o.weight_unit && variant_id == o.variant_id && product_id == o.product_id && image_url == o.image_url && hs_code == o.hs_code && country_of_origin == o.country_of_origin && province_of_origin == o.province_of_origin && == o. && requires_shipping == o.requires_shipping && taxable == o.taxable && gift_card == o.gift_card && vendor == o.vendor end |
#eql?(o) ⇒ Boolean
482 483 484 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 482 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
488 489 490 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 488 def hash [sku, name, quantity, unit_price, total_price, currency, weight, weight_unit, variant_id, product_id, image_url, hs_code, country_of_origin, province_of_origin, , requires_shipping, taxable, gift_card, vendor].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
279 280 281 282 283 284 285 286 287 288 289 290 291 292 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 330 331 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 279 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @name.to_s.length < 1 invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if @quantity.nil? invalid_properties.push('invalid value for "quantity", quantity cannot be nil.') end if @quantity > 9007199254740991 invalid_properties.push('invalid value for "quantity", must be smaller than or equal to 9007199254740991.') end if @quantity <= 0 invalid_properties.push('invalid value for "quantity", must be greater than 0.') end if !@unit_price.nil? && @unit_price < 0 invalid_properties.push('invalid value for "unit_price", must be greater than or equal to 0.') end if !@total_price.nil? && @total_price < 0 invalid_properties.push('invalid value for "total_price", must be greater than or equal to 0.') end if !@currency.nil? && @currency.to_s.length > 3 invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.') end if !@currency.nil? && @currency.to_s.length < 3 invalid_properties.push('invalid value for "currency", the character length must be greater than or equal to 3.') end if !@weight.nil? && @weight < 0 invalid_properties.push('invalid value for "weight", must be greater than or equal to 0.') end if !@country_of_origin.nil? && @country_of_origin.to_s.length > 2 invalid_properties.push('invalid value for "country_of_origin", the character length must be smaller than or equal to 2.') end if !@country_of_origin.nil? && @country_of_origin.to_s.length < 2 invalid_properties.push('invalid value for "country_of_origin", the character length must be greater than or equal to 2.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 517 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/zippendo/models/create_order_request_order_lines_inner.rb', line 335 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @name.to_s.length < 1 return false if @quantity.nil? return false if @quantity > 9007199254740991 return false if @quantity <= 0 return false if !@unit_price.nil? && @unit_price < 0 return false if !@total_price.nil? && @total_price < 0 return false if !@currency.nil? && @currency.to_s.length > 3 return false if !@currency.nil? && @currency.to_s.length < 3 return false if !@weight.nil? && @weight < 0 weight_unit_validator = EnumAttributeValidator.new('String', ["kg", "g", "lb", "oz"]) return false unless weight_unit_validator.valid?(@weight_unit) return false if !@country_of_origin.nil? && @country_of_origin.to_s.length > 2 return false if !@country_of_origin.nil? && @country_of_origin.to_s.length < 2 true end |