Class: NewStoreApi::AddItemRequestBody
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::AddItemRequestBody
- Defined in:
- lib/new_store_api/models/add_item_request_body.rb
Overview
AddItemRequestBody Model.
Instance Attribute Summary collapse
-
#epc ⇒ String
TODO: Write general description for this method.
-
#extended_attributes ⇒ Array[ExtAttrResource]
TODO: Write general description for this method.
-
#fulfillment ⇒ FulfillmentEnum
Fulfillment type.
-
#price ⇒ AddItemItemPrice
Fulfillment type.
-
#product_id ⇒ String
Product ID.
-
#serial_number ⇒ String
Product ID.
-
#source_id ⇒ String
Source identifier.
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_id = nil, epc = SKIP, extended_attributes = SKIP, fulfillment = SKIP, price = SKIP, serial_number = SKIP, source_id = SKIP) ⇒ AddItemRequestBody
constructor
A new instance of AddItemRequestBody.
-
#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_id = nil, epc = SKIP, extended_attributes = SKIP, fulfillment = SKIP, price = SKIP, serial_number = SKIP, source_id = SKIP) ⇒ AddItemRequestBody
Returns a new instance of AddItemRequestBody.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 72 def initialize(product_id = nil, epc = SKIP, extended_attributes = SKIP, fulfillment = SKIP, price = SKIP, serial_number = SKIP, source_id = SKIP) @epc = epc unless epc == SKIP @extended_attributes = extended_attributes unless extended_attributes == SKIP @fulfillment = fulfillment unless fulfillment == SKIP @price = price unless price == SKIP @product_id = product_id @serial_number = serial_number unless serial_number == SKIP @source_id = source_id unless source_id == SKIP end |
Instance Attribute Details
#epc ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 14 def epc @epc end |
#extended_attributes ⇒ Array[ExtAttrResource]
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 18 def extended_attributes @extended_attributes end |
#fulfillment ⇒ FulfillmentEnum
Fulfillment type
22 23 24 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 22 def fulfillment @fulfillment end |
#price ⇒ AddItemItemPrice
Fulfillment type
26 27 28 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 26 def price @price end |
#product_id ⇒ String
Product ID
30 31 32 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 30 def product_id @product_id end |
#serial_number ⇒ String
Product ID
34 35 36 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 34 def serial_number @serial_number end |
#source_id ⇒ String
Source identifier
38 39 40 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 38 def source_id @source_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 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 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_id = hash.key?('product_id') ? hash['product_id'] : nil epc = hash.key?('epc') ? hash['epc'] : SKIP # Parameter is an array, so we need to iterate through it extended_attributes = nil unless hash['extended_attributes'].nil? extended_attributes = [] hash['extended_attributes'].each do |structure| extended_attributes << (ExtAttrResource.from_hash(structure) if structure) end end extended_attributes = SKIP unless hash.key?('extended_attributes') fulfillment = hash.key?('fulfillment') ? hash['fulfillment'] : SKIP price = AddItemItemPrice.from_hash(hash['price']) if hash['price'] serial_number = hash.key?('serial_number') ? hash['serial_number'] : SKIP source_id = hash.key?('source_id') ? hash['source_id'] : SKIP # Create object from extracted values. AddItemRequestBody.new(product_id, epc, extended_attributes, fulfillment, price, serial_number, source_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['epc'] = 'epc' @_hash['extended_attributes'] = 'extended_attributes' @_hash['fulfillment'] = 'fulfillment' @_hash['price'] = 'price' @_hash['product_id'] = 'product_id' @_hash['serial_number'] = 'serial_number' @_hash['source_id'] = 'source_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 69 70 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 66 def self.nullables %w[ extended_attributes ] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 54 def self.optionals %w[ epc extended_attributes fulfillment price serial_number source_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
125 126 127 128 129 130 131 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 125 def inspect class_name = self.class.name.split('::').last "<#{class_name} epc: #{@epc.inspect}, extended_attributes: #{@extended_attributes.inspect},"\ " fulfillment: #{@fulfillment.inspect}, price: #{@price.inspect}, product_id:"\ " #{@product_id.inspect}, serial_number: #{@serial_number.inspect}, source_id:"\ " #{@source_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
117 118 119 120 121 122 |
# File 'lib/new_store_api/models/add_item_request_body.rb', line 117 def to_s class_name = self.class.name.split('::').last "<#{class_name} epc: #{@epc}, extended_attributes: #{@extended_attributes}, fulfillment:"\ " #{@fulfillment}, price: #{@price}, product_id: #{@product_id}, serial_number:"\ " #{@serial_number}, source_id: #{@source_id}>" end |