Class: NewStoreApi::FutureAllocation
- Defined in:
- lib/new_store_api/models/future_allocation.rb
Overview
FutureAllocation Model.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
Timestamp at which reservation was created.
-
#item_uuid ⇒ String
The uuid of the order item.
-
#order_uuid ⇒ String
The uuid of the order.
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(created_at = nil, item_uuid = nil, order_uuid = nil) ⇒ FutureAllocation
constructor
A new instance of FutureAllocation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
-
#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(created_at = nil, item_uuid = nil, order_uuid = nil) ⇒ FutureAllocation
Returns a new instance of FutureAllocation.
44 45 46 47 48 |
# File 'lib/new_store_api/models/future_allocation.rb', line 44 def initialize(created_at = nil, item_uuid = nil, order_uuid = nil) @created_at = created_at @item_uuid = item_uuid @order_uuid = order_uuid end |
Instance Attribute Details
#created_at ⇒ DateTime
Timestamp at which reservation was created
15 16 17 |
# File 'lib/new_store_api/models/future_allocation.rb', line 15 def created_at @created_at end |
#item_uuid ⇒ String
The uuid of the order item.
19 20 21 |
# File 'lib/new_store_api/models/future_allocation.rb', line 19 def item_uuid @item_uuid end |
#order_uuid ⇒ String
The uuid of the order.
23 24 25 |
# File 'lib/new_store_api/models/future_allocation.rb', line 23 def order_uuid @order_uuid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/new_store_api/models/future_allocation.rb', line 51 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end item_uuid = hash.key?('item_uuid') ? hash['item_uuid'] : nil order_uuid = hash.key?('order_uuid') ? hash['order_uuid'] : nil # Create object from extracted values. FutureAllocation.new(created_at, item_uuid, order_uuid) end |
.names ⇒ Object
A mapping from model property names to API property names.
26 27 28 29 30 31 32 |
# File 'lib/new_store_api/models/future_allocation.rb', line 26 def self.names @_hash = {} if @_hash.nil? @_hash['created_at'] = 'created_at' @_hash['item_uuid'] = 'item_uuid' @_hash['order_uuid'] = 'order_uuid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/new_store_api/models/future_allocation.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 |
# File 'lib/new_store_api/models/future_allocation.rb', line 35 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
79 80 81 82 83 |
# File 'lib/new_store_api/models/future_allocation.rb', line 79 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at.inspect}, item_uuid: #{@item_uuid.inspect},"\ " order_uuid: #{@order_uuid.inspect}>" end |
#to_custom_created_at ⇒ Object
67 68 69 |
# File 'lib/new_store_api/models/future_allocation.rb', line 67 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
72 73 74 75 76 |
# File 'lib/new_store_api/models/future_allocation.rb', line 72 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at}, item_uuid: #{@item_uuid}, order_uuid:"\ " #{@order_uuid}>" end |