Skip to content

Commit d90c6f9

Browse files
committed
Consistency Update - rooms.py
1 parent f89b6f4 commit d90c6f9

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

ciscosparkapi/api/rooms.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
from builtins import *
2020
from past.builtins import basestring
2121

22-
from ciscosparkapi.exceptions import ciscosparkapiException
22+
from ciscosparkapi.restsession import RestSession
23+
from ciscosparkapi.sparkdata import SparkData
2324
from ciscosparkapi.utils import (
2425
check_type,
2526
dict_from_items_with_values,
2627
generator_container,
2728
)
28-
from ciscosparkapi.restsession import RestSession
29-
from ciscosparkapi.sparkdata import SparkData
3029

3130

3231
__author__ = "Chris Lunsford"
@@ -142,8 +141,8 @@ def list(self, teamId=None, type=None, sortBy=None, max=None,
142141
sortBy(basestring): Sort results by room ID (`id`), most recent
143142
activity (`lastactivity`), or most recently created
144143
(`created`).
145-
max(int): Limit the maximum number of rooms in the response from
146-
the Spark service.
144+
max(int): Limit the maximum number of items returned from the Spark
145+
service per request.
147146
**request_parameters: Additional request parameters (provides
148147
support for parameters that may be added in the future).
149148
@@ -211,55 +210,55 @@ def create(self, title, teamId=None, **request_parameters):
211210
# Return a Room object created from the response JSON data
212211
return Room(json_data)
213212

214-
def update(self, roomId, title=None, **request_parameters):
215-
"""Update details for a room, by ID.
213+
def get(self, roomId):
214+
"""Get the details of a room, by ID.
216215
217216
Args:
218-
roomId(basestring): The ID of the room to be updated.
219-
title(basestring): A user-friendly name for the room.
220-
**request_parameters: Additional request parameters (provides
221-
support for parameters that may be added in the future).
217+
roomId(basestring): The ID of the room to be retrieved.
222218
223219
Returns:
224-
Room: A Room object with the updated Spark room details.
220+
Room: A Room object with the details of the requested room.
225221
226222
Raises:
227223
TypeError: If the parameter types are incorrect.
228224
SparkApiError: If the Cisco Spark cloud returns an error.
229225
230226
"""
231227
check_type(roomId, basestring, may_be_none=False)
232-
check_type(roomId, basestring)
233-
234-
put_data = dict_from_items_with_values(
235-
request_parameters,
236-
title=title,
237-
)
238228

239229
# API request
240-
json_data = self._session.put('rooms/' + roomId, json=put_data)
230+
json_data = self._session.get('rooms/' + roomId)
241231

242232
# Return a Room object created from the response JSON data
243233
return Room(json_data)
244234

245-
def get(self, roomId):
246-
"""Get the details of a room, by ID.
235+
def update(self, roomId, title=None, **request_parameters):
236+
"""Update details for a room, by ID.
247237
248238
Args:
249-
roomId(basestring): The ID of the room to be retrieved.
239+
roomId(basestring): The room ID.
240+
title(basestring): A user-friendly name for the room.
241+
**request_parameters: Additional request parameters (provides
242+
support for parameters that may be added in the future).
250243
251244
Returns:
252-
Room: A Room object with the details of the requested room.
245+
Room: A Room object with the updated Spark room details.
253246
254247
Raises:
255248
TypeError: If the parameter types are incorrect.
256249
SparkApiError: If the Cisco Spark cloud returns an error.
257250
258251
"""
259252
check_type(roomId, basestring, may_be_none=False)
253+
check_type(roomId, basestring)
254+
255+
put_data = dict_from_items_with_values(
256+
request_parameters,
257+
title=title,
258+
)
260259

261260
# API request
262-
json_data = self._session.get('rooms/' + roomId)
261+
json_data = self._session.put('rooms/' + roomId, json=put_data)
263262

264263
# Return a Room object created from the response JSON data
265264
return Room(json_data)

0 commit comments

Comments
 (0)