Class: NewStoreApi::TaskPackageItem
- Defined in:
- lib/new_store_api/models/task_package_item.rb
Overview
TaskPackageItem Model.
Instance Attribute Summary collapse
-
#epc ⇒ EpcBody
TODO: Write general description for this method.
-
#item_id ⇒ String
TODO: Write general description for this method.
-
#product_id ⇒ String
TODO: Write general description for this method.
-
#raw_product_id ⇒ String
TODO: Write general description for this method.
-
#serial_number ⇒ String
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(item_id = nil, product_id = nil, raw_product_id = nil, epc = SKIP, serial_number = SKIP) ⇒ TaskPackageItem
constructor
A new instance of TaskPackageItem.
-
#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(item_id = nil, product_id = nil, raw_product_id = nil, epc = SKIP, serial_number = SKIP) ⇒ TaskPackageItem
Returns a new instance of TaskPackageItem.
59 60 61 62 63 64 65 66 |
# File 'lib/new_store_api/models/task_package_item.rb', line 59 def initialize(item_id = nil, product_id = nil, raw_product_id = nil, epc = SKIP, serial_number = SKIP) @epc = epc unless epc == SKIP @item_id = item_id @product_id = product_id @raw_product_id = raw_product_id @serial_number = serial_number unless serial_number == SKIP end |
Instance Attribute Details
#epc ⇒ EpcBody
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/task_package_item.rb', line 14 def epc @epc end |
#item_id ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/new_store_api/models/task_package_item.rb', line 18 def item_id @item_id end |
#product_id ⇒ String
TODO: Write general description for this method
22 23 24 |
# File 'lib/new_store_api/models/task_package_item.rb', line 22 def product_id @product_id end |
#raw_product_id ⇒ String
TODO: Write general description for this method
26 27 28 |
# File 'lib/new_store_api/models/task_package_item.rb', line 26 def raw_product_id @raw_product_id end |
#serial_number ⇒ String
TODO: Write general description for this method
30 31 32 |
# File 'lib/new_store_api/models/task_package_item.rb', line 30 def serial_number @serial_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/new_store_api/models/task_package_item.rb', line 69 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. item_id = hash.key?('item_id') ? hash['item_id'] : nil product_id = hash.key?('product_id') ? hash['product_id'] : nil raw_product_id = hash.key?('raw_product_id') ? hash['raw_product_id'] : nil epc = EpcBody.from_hash(hash['epc']) if hash['epc'] serial_number = hash.key?('serial_number') ? hash['serial_number'] : SKIP # Create object from extracted values. TaskPackageItem.new(item_id, product_id, raw_product_id, epc, serial_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/new_store_api/models/task_package_item.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['epc'] = 'epc' @_hash['item_id'] = 'item_id' @_hash['product_id'] = 'product_id' @_hash['raw_product_id'] = 'raw_product_id' @_hash['serial_number'] = 'serial_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 57 |
# File 'lib/new_store_api/models/task_package_item.rb', line 52 def self.nullables %w[ epc serial_number ] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 |
# File 'lib/new_store_api/models/task_package_item.rb', line 44 def self.optionals %w[ epc serial_number ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
96 97 98 99 100 101 |
# File 'lib/new_store_api/models/task_package_item.rb', line 96 def inspect class_name = self.class.name.split('::').last "<#{class_name} epc: #{@epc.inspect}, item_id: #{@item_id.inspect}, product_id:"\ " #{@product_id.inspect}, raw_product_id: #{@raw_product_id.inspect}, serial_number:"\ " #{@serial_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
89 90 91 92 93 |
# File 'lib/new_store_api/models/task_package_item.rb', line 89 def to_s class_name = self.class.name.split('::').last "<#{class_name} epc: #{@epc}, item_id: #{@item_id}, product_id: #{@product_id},"\ " raw_product_id: #{@raw_product_id}, serial_number: #{@serial_number}>" end |