Permalink
Browse files

Introduce days as intermediate element between canteens and meals

  • Loading branch information...
cmur2 committed Oct 4, 2012
1 parent e477498 commit 8f0e69b9403622d0a6498e249bdb094e4bc46fad
Showing with 62 additions and 12 deletions.
  1. +9 −9 content/api/v2/canteens/{meals.md → days.md}
  2. +32 −0 content/api/v2/canteens/days/meals.md
  3. +6 −1 layouts/sidebar_v2.html
  4. +15 −2 lib/api_v2.rb
@@ -1,35 +1,35 @@
---
-title: Meals | OpenMensa API
+title: Days | OpenMensa API
---
-# Meals API
+# Days API
## Authentication
You can read all data anonymously.
-## List meals of a canteen
+## List days of a canteen
- GET /canteens/:id/meals
+ GET /canteens/:id/days
### Parameters
start
: _Optional_ **string** of a date in following format: YYYY-MM-DD. If no start date is given it defaults to today.
range
-: _Optional_ non-negative **integer** - Number of days since start date for which to return meals. If no range is given it defaults to 2 days.
+: _Optional_ non-negative **integer** - Number of days since start date. If no range is given it defaults to 2 days.
### Response
<%= headers 200 %>
-<%= json :meals %>
+<%= json :days %>
-## Get a single meal
+## Get a single day
- GET /canteens/:canteen_id/meals/:id
+ GET /canteens/:canteen_id/days/:id
### Response
<%= headers 200 %>
-<%= json :meal %>
+<%= json :day %>
@@ -0,0 +1,32 @@
+---
+title: Meals | OpenMensa API
+---
+
+# Meals API
+
+## Authentication
+
+You can read all data anonymously.
+
+## List meals of a day
+
+ GET /canteens/:canteen_id/days/:id/meals
+
+### Parameters
+
+includes
+: _Optional_ **string** - may be empty (only an array of meal IDs as property `meal_ids`) or `meals` (array of full nested meals as property `meals`). It defaults to empty.
+
+### Response
+
+<%= headers 200 %>
+<%= json :meals %>
+
+## Get a single meal
+
+ GET /canteens/:canteen_id/days/:day_id/meals/:id
+
+### Response
+
+<%= headers 200 %>
+<%= json :meal %>
View
@@ -10,7 +10,12 @@ <h3><a href="/api/v2/">Summary</a></h3>
<li>
<h3><a href="/api/v2/canteens/">Canteens</a></h3>
<ul>
- <li><a href="/api/v2/canteens/meals/">Meals</a></li>
+ <li>
+ <h3><a href="/api/v2/canteens/days/">Days</a></h3>
+ <ul>
+ <li><a href="/api/v2/canteens/days/meals/">Meals</a></li>
+ </ul>
+ </li>
</ul>
</li>
<li>
View
@@ -26,7 +26,6 @@ def self.sidebar_identifier
"employee" => 3.65,
"other" => 4.60
},
- "date" => "2012-05-29T00:00:00Z",
"category" => "Alternativ-Angebot"
}
@@ -38,12 +37,26 @@ def self.sidebar_identifier
"pupil" => 2.40,
"other" => 4.30,
},
- "date" => "2012-08-24T00:00:00Z",
"category" => "Cafeteria Heiße Theke"
}
MEALS = [MEAL, MEAL2]
+ DAY = {
+ "id" => 23,
+ "date" => "2012-05-29T00:00:00Z",
+ "closed" => false,
+ "meal_ids" => [260, 10900]
+ }
+
+ DAY2 = {
+ "id" => 24,
+ "date" => "2012-05-30T00:00:00Z",
+ "closed" => true
+ }
+
+ DAYS = [DAY, DAY2]
+
CANTEEN = {
"id" => 1,
"name" => "Mensa Ernst-Abbe-Platz",

0 comments on commit 8f0e69b

Please sign in to comment.