Class: AmzSpApi::VendorOrdersApiModel::OrderDetails
- Inherits:
-
Object
- Object
- AmzSpApi::VendorOrdersApiModel::OrderDetails
- Defined in:
- lib/vendor-orders-api-model/models/order_details.rb
Overview
Details of an order.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#bill_to_party ⇒ Object
Returns the value of attribute bill_to_party.
-
#buying_party ⇒ Object
Returns the value of attribute buying_party.
-
#deal_code ⇒ Object
If requested by the recipient, this field will contain a promotional/deal number.
-
#delivery_window ⇒ Object
Returns the value of attribute delivery_window.
-
#import_details ⇒ Object
Returns the value of attribute import_details.
-
#items ⇒ Object
A list of items in this purchase order.
-
#payment_method ⇒ Object
Payment method used.
-
#purchase_order_changed_date ⇒ Object
The date when purchase order was last changed by Amazon after the order was placed.
-
#purchase_order_date ⇒ Object
The date the purchase order was placed.
-
#purchase_order_state_changed_date ⇒ Object
The date when current purchase order state was changed.
-
#purchase_order_type ⇒ Object
Type of purchase order.
-
#selling_party ⇒ Object
Returns the value of attribute selling_party.
-
#ship_to_party ⇒ Object
Returns the value of attribute ship_to_party.
-
#ship_window ⇒ Object
Returns the value of attribute ship_window.
Class Method Summary collapse
-
.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.
-
#_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 ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ OrderDetails
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 = {}) ⇒ OrderDetails
Initializes the object
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 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 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 122 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `AmzSpApi::VendorOrdersApiModel::OrderDetails` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `AmzSpApi::VendorOrdersApiModel::OrderDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'purchase_order_date') self.purchase_order_date = attributes[:'purchase_order_date'] end if attributes.key?(:'purchase_order_changed_date') self.purchase_order_changed_date = attributes[:'purchase_order_changed_date'] end if attributes.key?(:'purchase_order_state_changed_date') self.purchase_order_state_changed_date = attributes[:'purchase_order_state_changed_date'] end if attributes.key?(:'purchase_order_type') self.purchase_order_type = attributes[:'purchase_order_type'] end if attributes.key?(:'import_details') self.import_details = attributes[:'import_details'] end if attributes.key?(:'deal_code') self.deal_code = attributes[:'deal_code'] end if attributes.key?(:'payment_method') self.payment_method = attributes[:'payment_method'] end if attributes.key?(:'buying_party') self. = attributes[:'buying_party'] end if attributes.key?(:'selling_party') self.selling_party = attributes[:'selling_party'] end if attributes.key?(:'ship_to_party') self.ship_to_party = attributes[:'ship_to_party'] end if attributes.key?(:'bill_to_party') self.bill_to_party = attributes[:'bill_to_party'] end if attributes.key?(:'ship_window') self.ship_window = attributes[:'ship_window'] end if attributes.key?(:'delivery_window') self.delivery_window = attributes[:'delivery_window'] end if attributes.key?(:'items') if (value = attributes[:'items']).is_a?(Array) self.items = value end end end |
Instance Attribute Details
#bill_to_party ⇒ Object
Returns the value of attribute bill_to_party.
43 44 45 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 43 def bill_to_party @bill_to_party end |
#buying_party ⇒ Object
Returns the value of attribute buying_party.
37 38 39 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 37 def @buying_party end |
#deal_code ⇒ Object
If requested by the recipient, this field will contain a promotional/deal number. The discount code line is optional. It is used to obtain a price discount on items on the order.
32 33 34 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 32 def deal_code @deal_code end |
#delivery_window ⇒ Object
Returns the value of attribute delivery_window.
47 48 49 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 47 def delivery_window @delivery_window end |
#import_details ⇒ Object
Returns the value of attribute import_details.
29 30 31 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 29 def import_details @import_details end |
#items ⇒ Object
A list of items in this purchase order.
50 51 52 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 50 def items @items end |
#payment_method ⇒ Object
Payment method used.
35 36 37 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 35 def payment_method @payment_method end |
#purchase_order_changed_date ⇒ Object
The date when purchase order was last changed by Amazon after the order was placed. This date will be greater than ‘purchaseOrderDate’. This means the PO data was changed on that date and vendors are required to fulfill the updated PO. The PO changes can be related to Item Quantity, Ship to Location, Ship Window etc. This field will not be present in orders that have not changed after creation. Must be in ISO-8601 date/time format.
21 22 23 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 21 def purchase_order_changed_date @purchase_order_changed_date end |
#purchase_order_date ⇒ Object
The date the purchase order was placed. Must be in ISO-8601 date/time format.
18 19 20 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 18 def purchase_order_date @purchase_order_date end |
#purchase_order_state_changed_date ⇒ Object
The date when current purchase order state was changed. Current purchase order state is available in the field ‘purchaseOrderState’. Must be in ISO-8601 date/time format.
24 25 26 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 24 def purchase_order_state_changed_date @purchase_order_state_changed_date end |
#purchase_order_type ⇒ Object
Type of purchase order.
27 28 29 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 27 def purchase_order_type @purchase_order_type end |
#selling_party ⇒ Object
Returns the value of attribute selling_party.
39 40 41 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 39 def selling_party @selling_party end |
#ship_to_party ⇒ Object
Returns the value of attribute ship_to_party.
41 42 43 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 41 def ship_to_party @ship_to_party end |
#ship_window ⇒ Object
Returns the value of attribute ship_window.
45 46 47 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 45 def ship_window @ship_window end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 75 def self.attribute_map { :'purchase_order_date' => :'purchaseOrderDate', :'purchase_order_changed_date' => :'purchaseOrderChangedDate', :'purchase_order_state_changed_date' => :'purchaseOrderStateChangedDate', :'purchase_order_type' => :'purchaseOrderType', :'import_details' => :'importDetails', :'deal_code' => :'dealCode', :'payment_method' => :'paymentMethod', :'buying_party' => :'buyingParty', :'selling_party' => :'sellingParty', :'ship_to_party' => :'shipToParty', :'bill_to_party' => :'billToParty', :'ship_window' => :'shipWindow', :'delivery_window' => :'deliveryWindow', :'items' => :'items' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
282 283 284 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 282 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
115 116 117 118 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 115 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 95 def self.openapi_types { :'purchase_order_date' => :'Object', :'purchase_order_changed_date' => :'Object', :'purchase_order_state_changed_date' => :'Object', :'purchase_order_type' => :'Object', :'import_details' => :'Object', :'deal_code' => :'Object', :'payment_method' => :'Object', :'buying_party' => :'Object', :'selling_party' => :'Object', :'ship_to_party' => :'Object', :'bill_to_party' => :'Object', :'ship_window' => :'Object', :'delivery_window' => :'Object', :'items' => :'Object' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 248 def ==(o) return true if self.equal?(o) self.class == o.class && purchase_order_date == o.purchase_order_date && purchase_order_changed_date == o.purchase_order_changed_date && purchase_order_state_changed_date == o.purchase_order_state_changed_date && purchase_order_type == o.purchase_order_type && import_details == o.import_details && deal_code == o.deal_code && payment_method == o.payment_method && == o. && selling_party == o.selling_party && ship_to_party == o.ship_to_party && bill_to_party == o.bill_to_party && ship_window == o.ship_window && delivery_window == o.delivery_window && items == o.items end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 312 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 AmzSpApi::VendorOrdersApiModel.const_get(type).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
381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 381 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
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 289 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_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]])) elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) end end self end |
#eql?(o) ⇒ Boolean
269 270 271 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 269 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
275 276 277 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 275 def hash [purchase_order_date, purchase_order_changed_date, purchase_order_state_changed_date, purchase_order_type, import_details, deal_code, payment_method, , selling_party, ship_to_party, bill_to_party, ship_window, delivery_window, items].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 196 def list_invalid_properties invalid_properties = Array.new if @purchase_order_date.nil? invalid_properties.push('invalid value for "purchase_order_date", purchase_order_date cannot be nil.') end if @purchase_order_state_changed_date.nil? invalid_properties.push('invalid value for "purchase_order_state_changed_date", purchase_order_state_changed_date cannot be nil.') end if @items.nil? invalid_properties.push('invalid value for "items", items cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
357 358 359 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 357 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 363 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 |
#to_s ⇒ String
Returns the string representation of the object
351 352 353 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 351 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
215 216 217 218 219 220 221 222 223 224 |
# File 'lib/vendor-orders-api-model/models/order_details.rb', line 215 def valid? return false if @purchase_order_date.nil? return false if @purchase_order_state_changed_date.nil? purchase_order_type_validator = EnumAttributeValidator.new('Object', ['RegularOrder', 'ConsignedOrder', 'NewProductIntroduction', 'RushOrder']) return false unless purchase_order_type_validator.valid?(@purchase_order_type) payment_method_validator = EnumAttributeValidator.new('Object', ['Invoice', 'Consignment', 'CreditCard', 'Prepaid']) return false unless payment_method_validator.valid?(@payment_method) return false if @items.nil? true end |