Class: NewStoreApi::ReservationItemDetailsResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::ReservationItemDetailsResponse
- Defined in:
- lib/new_store_api/models/reservation_item_details_response.rb
Overview
ReservationItemDetailsResponse Model.
Instance Attribute Summary collapse
-
#cart_id ⇒ String
ID of the cart in which the item was purchased during conversion.
-
#id ⇒ UUID | String
Unique identifier for the reservation item.
-
#product_id ⇒ String
ID of the product the reservation item corresponds to.
-
#status ⇒ ReservationItemStatusEnum
The status of a reservation item.
-
#updated_at ⇒ DateTime
Date and time the status of the item was updated.
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(id = nil, product_id = nil, status = nil, updated_at = nil, cart_id = SKIP) ⇒ ReservationItemDetailsResponse
constructor
A new instance of ReservationItemDetailsResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_updated_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(id = nil, product_id = nil, status = nil, updated_at = nil, cart_id = SKIP) ⇒ ReservationItemDetailsResponse
Returns a new instance of ReservationItemDetailsResponse.
58 59 60 61 62 63 64 65 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 58 def initialize(id = nil, product_id = nil, status = nil, updated_at = nil, cart_id = SKIP) @cart_id = cart_id unless cart_id == SKIP @id = id @product_id = product_id @status = status @updated_at = updated_at end |
Instance Attribute Details
#cart_id ⇒ String
ID of the cart in which the item was purchased during conversion
15 16 17 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 15 def cart_id @cart_id end |
#id ⇒ UUID | String
Unique identifier for the reservation item
19 20 21 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 19 def id @id end |
#product_id ⇒ String
ID of the product the reservation item corresponds to
23 24 25 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 23 def product_id @product_id end |
#status ⇒ ReservationItemStatusEnum
The status of a reservation item.
27 28 29 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 27 def status @status end |
#updated_at ⇒ DateTime
Date and time the status of the item was updated
31 32 33 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 31 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil product_id = hash.key?('product_id') ? hash['product_id'] : nil status = hash.key?('status') ? hash['status'] : nil updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end cart_id = hash.key?('cart_id') ? hash['cart_id'] : SKIP # Create object from extracted values. ReservationItemDetailsResponse.new(id, product_id, status, updated_at, cart_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['cart_id'] = 'cart_id' @_hash['id'] = 'id' @_hash['product_id'] = 'product_id' @_hash['status'] = 'status' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 52 def self.nullables %w[ cart_id ] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 45 def self.optionals %w[ cart_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
100 101 102 103 104 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 100 def inspect class_name = self.class.name.split('::').last "<#{class_name} cart_id: #{@cart_id.inspect}, id: #{@id.inspect}, product_id:"\ " #{@product_id.inspect}, status: #{@status.inspect}, updated_at: #{@updated_at.inspect}>" end |
#to_custom_updated_at ⇒ Object
88 89 90 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 88 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
93 94 95 96 97 |
# File 'lib/new_store_api/models/reservation_item_details_response.rb', line 93 def to_s class_name = self.class.name.split('::').last "<#{class_name} cart_id: #{@cart_id}, id: #{@id}, product_id: #{@product_id}, status:"\ " #{@status}, updated_at: #{@updated_at}>" end |