Class: NewStoreApi::InjectedOrderShipment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::InjectedOrderShipment
- Defined in:
- lib/new_store_api/models/injected_order_shipment.rb
Overview
A shipment sent from a fulfillment location.
Instance Attribute Summary collapse
-
#items ⇒ Array[InjectedOrderShipmentItem]
TODO: Write general description for this method.
-
#shipping_option ⇒ Object
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(items = nil, shipping_option = nil) ⇒ InjectedOrderShipment
constructor
A new instance of InjectedOrderShipment.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(items = nil, shipping_option = nil) ⇒ InjectedOrderShipment
Returns a new instance of InjectedOrderShipment.
38 39 40 41 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 38 def initialize(items = nil, shipping_option = nil) @items = items @shipping_option = shipping_option end |
Instance Attribute Details
#items ⇒ Array[InjectedOrderShipmentItem]
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 14 def items @items end |
#shipping_option ⇒ Object
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 18 def shipping_option @shipping_option end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 44 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it items = nil unless hash['items'].nil? items = [] hash['items'].each do |structure| items << (InjectedOrderShipmentItem.from_hash(structure) if structure) end end items = nil unless hash.key?('items') shipping_option = hash.key?('shipping_option') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:InjectedOrderShippingOption2), hash['shipping_option'] ) : nil # Create object from extracted values. InjectedOrderShipment.new(items, shipping_option) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['items'] = 'items' @_hash['shipping_option'] = 'shipping_option' @_hash end |
.nullables ⇒ Object
An array for nullable fields
34 35 36 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 34 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 29 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 69 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.items, ->(val) { InjectedOrderShipmentItem.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and UnionTypeLookUp.get(:InjectedOrderShippingOption2) .validate(value.shipping_option) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['items'], ->(val) { InjectedOrderShipmentItem.validate(val) }, is_model_hash: true, is_inner_model_hash: true) and UnionTypeLookUp.get(:InjectedOrderShippingOption2) .validate(value['shipping_option']) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 100 def inspect class_name = self.class.name.split('::').last "<#{class_name} items: #{@items.inspect}, shipping_option: #{@shipping_option.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 |
# File 'lib/new_store_api/models/injected_order_shipment.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} items: #{@items}, shipping_option: #{@shipping_option}>" end |