Class: WalmartApIs::FeesEstimateResult
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::FeesEstimateResult
- Defined in:
- lib/walmart_ap_is/models/fees_estimate_result.rb
Overview
Fee estimate result for one item. Status indicates Success, ClientError, or ServiceError. Mirrors SP-API FeesEstimateResult.
Instance Attribute Summary collapse
-
#error ⇒ FeesEstimateError
Error detail when a fee estimate could not be computed.
-
#fees_estimate ⇒ FeesEstimate
The estimated fees broken down by component.
-
#fees_estimate_identifier ⇒ FeesEstimateIdentifier
Echoes back the item identifier and request parameters that produced this result.
-
#status ⇒ Status4
Outcome of the fee estimate.
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(status: SKIP, fees_estimate_identifier: SKIP, fees_estimate: SKIP, error: SKIP, additional_properties: nil) ⇒ FeesEstimateResult
constructor
A new instance of FeesEstimateResult.
-
#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(status: SKIP, fees_estimate_identifier: SKIP, fees_estimate: SKIP, error: SKIP, additional_properties: nil) ⇒ FeesEstimateResult
Returns a new instance of FeesEstimateResult.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 56 def initialize(status: SKIP, fees_estimate_identifier: SKIP, fees_estimate: SKIP, error: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @status = status unless status == SKIP @fees_estimate_identifier = fees_estimate_identifier unless fees_estimate_identifier == SKIP @fees_estimate = fees_estimate unless fees_estimate == SKIP @error = error unless error == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#error ⇒ FeesEstimateError
Error detail when a fee estimate could not be computed.
29 30 31 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 29 def error @error end |
#fees_estimate ⇒ FeesEstimate
The estimated fees broken down by component. Mirrors SP-API FeesEstimate.
25 26 27 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 25 def fees_estimate @fees_estimate end |
#fees_estimate_identifier ⇒ FeesEstimateIdentifier
Echoes back the item identifier and request parameters that produced this result. Mirrors SP-API FeesEstimateIdentifier.
20 21 22 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 20 def fees_estimate_identifier @fees_estimate_identifier end |
#status ⇒ Status4
Outcome of the fee estimate.
15 16 17 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 15 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. status = hash.key?('Status') ? hash['Status'] : SKIP fees_estimate_identifier = FeesEstimateIdentifier.from_hash(hash['FeesEstimateIdentifier']) if hash['FeesEstimateIdentifier'] fees_estimate = FeesEstimate.from_hash(hash['FeesEstimate']) if hash['FeesEstimate'] error = FeesEstimateError.from_hash(hash['Error']) if hash['Error'] # 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. FeesEstimateResult.new(status: status, fees_estimate_identifier: fees_estimate_identifier, fees_estimate: fees_estimate, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
32 33 34 35 36 37 38 39 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 32 def self.names @_hash = {} if @_hash.nil? @_hash['status'] = 'Status' @_hash['fees_estimate_identifier'] = 'FeesEstimateIdentifier' @_hash['fees_estimate'] = 'FeesEstimate' @_hash['error'] = 'Error' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 52 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
42 43 44 45 46 47 48 49 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 42 def self.optionals %w[ status fees_estimate_identifier fees_estimate error ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
103 104 105 106 107 108 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 103 def inspect class_name = self.class.name.split('::').last "<#{class_name} status: #{@status.inspect}, fees_estimate_identifier:"\ " #{@fees_estimate_identifier.inspect}, fees_estimate: #{@fees_estimate.inspect}, error:"\ " #{@error.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
95 96 97 98 99 100 |
# File 'lib/walmart_ap_is/models/fees_estimate_result.rb', line 95 def to_s class_name = self.class.name.split('::').last "<#{class_name} status: #{@status}, fees_estimate_identifier: #{@fees_estimate_identifier},"\ " fees_estimate: #{@fees_estimate}, error: #{@error}, additional_properties:"\ " #{@additional_properties}>" end |