Class: WalmartApIs::FeesEstimateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/fees_estimate_request.rb

Overview

Fee estimate parameters for a single item. Used in both single-item and batch endpoints. Mirrors SP-API FeesEstimateRequest.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(marketplace_id:, is_walmart_fulfilled:, price_to_estimate_fees:, identifier: SKIP, optional_fulfillment_program: SKIP, additional_properties: nil) ⇒ FeesEstimateRequest

Returns a new instance of FeesEstimateRequest.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 58

def initialize(marketplace_id:, is_walmart_fulfilled:,
               price_to_estimate_fees:, identifier: SKIP,
               optional_fulfillment_program: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @marketplace_id = marketplace_id
  @is_walmart_fulfilled = is_walmart_fulfilled
  @price_to_estimate_fees = price_to_estimate_fees
  @identifier = identifier unless identifier == SKIP
  unless optional_fulfillment_program == SKIP
    @optional_fulfillment_program =
      optional_fulfillment_program
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#identifierString

A caller-supplied identifier echoed back in the response for correlation.

Returns:

  • (String)


28
29
30
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 28

def identifier
  @identifier
end

#is_walmart_fulfilledTrueClass | FalseClass

true if fulfilled by Walmart Fulfillment Services (WFS); false for seller-fulfilled.

Returns:

  • (TrueClass | FalseClass)


20
21
22
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 20

def is_walmart_fulfilled
  @is_walmart_fulfilled
end

#marketplace_idMarketplaceId

Marketplace identifier.

Returns:



15
16
17
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 15

def marketplace_id
  @marketplace_id
end

#optional_fulfillment_programOptionalFulfillmentProgram

Optional fulfillment program override for WFS items.



32
33
34
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 32

def optional_fulfillment_program
  @optional_fulfillment_program
end

#price_to_estimate_feesPriceToEstimateFees

Price information used to estimate fees.

Returns:



24
25
26
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 24

def price_to_estimate_fees
  @price_to_estimate_fees
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  marketplace_id = hash.key?('MarketplaceId') ? hash['MarketplaceId'] : nil
  is_walmart_fulfilled =
    hash.key?('IsWalmartFulfilled') ? hash['IsWalmartFulfilled'] : nil
  price_to_estimate_fees = PriceToEstimateFees.from_hash(hash['PriceToEstimateFees']) if
    hash['PriceToEstimateFees']
  identifier = hash.key?('Identifier') ? hash['Identifier'] : SKIP
  optional_fulfillment_program =
    hash.key?('OptionalFulfillmentProgram') ? hash['OptionalFulfillmentProgram'] : 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.
  FeesEstimateRequest.new(marketplace_id: marketplace_id,
                          is_walmart_fulfilled: is_walmart_fulfilled,
                          price_to_estimate_fees: price_to_estimate_fees,
                          identifier: identifier,
                          optional_fulfillment_program: optional_fulfillment_program,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['marketplace_id'] = 'MarketplaceId'
  @_hash['is_walmart_fulfilled'] = 'IsWalmartFulfilled'
  @_hash['price_to_estimate_fees'] = 'PriceToEstimateFees'
  @_hash['identifier'] = 'Identifier'
  @_hash['optional_fulfillment_program'] = 'OptionalFulfillmentProgram'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 46

def self.optionals
  %w[
    identifier
    optional_fulfillment_program
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
122
123
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id.inspect}, is_walmart_fulfilled:"\
  " #{@is_walmart_fulfilled.inspect}, price_to_estimate_fees:"\
  " #{@price_to_estimate_fees.inspect}, identifier: #{@identifier.inspect},"\
  " optional_fulfillment_program: #{@optional_fulfillment_program.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
113
# File 'lib/walmart_ap_is/models/fees_estimate_request.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} marketplace_id: #{@marketplace_id}, is_walmart_fulfilled:"\
  " #{@is_walmart_fulfilled}, price_to_estimate_fees: #{@price_to_estimate_fees}, identifier:"\
  " #{@identifier}, optional_fulfillment_program: #{@optional_fulfillment_program},"\
  " additional_properties: #{@additional_properties}>"
end