-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(voip): Add user filters for call state. (#62)
Allows API consumers to retrieve notifications of updated call state restricted by a set of vehicles, users, or both. Restrictions are independent of one another, so specifying a users filter still returns all vehicles and vice versa. Feature added to support VOIP scenarios where the same user is accessing VOIP features from different browser windows or computers. Signed-off-by: Jeff Cuevas-Koch <[email protected]>
- Loading branch information
1 parent
d1b9d96
commit fbda1c4
Showing
3 changed files
with
71 additions
and
5 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 |
---|---|---|
|
@@ -22,7 +22,7 @@ describe('When subscribing to call states', () => { | |
afterEach(fetchMock.restore); | ||
after(() => server.close()); | ||
|
||
it('should get updated call states for a single vehicle', () => { | ||
it('should get updated call states for a single vehicle and all users', () => { | ||
const vehicleHref = '1/SYNC/vehicles/123'; | ||
|
||
api.logIn({ username: '[email protected]', password: 'securepassword' }); | ||
|
@@ -33,19 +33,31 @@ describe('When subscribing to call states', () => { | |
.on('update', callState => callState); // do things with callState | ||
}); | ||
|
||
it('should get updated call states for multiple vehicles', () => { | ||
it('should get updated call states for multiple vehicles and a single user', () => { | ||
const vehicles = [ | ||
{ href: '1/SYNC/vehicles/123' }, | ||
{ href: '1/SYNC/vehicles/456' }, | ||
{ href: '1/SYNC/vehicles/789' }, | ||
]; | ||
|
||
const user = { href: '1/SYNC/users/1' }; | ||
|
||
api.logIn({ username: '[email protected]', password: 'securepassword' }); | ||
return api.customer('SYNC') | ||
.realTime() | ||
.callStates() | ||
.forVehicles(vehicles) | ||
.forUser(user) | ||
.on('update', callState => callState); // do things with callState | ||
}); | ||
|
||
it('should get updated call states for all vehicles and a single user', () => { | ||
const user = { href: '1/SYNC/users/1' }; | ||
|
||
api.logIn({ username: '[email protected]', password: 'securepassword' }); | ||
return api.customer('SYNC') | ||
.realTime() | ||
.callStates() | ||
.forUser(user) | ||
.on('update', callState => callState); // do things with callState | ||
}) | ||
}); |
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