Class: WalmartApIs::ItemOffersRequest

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

Overview

List of request parameters accepted by the getItemOffers operation.

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(uri:, method:, marketplace_id:, item_condition:, headers: SKIP, customer_type: SKIP, walmart_item_id: SKIP, additional_properties: nil) ⇒ ItemOffersRequest

Returns a new instance of ItemOffersRequest.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 72

def initialize(uri:, method:, marketplace_id:, item_condition:,
               headers: SKIP, customer_type: SKIP, walmart_item_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @uri = uri
  @method = method
  @headers = headers unless headers == SKIP
  @marketplace_id = marketplace_id
  @item_condition = item_condition
  @customer_type = customer_type unless customer_type == SKIP
  @walmart_item_id = walmart_item_id unless walmart_item_id == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#customer_typeCustomerType

Indicates whether to request Consumer or Business offers. Default is Consumer.

Returns:



39
40
41
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 39

def customer_type
  @customer_type
end

#headersObject

A mapping of additional HTTP headers to send for the individual batch request.

Returns:

  • (Object)


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

def headers
  @headers
end

#item_conditionConditionType2

Indicates the condition of the item. Possible values: New, Used, Collectible, Refurbished, Club.

Returns:



34
35
36
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 34

def item_condition
  @item_condition
end

#marketplace_idString

A marketplace identifier.

Returns:

  • (String)


29
30
31
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 29

def marketplace_id
  @marketplace_id
end

#methodHttpMethod

The HTTP method associated with the individual APIs being called as part of the batch request.

Returns:



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

def method
  @method
end

#uriString

The resource path of the operation being called in batch, without query parameters.

Returns:

  • (String)


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

def uri
  @uri
end

#walmart_item_idString

The Walmart Item ID of the item (see ADR-029).

Returns:

  • (String)


43
44
45
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 43

def walmart_item_id
  @walmart_item_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 89

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  uri = hash.key?('uri') ? hash['uri'] : nil
  method = hash.key?('method') ? hash['method'] : nil
  marketplace_id = hash.key?('MarketplaceId') ? hash['MarketplaceId'] : nil
  item_condition = hash.key?('ItemCondition') ? hash['ItemCondition'] : nil
  headers = hash.key?('headers') ? hash['headers'] : SKIP
  customer_type = hash.key?('CustomerType') ? hash['CustomerType'] : SKIP
  walmart_item_id =
    hash.key?('walmartItemId') ? hash['walmartItemId'] : 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.
  ItemOffersRequest.new(uri: uri,
                        method: method,
                        marketplace_id: marketplace_id,
                        item_condition: item_condition,
                        headers: headers,
                        customer_type: customer_type,
                        walmart_item_id: walmart_item_id,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['uri'] = 'uri'
  @_hash['method'] = 'method'
  @_hash['headers'] = 'headers'
  @_hash['marketplace_id'] = 'MarketplaceId'
  @_hash['item_condition'] = 'ItemCondition'
  @_hash['customer_type'] = 'CustomerType'
  @_hash['walmart_item_id'] = 'walmartItemId'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 59

def self.optionals
  %w[
    headers
    customer_type
    walmart_item_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



129
130
131
132
133
134
135
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} uri: #{@uri.inspect}, method: #{@method.inspect}, headers:"\
  " #{@headers.inspect}, marketplace_id: #{@marketplace_id.inspect}, item_condition:"\
  " #{@item_condition.inspect}, customer_type: #{@customer_type.inspect}, walmart_item_id:"\
  " #{@walmart_item_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/walmart_ap_is/models/item_offers_request.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} uri: #{@uri}, method: #{@method}, headers: #{@headers}, marketplace_id:"\
  " #{@marketplace_id}, item_condition: #{@item_condition}, customer_type: #{@customer_type},"\
  " walmart_item_id: #{@walmart_item_id}, additional_properties: #{@additional_properties}>"
end