-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
51 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from uw_mazevo import get_resource, post_resource | ||
from uw_mazevo.models import Booking, Room, Status | ||
|
||
|
||
class PublicConfiguration(object): | ||
URL = "/api/PublicConfiguration/{}" | ||
|
||
def get_rooms(self, building_id=0): | ||
""" | ||
Gets a list of Rooms. building_id of 0 returns all rooms. | ||
""" | ||
url = self.URL.format("Rooms") | ||
body = {"buildingId": building_id} | ||
|
||
rooms = [] | ||
for data in post_resource(url, body): | ||
rooms.append(Room.from_json(data)) | ||
return rooms | ||
|
||
def get_statuses(self): | ||
""" | ||
Gets a list of Statuses | ||
""" | ||
url = self.URL.format("Statuses") | ||
|
||
statuses = [] | ||
for data in get_resource(url): | ||
statuses.append(Status.from_json(data)) | ||
|
||
return statuses | ||
|
||
|
||
class PublicEvent(object): | ||
URL = "/api/PublicEvent/{}" | ||
|
||
def get_events(self, **kwargs): | ||
""" | ||
Only pass in the "minDateChanged" parameter if you want results | ||
for bookings that have been created or changed since the | ||
"minDateChanged" date. Changed bookings are for critical booking | ||
information only like date, time, status or room. | ||
""" | ||
url = self.URL.format("getevents") | ||
body = kwargs | ||
|
||
events = [] | ||
for data in post_resource(url, body): | ||
events.append(Booking.from_json(data)) | ||
return events |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters