Class: NewStoreApi::HistoricalShippingOption
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::HistoricalShippingOption
- Defined in:
- lib/new_store_api/models/historical_shipping_option.rb
Overview
HistoricalShippingOption Model.
Instance Attribute Summary collapse
-
#country_code ⇒ CountryCodeEnum
Country code in ISO 3166 ALPHA-2 format.
-
#delivery_details ⇒ String
Shipping option display details, in case of traditional carrier contains estimated delivery time.
-
#discount_info ⇒ Array[Object]
Information about shipping discounts applied to the shipment.
-
#display_name ⇒ String
Shipping option display name.
-
#fulfillment_node_id ⇒ String
Identifier of the fulfillment node preselected for that shipment.
-
#price ⇒ Float
The price of the shipping option before discounts.
-
#service_level_identifier ⇒ String
Service level identifier of the shipping option.
-
#shipping_carrier ⇒ String
Shipping carrier code, e.g.
-
#shipping_type ⇒ ShippingTypeEnum
Shipping type.
-
#store_id ⇒ String
Identifier of the store preselected for that shipment.
-
#tax ⇒ Float
The tax applied to the shipping option.
-
#zip_code ⇒ String
Shipping origin zip code.
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(country_code = nil, display_name = nil, fulfillment_node_id = nil, price = nil, service_level_identifier = nil, shipping_carrier = nil, shipping_type = nil, tax = nil, zip_code = nil, delivery_details = SKIP, discount_info = SKIP, store_id = SKIP) ⇒ HistoricalShippingOption
constructor
A new instance of HistoricalShippingOption.
-
#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(country_code = nil, display_name = nil, fulfillment_node_id = nil, price = nil, service_level_identifier = nil, shipping_carrier = nil, shipping_type = nil, tax = nil, zip_code = nil, delivery_details = SKIP, discount_info = SKIP, store_id = SKIP) ⇒ HistoricalShippingOption
Returns a new instance of HistoricalShippingOption.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 96 def initialize(country_code = nil, display_name = nil, fulfillment_node_id = nil, price = nil, service_level_identifier = nil, shipping_carrier = nil, shipping_type = nil, tax = nil, zip_code = nil, delivery_details = SKIP, discount_info = SKIP, store_id = SKIP) @country_code = country_code @delivery_details = delivery_details unless delivery_details == SKIP @discount_info = discount_info unless discount_info == SKIP @display_name = display_name @fulfillment_node_id = fulfillment_node_id @price = price @service_level_identifier = service_level_identifier @shipping_carrier = shipping_carrier @shipping_type = shipping_type @store_id = store_id unless store_id == SKIP @tax = tax @zip_code = zip_code end |
Instance Attribute Details
#country_code ⇒ CountryCodeEnum
Country code in ISO 3166 ALPHA-2 format.
14 15 16 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 14 def country_code @country_code end |
#delivery_details ⇒ String
Shipping option display details, in case of traditional carrier contains estimated delivery time.
19 20 21 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 19 def delivery_details @delivery_details end |
#discount_info ⇒ Array[Object]
Information about shipping discounts applied to the shipment.
23 24 25 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 23 def discount_info @discount_info end |
#display_name ⇒ String
Shipping option display name.
27 28 29 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 27 def display_name @display_name end |
#fulfillment_node_id ⇒ String
Identifier of the fulfillment node preselected for that shipment.
31 32 33 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 31 def fulfillment_node_id @fulfillment_node_id end |
#price ⇒ Float
The price of the shipping option before discounts. It might include taxes depending on the tax method.
36 37 38 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 36 def price @price end |
#service_level_identifier ⇒ String
Service level identifier of the shipping option. Set it to IN_STORE_HANDOVER in case of injecting an in-store purchase order.
41 42 43 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 41 def service_level_identifier @service_level_identifier end |
#shipping_carrier ⇒ String
Shipping carrier code, e.g. 'USPS' or 'Deliv'.
45 46 47 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 45 def shipping_carrier @shipping_carrier end |
#shipping_type ⇒ ShippingTypeEnum
Shipping type.
49 50 51 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 49 def shipping_type @shipping_type end |
#store_id ⇒ String
Identifier of the store preselected for that shipment. Required for in_store_pick_up and in_store_handover.
54 55 56 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 54 def store_id @store_id end |
#tax ⇒ Float
The tax applied to the shipping option.
58 59 60 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 58 def tax @tax end |
#zip_code ⇒ String
Shipping origin zip code.
62 63 64 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 62 def zip_code @zip_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 117 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_code = hash.key?('country_code') ? hash['country_code'] : nil display_name = hash.key?('display_name') ? hash['display_name'] : nil fulfillment_node_id = hash.key?('fulfillment_node_id') ? hash['fulfillment_node_id'] : nil price = hash.key?('price') ? hash['price'] : nil service_level_identifier = hash.key?('service_level_identifier') ? hash['service_level_identifier'] : nil shipping_carrier = hash.key?('shipping_carrier') ? hash['shipping_carrier'] : nil shipping_type = hash.key?('shipping_type') ? hash['shipping_type'] : nil tax = hash.key?('tax') ? hash['tax'] : nil zip_code = hash.key?('zip_code') ? hash['zip_code'] : nil delivery_details = hash.key?('delivery_details') ? hash['delivery_details'] : SKIP discount_info = hash.key?('discount_info') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:InjectedOrderDiscountInfo2), hash['discount_info'] ) : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP # Create object from extracted values. HistoricalShippingOption.new(country_code, display_name, fulfillment_node_id, price, service_level_identifier, shipping_carrier, shipping_type, tax, zip_code, delivery_details, discount_info, store_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['country_code'] = 'country_code' @_hash['delivery_details'] = 'delivery_details' @_hash['discount_info'] = 'discount_info' @_hash['display_name'] = 'display_name' @_hash['fulfillment_node_id'] = 'fulfillment_node_id' @_hash['price'] = 'price' @_hash['service_level_identifier'] = 'service_level_identifier' @_hash['shipping_carrier'] = 'shipping_carrier' @_hash['shipping_type'] = 'shipping_type' @_hash['store_id'] = 'store_id' @_hash['tax'] = 'tax' @_hash['zip_code'] = 'zip_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
92 93 94 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 92 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
83 84 85 86 87 88 89 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 83 def self.optionals %w[ delivery_details discount_info store_id ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
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 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 157 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.country_code, ->(val) { CountryCodeEnum.validate(val) }) and APIHelper.valid_type?(value.display_name, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.fulfillment_node_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.price, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.service_level_identifier, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.shipping_carrier, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.shipping_type, ->(val) { ShippingTypeEnum.validate(val) }) and APIHelper.valid_type?(value.tax, ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value.zip_code, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['country_code'], ->(val) { CountryCodeEnum.validate(val) }) and APIHelper.valid_type?(value['display_name'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['fulfillment_node_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['price'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['service_level_identifier'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['shipping_carrier'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['shipping_type'], ->(val) { ShippingTypeEnum.validate(val) }) and APIHelper.valid_type?(value['tax'], ->(val) { val.instance_of? Float }) and APIHelper.valid_type?(value['zip_code'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
216 217 218 219 220 221 222 223 224 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 216 def inspect class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code.inspect}, delivery_details:"\ " #{@delivery_details.inspect}, discount_info: #{@discount_info.inspect}, display_name:"\ " #{@display_name.inspect}, fulfillment_node_id: #{@fulfillment_node_id.inspect}, price:"\ " #{@price.inspect}, service_level_identifier: #{@service_level_identifier.inspect},"\ " shipping_carrier: #{@shipping_carrier.inspect}, shipping_type: #{@shipping_type.inspect},"\ " store_id: #{@store_id.inspect}, tax: #{@tax.inspect}, zip_code: #{@zip_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
206 207 208 209 210 211 212 213 |
# File 'lib/new_store_api/models/historical_shipping_option.rb', line 206 def to_s class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code}, delivery_details: #{@delivery_details},"\ " discount_info: #{@discount_info}, display_name: #{@display_name}, fulfillment_node_id:"\ " #{@fulfillment_node_id}, price: #{@price}, service_level_identifier:"\ " #{@service_level_identifier}, shipping_carrier: #{@shipping_carrier}, shipping_type:"\ " #{@shipping_type}, store_id: #{@store_id}, tax: #{@tax}, zip_code: #{@zip_code}>" end |