Class: WalmartApIs::ListingOffersRequest

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

Overview

List of request parameters accepted by the getListingOffers 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:, seller_sku:, headers: SKIP, customer_type: SKIP, additional_properties: nil) ⇒ ListingOffersRequest

Returns a new instance of ListingOffersRequest.



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

def initialize(uri:, method:, marketplace_id:, item_condition:, seller_sku:,
               headers: SKIP, customer_type: 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
  @seller_sku = seller_sku
  @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/listing_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/listing_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/listing_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/listing_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/listing_offers_request.rb', line 20

def method
  @method
end

#seller_skuString

The seller stock keeping unit (SKU) of the item.

Returns:

  • (String)


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

def seller_sku
  @seller_sku
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/listing_offers_request.rb', line 15

def uri
  @uri
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



88
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
# File 'lib/walmart_ap_is/models/listing_offers_request.rb', line 88

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
  seller_sku = hash.key?('SellerSKU') ? hash['SellerSKU'] : nil
  headers = hash.key?('headers') ? hash['headers'] : SKIP
  customer_type = hash.key?('CustomerType') ? hash['CustomerType'] : 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.
  ListingOffersRequest.new(uri: uri,
                           method: method,
                           marketplace_id: marketplace_id,
                           item_condition: item_condition,
                           seller_sku: seller_sku,
                           headers: headers,
                           customer_type: customer_type,
                           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/listing_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['seller_sku'] = 'SellerSKU'
  @_hash
end

.nullablesObject

An array for nullable fields



67
68
69
# File 'lib/walmart_ap_is/models/listing_offers_request.rb', line 67

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    headers
    customer_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



127
128
129
130
131
132
133
# File 'lib/walmart_ap_is/models/listing_offers_request.rb', line 127

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}, seller_sku:"\
  " #{@seller_sku.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
124
# File 'lib/walmart_ap_is/models/listing_offers_request.rb', line 119

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},"\
  " seller_sku: #{@seller_sku}, additional_properties: #{@additional_properties}>"
end