Class: WalmartApIs::ListingsItemPutRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- WalmartApIs::ListingsItemPutRequest
- Defined in:
- lib/walmart_ap_is/models/listings_item_put_request.rb
Overview
ListingsItemPutRequest Model.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
JSON object of product attributes matching the product type definition schema.
-
#product_type ⇒ String
Walmart product type for the listing.
-
#requirements ⇒ Requirements
Walmart product type for the listing.
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(product_type:, attributes:, requirements: Requirements::LISTING, additional_properties: nil) ⇒ ListingsItemPutRequest
constructor
A new instance of ListingsItemPutRequest.
-
#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(product_type:, attributes:, requirements: Requirements::LISTING, additional_properties: nil) ⇒ ListingsItemPutRequest
Returns a new instance of ListingsItemPutRequest.
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 46 def initialize(product_type:, attributes:, requirements: Requirements::LISTING, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @product_type = product_type @requirements = requirements unless requirements == SKIP @attributes = attributes @additional_properties = additional_properties end |
Instance Attribute Details
#attributes ⇒ Object
JSON object of product attributes matching the product type definition schema
23 24 25 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 23 def attributes @attributes end |
#product_type ⇒ String
Walmart product type for the listing
14 15 16 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 14 def product_type @product_type end |
#requirements ⇒ Requirements
Walmart product type for the listing
18 19 20 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 18 def requirements @requirements end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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/listings_item_put_request.rb', line 59 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_type = hash.key?('productType') ? hash['productType'] : nil attributes = hash.key?('attributes') ? hash['attributes'] : nil requirements = hash['requirements'] ||= Requirements::LISTING # 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. ListingsItemPutRequest.new(product_type: product_type, attributes: attributes, requirements: requirements, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['product_type'] = 'productType' @_hash['requirements'] = 'requirements' @_hash['attributes'] = 'attributes' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 35 def self.optionals %w[ requirements ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
89 90 91 92 93 94 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 89 def inspect class_name = self.class.name.split('::').last "<#{class_name} product_type: #{@product_type.inspect}, requirements:"\ " #{@requirements.inspect}, attributes: #{@attributes.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
82 83 84 85 86 |
# File 'lib/walmart_ap_is/models/listings_item_put_request.rb', line 82 def to_s class_name = self.class.name.split('::').last "<#{class_name} product_type: #{@product_type}, requirements: #{@requirements}, attributes:"\ " #{@attributes}, additional_properties: #{@additional_properties}>" end |