|
19 | 19 | from builtins import * |
20 | 20 | from past.builtins import basestring |
21 | 21 |
|
22 | | -from ciscosparkapi.exceptions import ciscosparkapiException |
| 22 | +from ciscosparkapi.restsession import RestSession |
| 23 | +from ciscosparkapi.sparkdata import SparkData |
23 | 24 | from ciscosparkapi.utils import ( |
24 | 25 | check_type, |
25 | 26 | dict_from_items_with_values, |
26 | 27 | generator_container, |
27 | 28 | ) |
28 | | -from ciscosparkapi.restsession import RestSession |
29 | | -from ciscosparkapi.sparkdata import SparkData |
30 | 29 |
|
31 | 30 |
|
32 | 31 | __author__ = "Chris Lunsford" |
@@ -142,8 +141,8 @@ def list(self, teamId=None, type=None, sortBy=None, max=None, |
142 | 141 | sortBy(basestring): Sort results by room ID (`id`), most recent |
143 | 142 | activity (`lastactivity`), or most recently created |
144 | 143 | (`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. |
147 | 146 | **request_parameters: Additional request parameters (provides |
148 | 147 | support for parameters that may be added in the future). |
149 | 148 |
|
@@ -211,55 +210,55 @@ def create(self, title, teamId=None, **request_parameters): |
211 | 210 | # Return a Room object created from the response JSON data |
212 | 211 | return Room(json_data) |
213 | 212 |
|
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. |
216 | 215 |
|
217 | 216 | 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. |
222 | 218 |
|
223 | 219 | Returns: |
224 | | - Room: A Room object with the updated Spark room details. |
| 220 | + Room: A Room object with the details of the requested room. |
225 | 221 |
|
226 | 222 | Raises: |
227 | 223 | TypeError: If the parameter types are incorrect. |
228 | 224 | SparkApiError: If the Cisco Spark cloud returns an error. |
229 | 225 |
|
230 | 226 | """ |
231 | 227 | 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 | | - ) |
238 | 228 |
|
239 | 229 | # API request |
240 | | - json_data = self._session.put('rooms/' + roomId, json=put_data) |
| 230 | + json_data = self._session.get('rooms/' + roomId) |
241 | 231 |
|
242 | 232 | # Return a Room object created from the response JSON data |
243 | 233 | return Room(json_data) |
244 | 234 |
|
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. |
247 | 237 |
|
248 | 238 | 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). |
250 | 243 |
|
251 | 244 | Returns: |
252 | | - Room: A Room object with the details of the requested room. |
| 245 | + Room: A Room object with the updated Spark room details. |
253 | 246 |
|
254 | 247 | Raises: |
255 | 248 | TypeError: If the parameter types are incorrect. |
256 | 249 | SparkApiError: If the Cisco Spark cloud returns an error. |
257 | 250 |
|
258 | 251 | """ |
259 | 252 | 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 | + ) |
260 | 259 |
|
261 | 260 | # API request |
262 | | - json_data = self._session.get('rooms/' + roomId) |
| 261 | + json_data = self._session.put('rooms/' + roomId, json=put_data) |
263 | 262 |
|
264 | 263 | # Return a Room object created from the response JSON data |
265 | 264 | return Room(json_data) |
|
0 commit comments