Class: WalmartApIs::ItemIdentifiers
- Defined in:
- lib/walmart_ap_is/models/item_identifiers.rb
Overview
ItemIdentifiers Model.
Instance Attribute Summary collapse
-
#marketplace_walmart_item_id ⇒ Array[ItemIdentifier]
TODO: Write general description for this method.
-
#sku_identifiers ⇒ Array[ItemIdentifier]
TODO: Write general description for this method.
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(marketplace_walmart_item_id: SKIP, sku_identifiers: SKIP, additional_properties: nil) ⇒ ItemIdentifiers
constructor
A new instance of ItemIdentifiers.
-
#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(marketplace_walmart_item_id: SKIP, sku_identifiers: SKIP, additional_properties: nil) ⇒ ItemIdentifiers
Returns a new instance of ItemIdentifiers.
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 41 def initialize(marketplace_walmart_item_id: SKIP, sku_identifiers: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? unless marketplace_walmart_item_id == SKIP @marketplace_walmart_item_id = marketplace_walmart_item_id end @sku_identifiers = sku_identifiers unless sku_identifiers == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#marketplace_walmart_item_id ⇒ Array[ItemIdentifier]
TODO: Write general description for this method
14 15 16 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 14 def marketplace_walmart_item_id @marketplace_walmart_item_id end |
#sku_identifiers ⇒ Array[ItemIdentifier]
TODO: Write general description for this method
18 19 20 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 18 def sku_identifiers @sku_identifiers end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it marketplace_walmart_item_id = nil unless hash['marketplaceWalmartItemId'].nil? marketplace_walmart_item_id = [] hash['marketplaceWalmartItemId'].each do |structure| marketplace_walmart_item_id << (ItemIdentifier.from_hash(structure) if structure) end end marketplace_walmart_item_id = SKIP unless hash.key?('marketplaceWalmartItemId') # Parameter is an array, so we need to iterate through it sku_identifiers = nil unless hash['skuIdentifiers'].nil? sku_identifiers = [] hash['skuIdentifiers'].each do |structure| sku_identifiers << (ItemIdentifier.from_hash(structure) if structure) end end sku_identifiers = SKIP unless hash.key?('skuIdentifiers') # 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. ItemIdentifiers.new(marketplace_walmart_item_id: marketplace_walmart_item_id, sku_identifiers: sku_identifiers, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['marketplace_walmart_item_id'] = 'marketplaceWalmartItemId' @_hash['sku_identifiers'] = 'skuIdentifiers' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 37 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 32 33 34 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 29 def self.optionals %w[ marketplace_walmart_item_id sku_identifiers ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
101 102 103 104 105 106 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 101 def inspect class_name = self.class.name.split('::').last "<#{class_name} marketplace_walmart_item_id: #{@marketplace_walmart_item_id.inspect},"\ " sku_identifiers: #{@sku_identifiers.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
94 95 96 97 98 |
# File 'lib/walmart_ap_is/models/item_identifiers.rb', line 94 def to_s class_name = self.class.name.split('::').last "<#{class_name} marketplace_walmart_item_id: #{@marketplace_walmart_item_id},"\ " sku_identifiers: #{@sku_identifiers}, additional_properties: #{@additional_properties}>" end |