Class: NewStoreApi::Item8
- Defined in:
- lib/new_store_api/models/item8.rb
Overview
Item8 Model.
Instance Attribute Summary collapse
-
#carrier ⇒ String
Carrier for the item, if it was provided during after shipment.
-
#item_id ⇒ String
Unique identifier of the line item.
-
#product_id ⇒ String
Unique identifier of the line item.
-
#status ⇒ Status2Enum
Status of this item: dispatched - item was routed to a store/DC (check status of fulfillment request to see whether DC/store service has already accepted this fulfillment request or not); shipped - item was marked as shipped; rejected - item was rejected by fulfillment node and going to be rerouted (or was rerouted if fulfillment request already completed); cancelled - item was cancelled.
-
#tracking_code ⇒ String
Tracking code for the item, if it was provided after shipment.
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(carrier = nil, item_id = nil, product_id = nil, status = nil, tracking_code = nil) ⇒ Item8
constructor
A new instance of Item8.
-
#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(carrier = nil, item_id = nil, product_id = nil, status = nil, tracking_code = nil) ⇒ Item8
Returns a new instance of Item8.
63 64 65 66 67 68 69 70 |
# File 'lib/new_store_api/models/item8.rb', line 63 def initialize(carrier = nil, item_id = nil, product_id = nil, status = nil, tracking_code = nil) @carrier = carrier @item_id = item_id @product_id = product_id @status = status @tracking_code = tracking_code end |
Instance Attribute Details
#carrier ⇒ String
Carrier for the item, if it was provided during after shipment. Otherwise
null.
15 16 17 |
# File 'lib/new_store_api/models/item8.rb', line 15 def carrier @carrier end |
#item_id ⇒ String
Unique identifier of the line item.
19 20 21 |
# File 'lib/new_store_api/models/item8.rb', line 19 def item_id @item_id end |
#product_id ⇒ String
Unique identifier of the line item.
23 24 25 |
# File 'lib/new_store_api/models/item8.rb', line 23 def product_id @product_id end |
#status ⇒ Status2Enum
Status of this item: dispatched - item was routed to a store/DC (check status of fulfillment request to see whether DC/store service has already accepted this fulfillment request or not); shipped - item was marked as shipped; rejected - item was rejected by fulfillment node and going to be rerouted (or was rerouted if fulfillment request already completed); cancelled - item was cancelled.
32 33 34 |
# File 'lib/new_store_api/models/item8.rb', line 32 def status @status end |
#tracking_code ⇒ String
Tracking code for the item, if it was provided after shipment. Otherwise
null.
37 38 39 |
# File 'lib/new_store_api/models/item8.rb', line 37 def tracking_code @tracking_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/new_store_api/models/item8.rb', line 73 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. carrier = hash.key?('carrier') ? hash['carrier'] : nil item_id = hash.key?('item_id') ? hash['item_id'] : nil product_id = hash.key?('product_id') ? hash['product_id'] : nil status = hash.key?('status') ? hash['status'] : nil tracking_code = hash.key?('tracking_code') ? hash['tracking_code'] : nil # Create object from extracted values. Item8.new(carrier, item_id, product_id, status, tracking_code) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 |
# File 'lib/new_store_api/models/item8.rb', line 40 def self.names @_hash = {} if @_hash.nil? @_hash['carrier'] = 'carrier' @_hash['item_id'] = 'item_id' @_hash['product_id'] = 'product_id' @_hash['status'] = 'status' @_hash['tracking_code'] = 'tracking_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 59 60 61 |
# File 'lib/new_store_api/models/item8.rb', line 56 def self.nullables %w[ carrier tracking_code ] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 |
# File 'lib/new_store_api/models/item8.rb', line 51 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/new_store_api/models/item8.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier.inspect}, item_id: #{@item_id.inspect}, product_id:"\ " #{@product_id.inspect}, status: #{@status.inspect}, tracking_code:"\ " #{@tracking_code.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/new_store_api/models/item8.rb', line 92 def to_s class_name = self.class.name.split('::').last "<#{class_name} carrier: #{@carrier}, item_id: #{@item_id}, product_id: #{@product_id},"\ " status: #{@status}, tracking_code: #{@tracking_code}>" end |