Class: WalmartApIs::Payload3
- Defined in:
- lib/walmart_ap_is/models/payload3.rb
Overview
Payload3 Model.
Instance Attribute Summary collapse
-
#ineligible_rates ⇒ Array[IneligibleRate]
TODO: Write general description for this method.
-
#rates ⇒ Array[Rate]
TODO: Write general description for this method.
-
#request_token ⇒ String
Opaque token to be passed back on subsequent purchaseShipment or getAdditionalInputs calls to identify this rate quote session.
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(rates: SKIP, ineligible_rates: SKIP, request_token: SKIP, additional_properties: nil) ⇒ Payload3
constructor
A new instance of Payload3.
-
#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(rates: SKIP, ineligible_rates: SKIP, request_token: SKIP, additional_properties: nil) ⇒ Payload3
Returns a new instance of Payload3.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 49 def initialize(rates: SKIP, ineligible_rates: SKIP, request_token: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @rates = rates unless rates == SKIP @ineligible_rates = ineligible_rates unless ineligible_rates == SKIP @request_token = request_token unless request_token == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#ineligible_rates ⇒ Array[IneligibleRate]
TODO: Write general description for this method
18 19 20 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 18 def ineligible_rates @ineligible_rates end |
#rates ⇒ Array[Rate]
TODO: Write general description for this method
14 15 16 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 14 def rates @rates end |
#request_token ⇒ String
Opaque token to be passed back on subsequent purchaseShipment or getAdditionalInputs calls to identify this rate quote session.
24 25 26 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 24 def request_token @request_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 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 91 92 93 94 95 96 97 98 99 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 61 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 rates = nil unless hash['rates'].nil? rates = [] hash['rates'].each do |structure| rates << (Rate.from_hash(structure) if structure) end end rates = SKIP unless hash.key?('rates') # Parameter is an array, so we need to iterate through it ineligible_rates = nil unless hash['ineligibleRates'].nil? ineligible_rates = [] hash['ineligibleRates'].each do |structure| ineligible_rates << (IneligibleRate.from_hash(structure) if structure) end end ineligible_rates = SKIP unless hash.key?('ineligibleRates') request_token = hash.key?('requestToken') ? hash['requestToken'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Payload3.new(rates: rates, ineligible_rates: ineligible_rates, request_token: request_token, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['rates'] = 'rates' @_hash['ineligible_rates'] = 'ineligibleRates' @_hash['request_token'] = 'requestToken' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 36 def self.optionals %w[ rates ineligible_rates request_token ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
109 110 111 112 113 114 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 109 def inspect class_name = self.class.name.split('::').last "<#{class_name} rates: #{@rates.inspect}, ineligible_rates: #{@ineligible_rates.inspect},"\ " request_token: #{@request_token.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
102 103 104 105 106 |
# File 'lib/walmart_ap_is/models/payload3.rb', line 102 def to_s class_name = self.class.name.split('::').last "<#{class_name} rates: #{@rates}, ineligible_rates: #{@ineligible_rates}, request_token:"\ " #{@request_token}, additional_properties: #{@additional_properties}>" end |