useless-wait-list 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/useless/wait_list.rb +102 -51
- data/useless-wait-list.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41d0880acb1ceacb594266aa4a3a7e4dbb20079c
|
4
|
+
data.tar.gz: 4134f32eeafbcc4741d6082dd360794c12c58bff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26bd0effc0fecbece82de42ff0b6dc536e31b39a0023e3e1fe631acf32b6939433fcc6bd9fee9d17f44a99efe6da7329b8b15991102364be1dabc410d1b031f9
|
7
|
+
data.tar.gz: 2a78d481f0e0cbf6c46d3bb76c3a6ce7e5045e3ff6d5cc274d4abb4252428549236ad26d04067dd04c4e5fb413149f96df7c2ccf1a0a9696b9e5abb9af4f3ca7
|
data/lib/useless/wait_list.rb
CHANGED
@@ -14,74 +14,72 @@ module Useless
|
|
14
14
|
implementation 'Pending', 'Kevin Hyland'
|
15
15
|
|
16
16
|
description <<-DESC
|
17
|
-
The **Wait List API**
|
18
|
-
|
19
|
-
|
20
|
-
also improves the process of managing wait lists for restaurants.
|
21
|
-
|
22
|
-
### Restaurant
|
23
|
-
|
24
|
-
The top-level resource is the **restaurant**, which consists of a place
|
25
|
-
(from a supported place API, e.g. Foursquare), a group of users, and
|
26
|
-
some wait lists.
|
27
|
-
|
28
|
-
The users associated with the restaurant represent the staff and are
|
29
|
-
able to manage the restaurant's wait lists, i.e. create or cancel
|
30
|
-
reservations on behalf of other users or mark reservations as "seated",
|
31
|
-
"no show" or "bumped".
|
17
|
+
The **Wait List API** implements a new approach to filling a
|
18
|
+
restaurant's open tables by presenting them to potential patrons in
|
19
|
+
real time and allowing them to instantly make reservations.
|
32
20
|
|
33
21
|
### Wait List
|
34
22
|
|
35
|
-
The
|
36
|
-
|
37
|
-
|
23
|
+
The API's primary resource is, of course, the **wait list**. A wait list
|
24
|
+
is a simple construct that represents open tables in a restaurant and
|
25
|
+
serves two functions:
|
38
26
|
|
39
|
-
|
40
|
-
wait list's tables. A restaurant should have a wait list per
|
41
|
-
available table size per dining service.
|
27
|
+
1. Exposes the tables to patrons via search.
|
42
28
|
|
43
|
-
|
44
|
-
for this wait list. Once this time has passed, the wait list is
|
45
|
-
"open".
|
29
|
+
2. Coordinates reservations for the tables.
|
46
30
|
|
47
|
-
|
48
|
-
|
49
|
-
|
31
|
+
A wait list is associated with a single table size. It maintains an
|
32
|
+
ordered list of reservations where the front of the list is the next
|
33
|
+
to be seated.
|
50
34
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
35
|
+
Wait lists can be created in an ad hoc manner (e.g., when another
|
36
|
+
reservation is a no show), or according to a regular schedule (e.g., a
|
37
|
+
wait list per table size per night).
|
38
|
+
|
39
|
+
A wait list can be either _open_ or _closed_. When open, patrons can
|
40
|
+
add reservations to the wait list. When closed, they cannot. A wait list
|
41
|
+
can be closed either manually or according to some criteria. Once
|
42
|
+
closed, the wait list will no longer appear in search results.
|
55
43
|
|
56
44
|
### Reservation
|
57
45
|
|
58
46
|
A **reservation** represents a patron's position on a wait list. A
|
59
47
|
reservation can have one of five states:
|
60
48
|
|
61
|
-
* _waiting_ - the patron has not yet been seated
|
62
|
-
show.
|
49
|
+
* _waiting_ - the patron has not yet been seated or marked as a no show.
|
63
50
|
|
64
51
|
* _cancelled_ - the patron has yet to be seated, but has removed
|
65
|
-
himself from the
|
52
|
+
himself from the wait list.
|
66
53
|
|
67
54
|
* _seated_ - the patron has been seated at his table.
|
68
55
|
|
69
56
|
* _no show_ - the patron did not show up for the meal.
|
70
57
|
|
71
58
|
* _bumped_ - the patron was on the wait list, but the restuarant
|
72
|
-
was unable to seat him
|
59
|
+
was unable to seat him.
|
73
60
|
|
74
61
|
A patron can create a reservation for himself on any open wait
|
75
|
-
list, as long as he does not already have a reservation on
|
76
|
-
wait list
|
62
|
+
list, as long as he does not already have a "conflicting" reservation on
|
63
|
+
another wait list.
|
77
64
|
|
78
65
|
A patron can also remove himself from a wait list, causing his
|
79
66
|
reservation to be marked as either "cancelled" or "no show".
|
67
|
+
|
68
|
+
### Restaurant
|
69
|
+
|
70
|
+
A wait list belongs to a **restaurant**, which consists of a place
|
71
|
+
(from a supported place API, e.g. Foursquare), a group of users, and
|
72
|
+
some wait lists.
|
73
|
+
|
74
|
+
The users associated with the restaurant represent the staff and are
|
75
|
+
able to manage the restaurant's wait lists, i.e. create or cancel
|
76
|
+
reservations on behalf of patrons or mark reservations as "seated",
|
77
|
+
"no show" or "bumped".
|
80
78
|
DESC
|
81
79
|
end
|
82
80
|
|
83
81
|
doc.get '/wait_lists' do
|
84
|
-
description 'Search for wait lists by
|
82
|
+
description 'Search for wait lists by location and party size'
|
85
83
|
|
86
84
|
authentication_required false
|
87
85
|
|
@@ -108,9 +106,9 @@ module Useless
|
|
108
106
|
attribute 'latitude', 'The latitude of the restaurant', type: 'number'
|
109
107
|
attribute 'latitude', 'The longitude of the restaurant', type: 'number'
|
110
108
|
end
|
111
|
-
attribute '
|
112
|
-
attribute '
|
113
|
-
'wait list
|
109
|
+
attribute 'open_at', 'The time that reservations can be created for this wait list', type: 'timestamp'
|
110
|
+
attribute 'estimated_seated_at', 'The estimated time that the next reservation added ' +
|
111
|
+
'to the wait list will be seated', type: 'timestamp'
|
114
112
|
end
|
115
113
|
end
|
116
114
|
end
|
@@ -139,15 +137,15 @@ module Useless
|
|
139
137
|
attribute 'table_size', 'The party size that can be accomodated by the tables on this wait list',
|
140
138
|
type: 'integer', required: true
|
141
139
|
attribute 'table_quantity', 'The number of tables available on this wait list. ' +
|
142
|
-
'This number is used to determine the
|
143
|
-
attribute '
|
144
|
-
'
|
145
|
-
attribute '
|
140
|
+
'This number is used to determine the estimated_seated_at', type: 'integer', required: false
|
141
|
+
attribute 'first_seated_at', 'When the first reservation will be seated. Also used to determine the ' +
|
142
|
+
'estimated_seated_at', type: 'timestamp', required: false, default: '[now]'
|
143
|
+
attribute 'open_at', 'When reservations will be accepted for this wait list',
|
146
144
|
type: 'timestamp', required: false, default: '[now]'
|
147
|
-
attribute '
|
145
|
+
attribute 'closed_at', 'When this wait list is automatically closed',
|
148
146
|
type: 'timestamp', required: false
|
149
147
|
attribute 'maximum_reservations', 'The total number of reservations that will be accepted before ' +
|
150
|
-
'the wait list
|
148
|
+
'the wait list is automatically closed', type: 'integer', required: false
|
151
149
|
end
|
152
150
|
|
153
151
|
response 201, 'The wait list was successfully created' do
|
@@ -155,20 +153,73 @@ module Useless
|
|
155
153
|
end
|
156
154
|
|
157
155
|
response 401, 'Request must be authenticated'
|
156
|
+
response 401, 'Invalid access token'
|
158
157
|
response 401, 'The user is not authorized to manage the specified restaurant'
|
159
158
|
response 422, 'restaurant_id or table_size was omitted'
|
160
159
|
response 404, 'The specified restaurant_id could not be found'
|
161
160
|
response 422, 'Invalid table_size - must be an integer greater than zero'
|
162
161
|
response 422, 'Invalid table_quantity - must be an integer greater than zero'
|
163
|
-
response 422, 'Invalid
|
164
|
-
response 422, 'Invalid
|
165
|
-
response 422, 'Invalid
|
166
|
-
'greater than
|
162
|
+
response 422, 'Invalid first_seated_at - must be a timestamp in ISO 8601 format'
|
163
|
+
response 422, 'Invalid open_at - must be a timestamp in ISO 8601 format'
|
164
|
+
response 422, 'Invalid closed_at - must be a timestamp in ISO 8601 format, ' +
|
165
|
+
'greater than open_at'
|
167
166
|
response 422, 'Invalid maximum_reservations - must be an integer greater than zero'
|
168
167
|
end
|
169
168
|
|
170
169
|
post '/wait_lists' do
|
171
170
|
[501, 'Not yet implemented']
|
172
171
|
end
|
172
|
+
|
173
|
+
doc.post '/wait_lists/:id/reservations' do
|
174
|
+
description 'Add a reservation to a wait list'
|
175
|
+
|
176
|
+
authentication_required true
|
177
|
+
|
178
|
+
response 201, 'Your reservation has been succesfully added to the wait list' do
|
179
|
+
body do
|
180
|
+
attribute 'id', 'The unique ID of this reservation'
|
181
|
+
attribute 'restaurant', 'The restaurant associated with the wait list', type: 'object' do
|
182
|
+
attribute 'id', 'The unique ID of the restaurant', type: 'string'
|
183
|
+
attribute 'name', 'The name of the restaurant', type: 'string'
|
184
|
+
attribute 'latitude', 'The latitude of the restaurant', type: 'number'
|
185
|
+
attribute 'latitude', 'The longitude of the restaurant', type: 'number'
|
186
|
+
end
|
187
|
+
attribute 'position', 'Your position on the wait list'
|
188
|
+
attribute 'estimated_seated_at', 'The time at which you are expected to be seated for ' +
|
189
|
+
'this reservation', type: 'timestamp'
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
response 401, 'Request must be authenticated'
|
194
|
+
response 401, 'Invalid access token'
|
195
|
+
response 404, 'The specified wait list ID could not be found'
|
196
|
+
response 422, 'Reservation could not be added due to another, conflicting reservation'
|
197
|
+
response 422, 'Reservation could not be added because the wait list is closed'
|
198
|
+
end
|
199
|
+
|
200
|
+
post '/wait_lists/:id/reservations' do
|
201
|
+
[501, 'Not yet implemented']
|
202
|
+
end
|
203
|
+
|
204
|
+
doc.put '/reservations/:id/state' do
|
205
|
+
description 'Set the state of a reservation'
|
206
|
+
|
207
|
+
authentication_required true
|
208
|
+
|
209
|
+
body do
|
210
|
+
content_type 'application/json'
|
211
|
+
attribute 'state', 'One of \'waiting\', \'cancelled\', \'seated\', \'no_show\' or \'bumped\''
|
212
|
+
end
|
213
|
+
|
214
|
+
response 201, 'The state of the reservation was successfully set'
|
215
|
+
response 401, 'Request must be authenticated'
|
216
|
+
response 401, 'Invalid access token'
|
217
|
+
response 401, 'You cannot set a reservation\'s state unless you are on the wait list\'s ' +
|
218
|
+
'restaurant\'s staff'
|
219
|
+
response 404, 'The specified wait list ID could not be found'
|
220
|
+
response 422, 'The value of state must be one of \'waiting\', \'cancelled\', \'seated\', ' +
|
221
|
+
'\'no_show\' or \'bumped\''
|
222
|
+
response 422, 'The reservation state could not be updated because the wait list is closed'
|
223
|
+
end
|
173
224
|
end
|
174
225
|
end
|
data/useless-wait-list.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'useless-wait-list'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.5'
|
8
8
|
spec.authors = ['Kevin Hyland']
|
9
9
|
spec.email = ['khy@me.com']
|
10
10
|
spec.summary = 'For restaurants that don\'t take reservations'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useless-wait-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Hyland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|