Class: WalmartApIs::FeesEstimateByIdRequest

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

Overview

A single fee estimate request for the batch endpoint. Combines the item identifier (IdType + IdValue) with the fee estimate parameters. Mirrors SP-API FeesEstimateByIdRequest.

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(id_type:, id_value:, fees_estimate_request:, additional_properties: nil) ⇒ FeesEstimateByIdRequest

Returns a new instance of FeesEstimateByIdRequest.



46
47
48
49
50
51
52
53
54
55
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 46

def initialize(id_type:, id_value:, fees_estimate_request:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id_type = id_type
  @id_value = id_value
  @fees_estimate_request = fees_estimate_request
  @additional_properties = additional_properties
end

Instance Attribute Details

#fees_estimate_requestFeesEstimateRequest

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

Returns:



25
26
27
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 25

def fees_estimate_request
  @fees_estimate_request
end

#id_typeIdType

Type of item identifier.

Returns:



16
17
18
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 16

def id_type
  @id_type
end

#id_valueString

The item identifier value (Walmart Item ID or Seller SKU).

Returns:

  • (String)


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

def id_value
  @id_value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id_type = hash.key?('IdType') ? hash['IdType'] : nil
  id_value = hash.key?('IdValue') ? hash['IdValue'] : nil
  fees_estimate_request = FeesEstimateRequest.from_hash(hash['FeesEstimateRequest']) if
    hash['FeesEstimateRequest']

  # 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.
  FeesEstimateByIdRequest.new(id_type: id_type,
                              id_value: id_value,
                              fees_estimate_request: fees_estimate_request,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id_type'] = 'IdType'
  @_hash['id_value'] = 'IdValue'
  @_hash['fees_estimate_request'] = 'FeesEstimateRequest'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 37

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
94
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 89

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id_type: #{@id_type.inspect}, id_value: #{@id_value.inspect},"\
  " fees_estimate_request: #{@fees_estimate_request.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/walmart_ap_is/models/fees_estimate_by_id_request.rb', line 82

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id_type: #{@id_type}, id_value: #{@id_value}, fees_estimate_request:"\
  " #{@fees_estimate_request}, additional_properties: #{@additional_properties}>"
end