Class: NewStoreApi::ReservationDetailsResponseV1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/reservation_details_response_v1.rb

Overview

ReservationDetailsResponseV1 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(associate_id = nil, created_at = nil, customer_profile_id = nil, expires_at = nil, external_id = nil, id = nil, items = nil, location_id = nil, status = nil, updated_at = nil) ⇒ ReservationDetailsResponseV1

Returns a new instance of ReservationDetailsResponseV1.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 81

def initialize(associate_id = nil, created_at = nil,
               customer_profile_id = nil, expires_at = nil,
               external_id = nil, id = nil, items = nil, location_id = nil,
               status = nil, updated_at = nil)
  @associate_id = associate_id
  @created_at = created_at
  @customer_profile_id = customer_profile_id
  @expires_at = expires_at
  @external_id = external_id
  @id = id
  @items = items
  @location_id = location_id
  @status = status
  @updated_at = updated_at
end

Instance Attribute Details

#associate_idString

ID of the associate assigned to the reservation

Returns:

  • (String)


15
16
17
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 15

def associate_id
  @associate_id
end

#created_atDateTime

Date and time the reservation was created

Returns:

  • (DateTime)


19
20
21
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 19

def created_at
  @created_at
end

#customer_profile_idString

Profile ID of the customer the reservation is for

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 23

def customer_profile_id
  @customer_profile_id
end

#expires_atDateTime

Date and time the reservation expires

Returns:

  • (DateTime)


27
28
29
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 27

def expires_at
  @expires_at
end

#external_idString

Short, human-readable identifier for the reservation

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 31

def external_id
  @external_id
end

#idUUID | String

Unique identifier for the reservation

Returns:

  • (UUID | String)


35
36
37
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 35

def id
  @id
end

#itemsArray[ReservationItemDetailsResponse]

Items associated with the reservation

Returns:



39
40
41
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 39

def items
  @items
end

#location_idString

ID of the fulfillment location the reservation is for

Returns:

  • (String)


43
44
45
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 43

def location_id
  @location_id
end

#statusReservationStatusEnum

The status of a reservation.



47
48
49
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 47

def status
  @status
end

#updated_atDateTime

Date and time the reservation was updated

Returns:

  • (DateTime)


51
52
53
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 51

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 98

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  associate_id = hash.key?('associate_id') ? hash['associate_id'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  customer_profile_id =
    hash.key?('customer_profile_id') ? hash['customer_profile_id'] : nil
  expires_at = if hash.key?('expires_at')
                 (DateTimeHelper.from_rfc3339(hash['expires_at']) if hash['expires_at'])
               end
  external_id = hash.key?('external_id') ? hash['external_id'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (ReservationItemDetailsResponse.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')
  location_id = hash.key?('location_id') ? hash['location_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

  # Create object from extracted values.
  ReservationDetailsResponseV1.new(associate_id,
                                   created_at,
                                   customer_profile_id,
                                   expires_at,
                                   external_id,
                                   id,
                                   items,
                                   location_id,
                                   status,
                                   updated_at)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['associate_id'] = 'associate_id'
  @_hash['created_at'] = 'created_at'
  @_hash['customer_profile_id'] = 'customer_profile_id'
  @_hash['expires_at'] = 'expires_at'
  @_hash['external_id'] = 'external_id'
  @_hash['id'] = 'id'
  @_hash['items'] = 'items'
  @_hash['location_id'] = 'location_id'
  @_hash['status'] = 'status'
  @_hash['updated_at'] = 'updated_at'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
78
79
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 75

def self.nullables
  %w[
    associate_id
  ]
end

.optionalsObject

An array for optional fields



70
71
72
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 70

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



164
165
166
167
168
169
170
171
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 164

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} associate_id: #{@associate_id.inspect}, created_at: #{@created_at.inspect},"\
  " customer_profile_id: #{@customer_profile_id.inspect}, expires_at: #{@expires_at.inspect},"\
  " external_id: #{@external_id.inspect}, id: #{@id.inspect}, items: #{@items.inspect},"\
  " location_id: #{@location_id.inspect}, status: #{@status.inspect}, updated_at:"\
  " #{@updated_at.inspect}>"
end

#to_custom_created_atObject



142
143
144
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 142

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_expires_atObject



146
147
148
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 146

def to_custom_expires_at
  DateTimeHelper.to_rfc3339(expires_at)
end

#to_custom_updated_atObject



150
151
152
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 150

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
161
# File 'lib/new_store_api/models/reservation_details_response_v1.rb', line 155

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} associate_id: #{@associate_id}, created_at: #{@created_at},"\
  " customer_profile_id: #{@customer_profile_id}, expires_at: #{@expires_at}, external_id:"\
  " #{@external_id}, id: #{@id}, items: #{@items}, location_id: #{@location_id}, status:"\
  " #{@status}, updated_at: #{@updated_at}>"
end