-
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.
feat: PPT-642 Added place controller (#333)
- Loading branch information
Showing
6 changed files
with
343 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require "../spec_helper" | ||
|
||
describe Place do | ||
client = AC::SpecHelper.client | ||
headers = Mock::Headers.office365_guest | ||
|
||
describe "#index" do | ||
it "should return a list of rooms" do | ||
WebMock.stub(:post, "https://login.microsoftonline.com/bb89674a-238b-4b7d-91ec-6bebad83553a/oauth2/v2.0/token") | ||
.to_return(body: File.read("./spec/fixtures/tokens/o365_token.json")) | ||
WebMock.stub(:get, "https://graph.microsoft.com/v1.0/places/microsoft.graph.room") | ||
.to_return(body: File.read("./spec/fixtures/place/index.json")) | ||
|
||
rooms = Array(Office365::Room).from_json(client.get(PLACE_BASE, headers: headers).body) | ||
rooms.size.should eq(2) | ||
end | ||
end | ||
end | ||
|
||
PLACE_BASE = Place.base_route |
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,68 @@ | ||
{ | ||
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#places/microsoft.graph.room", | ||
"value": [ | ||
{ | ||
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1", | ||
"emailAddress": "cf100@contoso.com", | ||
"displayName": "Conf Room 100", | ||
"address": { | ||
"street": "4567 Main Street", | ||
"city": "Buffalo", | ||
"state": "NY", | ||
"postalCode": "98052", | ||
"countryOrRegion": "USA" | ||
}, | ||
"geoCoordinates": { | ||
"latitude": 47.640568390488626, | ||
"longitude": -122.1293731033803 | ||
}, | ||
"phone": "000-000-0000", | ||
"nickname": "Conf Room", | ||
"label": "100", | ||
"capacity": 50, | ||
"building": "1", | ||
"floorNumber": 1, | ||
"isManaged": true, | ||
"isWheelChairAccessible": false, | ||
"bookingType": "standard", | ||
"tags": [ | ||
"bean bags" | ||
], | ||
"audioDeviceName": null, | ||
"videoDeviceName": null, | ||
"displayDevice": "surface hub" | ||
}, | ||
{ | ||
"id": "3162F1E1-C4C0-604B-51D8-91DA78970B97", | ||
"emailAddress": "cf200@contoso.com", | ||
"displayName": "Conf Room 200", | ||
"address": { | ||
"street": "4567 Main Street", | ||
"city": "Buffalo", | ||
"state": "NY", | ||
"postalCode": "98052", | ||
"countryOrRegion": "USA" | ||
}, | ||
"geoCoordinates": { | ||
"latitude": 47.640568390488625, | ||
"longitude": -122.1293731033802 | ||
}, | ||
"phone": "000-000-0000", | ||
"nickname": "Conf Room", | ||
"label": "200", | ||
"capacity": 40, | ||
"building": "2", | ||
"floorNumber": 2, | ||
"isManaged": true, | ||
"isWheelChairAccessible": false, | ||
"bookingType": "standard", | ||
"tags": [ | ||
"benches", | ||
"nice view" | ||
], | ||
"audioDeviceName": null, | ||
"videoDeviceName": null, | ||
"displayDevice": "surface hub" | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class Place < Application | ||
base "/api/staff/v1/place" | ||
|
||
# Retrieves a list of rooms from the tenant place object | ||
# This function supports advanced filtering using Azure AD filter syntax. | ||
# For more information on Azure AD filter syntax, visit: | ||
# https://learn.microsoft.com/en-us/graph/filter-query-parameter?tabs=http | ||
@[AC::Route::GET("/")] | ||
def index( | ||
@[AC::Param::Info(name: "match", description: "An optional query parameter to return a subset of properties for a resource. With match, you can specify a subset or a superset of the default properties.", example: "id,displayName")] | ||
match : String? = nil, | ||
@[AC::Param::Info(name: "filter", description: "An optional advanced search filter using Azure AD filter syntax to query parameter to retrieve a subset of a collection..", example: "startsWith(givenName,'ben') or startsWith(surname,'ben')")] | ||
filter : String? = nil, | ||
@[AC::Param::Info(description: "Optional: Use the top query parameter to specify the number of items to be included in the result. Default value is 100", example: "100")] | ||
top : Int32? = nil, | ||
@[AC::Param::Info(description: "Optional: Use skip query parameter to set the number of items to skip at the start of a collection.", example: "21 to retrieve search results from 21st record")] | ||
skip : Int32? = nil | ||
) : Array(Office365::Room) | ||
case client.client_id | ||
when :office365 | ||
client.calendar.as(PlaceCalendar::Office365).client.list_rooms(match: match, filter: filter, top: top, skip: skip).as(Office365::Rooms).value | ||
else | ||
raise Error::NotImplemented.new("place query is not available for #{client.client_id}") | ||
end | ||
end | ||
end |