Class: Zippendo::CreateShipmentRequestParcelsInnerOrderLinesInner
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::CreateShipmentRequestParcelsInnerOrderLinesInner
- Defined in:
- lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb
Instance Attribute Summary collapse
-
#country_of_origin ⇒ Object
ISO 3166-1 alpha-2 country of origin.
-
#currency ⇒ Object
ISO 4217 currency code.
-
#description ⇒ Object
Human-readable product description.
-
#id ⇒ Object
Unique order line identifier.
-
#location ⇒ Object
Warehouse picking location.
-
#quantity ⇒ Object
Number of units in this order line.
-
#sku ⇒ Object
Stock keeping unit of the product.
-
#tarrif_number ⇒ Object
Customs tariff (HS) code.
-
#unit_price ⇒ Object
Price per unit in the order line currency.
-
#vat_percent ⇒ Object
VAT percentage applied to the unit price.
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 = {}) ⇒ CreateShipmentRequestParcelsInnerOrderLinesInner
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 = {}) ⇒ CreateShipmentRequestParcelsInnerOrderLinesInner
Initializes the object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 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 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 104 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateShipmentRequestParcelsInnerOrderLinesInner` 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::CreateShipmentRequestParcelsInnerOrderLinesInner`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'sku') self.sku = attributes[:'sku'] else self.sku = nil end if attributes.key?(:'quantity') self.quantity = attributes[:'quantity'] else self.quantity = nil end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'unit_price') self.unit_price = attributes[:'unit_price'] end if attributes.key?(:'currency') self.currency = attributes[:'currency'] end if attributes.key?(:'vat_percent') self.vat_percent = attributes[:'vat_percent'] end if attributes.key?(:'location') self.location = attributes[:'location'] end if attributes.key?(:'country_of_origin') self.country_of_origin = attributes[:'country_of_origin'] end if attributes.key?(:'tarrif_number') self.tarrif_number = attributes[:'tarrif_number'] end end |
Instance Attribute Details
#country_of_origin ⇒ Object
ISO 3166-1 alpha-2 country of origin.
43 44 45 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 43 def country_of_origin @country_of_origin end |
#currency ⇒ Object
ISO 4217 currency code.
34 35 36 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 34 def currency @currency end |
#description ⇒ Object
Human-readable product description.
28 29 30 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 28 def description @description end |
#id ⇒ Object
Unique order line identifier.
19 20 21 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 19 def id @id end |
#location ⇒ Object
Warehouse picking location.
40 41 42 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 40 def location @location end |
#quantity ⇒ Object
Number of units in this order line.
25 26 27 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 25 def quantity @quantity end |
#sku ⇒ Object
Stock keeping unit of the product.
22 23 24 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 22 def sku @sku end |
#tarrif_number ⇒ Object
Customs tariff (HS) code.
46 47 48 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 46 def tarrif_number @tarrif_number end |
#unit_price ⇒ Object
Price per unit in the order line currency.
31 32 33 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 31 def unit_price @unit_price end |
#vat_percent ⇒ Object
VAT percentage applied to the unit price.
37 38 39 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 37 def vat_percent @vat_percent end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
65 66 67 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 65 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
70 71 72 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 70 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 49 def self.attribute_map { :'id' => :'id', :'sku' => :'sku', :'quantity' => :'quantity', :'description' => :'description', :'unit_price' => :'unitPrice', :'currency' => :'currency', :'vat_percent' => :'vatPercent', :'location' => :'location', :'country_of_origin' => :'countryOfOrigin', :'tarrif_number' => :'tarrifNumber' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 364 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
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 91 def self.openapi_nullable Set.new([ :'description', :'unit_price', :'currency', :'vat_percent', :'location', :'tarrif_number' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 75 def self.openapi_types { :'id' => :'String', :'sku' => :'String', :'quantity' => :'Integer', :'description' => :'String', :'unit_price' => :'Float', :'currency' => :'String', :'vat_percent' => :'Float', :'location' => :'String', :'country_of_origin' => :'String', :'tarrif_number' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 334 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && sku == o.sku && quantity == o.quantity && description == o.description && unit_price == o.unit_price && currency == o.currency && vat_percent == o.vat_percent && location == o.location && country_of_origin == o.country_of_origin && tarrif_number == o.tarrif_number end |
#eql?(o) ⇒ Boolean
351 352 353 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 351 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
357 358 359 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 357 def hash [id, sku, quantity, description, unit_price, currency, vat_percent, location, country_of_origin, tarrif_number].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 165 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @sku.nil? invalid_properties.push('invalid value for "sku", sku cannot be nil.') end if @sku.to_s.length < 1 invalid_properties.push('invalid value for "sku", 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 < 1 invalid_properties.push('invalid value for "quantity", must be greater than or equal to 1.') end if !@description.nil? && @description.to_s.length < 1 invalid_properties.push('invalid value for "description", the character length must be greater than or equal to 1.') 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 !@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 !@vat_percent.nil? && @vat_percent < 0 invalid_properties.push('invalid value for "vat_percent", 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
386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 386 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
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/zippendo/models/create_shipment_request_parcels_inner_order_lines_inner.rb', line 221 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @sku.nil? return false if @sku.to_s.length < 1 return false if @quantity.nil? return false if @quantity > 9007199254740991 return false if @quantity < 1 return false if !@description.nil? && @description.to_s.length < 1 return false if !@unit_price.nil? && @unit_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 !@vat_percent.nil? && @vat_percent < 0 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 |