Class: NewStoreApi::RequestServiceLevelRates
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::RequestServiceLevelRates
- Defined in:
- lib/new_store_api/models/request_service_level_rates.rb
Overview
RequestServiceLevelRates Model.
Instance Attribute Summary collapse
-
#channel_type ⇒ String
TODO: Write general description for this method.
-
#demand_location_id ⇒ String
The demand location is used as input to provider rates customization webhooks.
-
#products ⇒ Array[Product1]
List of all products meant to be shipped to the customer.
-
#recipient_address ⇒ Address
The destination address.
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.
Instance Method Summary collapse
-
#initialize(products = nil, recipient_address = nil, channel_type = SKIP, demand_location_id = SKIP) ⇒ RequestServiceLevelRates
constructor
A new instance of RequestServiceLevelRates.
-
#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(products = nil, recipient_address = nil, channel_type = SKIP, demand_location_id = SKIP) ⇒ RequestServiceLevelRates
Returns a new instance of RequestServiceLevelRates.
56 57 58 59 60 61 62 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 56 def initialize(products = nil, recipient_address = nil, channel_type = SKIP, demand_location_id = SKIP) @channel_type = channel_type unless channel_type == SKIP @demand_location_id = demand_location_id unless demand_location_id == SKIP @products = products @recipient_address = recipient_address end |
Instance Attribute Details
#channel_type ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 14 def channel_type @channel_type end |
#demand_location_id ⇒ String
The demand location is used as input to provider rates customization webhooks
19 20 21 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 19 def demand_location_id @demand_location_id end |
#products ⇒ Array[Product1]
List of all products meant to be shipped to the customer.
23 24 25 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 23 def products @products end |
#recipient_address ⇒ Address
The destination address. A carrier may reject providing rates if there are missing information.
28 29 30 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 28 def recipient_address @recipient_address end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 65 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 products = nil unless hash['products'].nil? products = [] hash['products'].each do |structure| products << (Product1.from_hash(structure) if structure) end end products = nil unless hash.key?('products') recipient_address = Address.from_hash(hash['recipient_address']) if hash['recipient_address'] channel_type = hash.key?('channel_type') ? hash['channel_type'] : SKIP demand_location_id = hash.key?('demand_location_id') ? hash['demand_location_id'] : SKIP # Create object from extracted values. RequestServiceLevelRates.new(products, recipient_address, channel_type, demand_location_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['channel_type'] = 'channel_type' @_hash['demand_location_id'] = 'demand_location_id' @_hash['products'] = 'products' @_hash['recipient_address'] = 'recipient_address' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 52 53 54 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 49 def self.nullables %w[ channel_type demand_location_id ] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 41 def self.optionals %w[ channel_type demand_location_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 104 105 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 100 def inspect class_name = self.class.name.split('::').last "<#{class_name} channel_type: #{@channel_type.inspect}, demand_location_id:"\ " #{@demand_location_id.inspect}, products: #{@products.inspect}, recipient_address:"\ " #{@recipient_address.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/new_store_api/models/request_service_level_rates.rb', line 93 def to_s class_name = self.class.name.split('::').last "<#{class_name} channel_type: #{@channel_type}, demand_location_id: #{@demand_location_id},"\ " products: #{@products}, recipient_address: #{@recipient_address}>" end |