Class: WalmartApIs::FeeDetail
- Defined in:
- lib/walmart_ap_is/models/fee_detail.rb
Overview
Detail for a single fee component. May nest sub-fees in IncludedFeeDetailList. Mirrors SP-API FeeDetail.
Instance Attribute Summary collapse
-
#fee_amount ⇒ MoneyType1
Currency amount.
-
#fee_promotion ⇒ MoneyType1
Currency amount.
-
#fee_type ⇒ String
Fee type, e.g.
-
#final_fee ⇒ MoneyType1
Currency amount.
-
#tax_amount ⇒ MoneyType1
Currency amount.
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(fee_type:, fee_amount:, final_fee:, fee_promotion: SKIP, tax_amount: SKIP, additional_properties: nil) ⇒ FeeDetail
constructor
A new instance of FeeDetail.
-
#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(fee_type:, fee_amount:, final_fee:, fee_promotion: SKIP, tax_amount: SKIP, additional_properties: nil) ⇒ FeeDetail
Returns a new instance of FeeDetail.
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 57 def initialize(fee_type:, fee_amount:, final_fee:, fee_promotion: SKIP, tax_amount: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @fee_type = fee_type @fee_amount = fee_amount @fee_promotion = fee_promotion unless fee_promotion == SKIP @tax_amount = tax_amount unless tax_amount == SKIP @final_fee = final_fee @additional_properties = additional_properties end |
Instance Attribute Details
#fee_amount ⇒ MoneyType1
Currency amount.
19 20 21 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 19 def fee_amount @fee_amount end |
#fee_promotion ⇒ MoneyType1
Currency amount.
23 24 25 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 23 def fee_promotion @fee_promotion end |
#fee_type ⇒ String
Fee type, e.g. ReferralFee, WFSFulfillmentFee, VariableClosingFee.
15 16 17 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 15 def fee_type @fee_type end |
#final_fee ⇒ MoneyType1
Currency amount.
31 32 33 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 31 def final_fee @final_fee end |
#tax_amount ⇒ MoneyType1
Currency amount.
27 28 29 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 27 def tax_amount @tax_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. fee_type = hash.key?('FeeType') ? hash['FeeType'] : nil fee_amount = MoneyType1.from_hash(hash['FeeAmount']) if hash['FeeAmount'] final_fee = MoneyType1.from_hash(hash['FinalFee']) if hash['FinalFee'] fee_promotion = MoneyType1.from_hash(hash['FeePromotion']) if hash['FeePromotion'] tax_amount = MoneyType1.from_hash(hash['TaxAmount']) if hash['TaxAmount'] # 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. FeeDetail.new(fee_type: fee_type, fee_amount: fee_amount, final_fee: final_fee, fee_promotion: fee_promotion, tax_amount: tax_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['fee_type'] = 'FeeType' @_hash['fee_amount'] = 'FeeAmount' @_hash['fee_promotion'] = 'FeePromotion' @_hash['tax_amount'] = 'TaxAmount' @_hash['final_fee'] = 'FinalFee' @_hash end |
.nullables ⇒ Object
An array for nullable fields
53 54 55 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 53 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 45 def self.optionals %w[ fee_promotion tax_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
106 107 108 109 110 111 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 106 def inspect class_name = self.class.name.split('::').last "<#{class_name} fee_type: #{@fee_type.inspect}, fee_amount: #{@fee_amount.inspect},"\ " fee_promotion: #{@fee_promotion.inspect}, tax_amount: #{@tax_amount.inspect}, final_fee:"\ " #{@final_fee.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 103 |
# File 'lib/walmart_ap_is/models/fee_detail.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} fee_type: #{@fee_type}, fee_amount: #{@fee_amount}, fee_promotion:"\ " #{@fee_promotion}, tax_amount: #{@tax_amount}, final_fee: #{@final_fee},"\ " additional_properties: #{@additional_properties}>" end |