1- """Cisco Spark rooms API wrapper classes."""
1+ """Cisco Spark rooms API wrapper classes.
2+
3+ Classes:
4+ Room: Models a Spark 'room' JSON object as a native Python object.
5+ RoomsAPI: Wrappers the Cisco Spark Rooms-API and exposes the API calls as
6+ Python method calls that return native Python objects.
7+
8+ """
29
310
411from ciscosparkapi .exceptions import ciscosparkapiException
815
916
1017class Room (SparkData ):
11- """Spark room- object wrapper class ."""
18+ """Model a Spark ' room' JSON object as a native Python object ."""
1219
1320 def __init__ (self , json ):
21+ """Initialize a new Room data object from a JSON dictionary or string.
22+
23+ Args:
24+ json(dict, unicode, str): Input JSON object.
25+
26+ Raises:
27+ TypeError: If the input object is not a dictionary or string.
28+
29+ """
1430 super (Room , self ).__init__ (json )
1531
1632 @property
@@ -50,9 +66,28 @@ def teamId(self):
5066
5167
5268class RoomsAPI (object ):
53- """Cisco Spark rooms API request wrapper class."""
69+ """Cisco Spark Rooms-API wrapper class.
70+
71+ Wrappers the Cisco Spark Rooms-API and exposes the API calls as Python
72+ method calls that return native Python objects.
73+
74+ Attributes:
75+ session(RestSession): The RESTful session object to be used for API
76+ calls to the Cisco Spark service.
77+
78+ """
5479
5580 def __init__ (self , session ):
81+ """Inits a new RoomAPI object with the provided RestSession.
82+
83+ Args:
84+ session(RestSession): The RESTful session object to be used for
85+ API calls to the Cisco Spark service.
86+
87+ Raises:
88+ AssertionError: If the parameter types are incorrect.
89+
90+ """
5691 assert isinstance (session , RestSession )
5792 super (RoomsAPI , self ).__init__ ()
5893 self .session = session
@@ -64,25 +99,27 @@ def list(self, max=None, **query_params):
6499
65100 This method supports Cisco Spark's implmentation of RFC5988 Web Linking
66101 to provide pagination support. It returns an iterator that
67- incrementally yields all rooms returned by the query. It will
68- automatically and efficiently request the additional 'pages' of
69- responses from Spark as needed until all responses have been exhausted .
102+ incrementally yield all rooms returned by the query. It will
103+ automatically request additional 'pages' of responses from Spark as
104+ needed until all responses have been returned .
70105
71106 Args:
72107 max(int): Limits the maximum number of rooms returned from the
73108 Spark service per request.
109+ **query_params:
110+ teamId(string): Limit the rooms to those associated with a
111+ team.
112+ type(string):
113+ 'direct': returns all 1-to-1 rooms.
114+ 'group': returns all group rooms.
74115
75- **query_params:
76- teamId(string): Limit the rooms to those associated with a team.
77- type(string):
78- 'direct': returns all 1-to-1 rooms.
79- 'group': returns all group rooms.
80-
81- Returns:
82- A Room iterator.
116+ Yields:
117+ Room: The the next room from the Cisco Spark query.
83118
84119 Raises:
85- SparkApiError: If the list request fails.
120+ AssertionError: If the parameter types are incorrect.
121+ SparkApiError: If the Cisco Spark cloud returns an error.
122+
86123 """
87124 # Process args
88125 assert max is None or isinstance (max , int )
@@ -109,7 +146,8 @@ def create(self, title, teamId=None):
109146 teamId(string): The team ID with which this room is associated.
110147
111148 Raises:
112- SparkApiError: If the create operation fails.
149+ AssertionError: If the parameter types are incorrect.
150+ SparkApiError: If the Cisco Spark cloud returns an error.
113151 """
114152 # Process args
115153 assert isinstance (title , basestring )
@@ -129,7 +167,9 @@ def get(self, roomId):
129167 roomId(string): The roomId of the room.
130168
131169 Raises:
132- SparkApiError: If the get operation fails.
170+ AssertionError: If the parameter types are incorrect.
171+ SparkApiError: If the Cisco Spark cloud returns an error.
172+
133173 """
134174 # Process args
135175 assert isinstance (roomId , basestring )
@@ -151,8 +191,10 @@ def update(self, roomId, **update_attributes):
151191 A Room object with the updated Spark room details.
152192
153193 Raises:
194+ AssertionError: If the parameter types are incorrect.
154195 ciscosparkapiException: If an update attribute is not provided.
155- SparkApiError: If the update operation fails.
196+ SparkApiError: If the Cisco Spark cloud returns an error.
197+
156198 """
157199 # Process args
158200 assert isinstance (roomId , basestring )
@@ -177,7 +219,9 @@ def delete(self, roomId):
177219 roomId(string): The roomId of the room to be deleted.
178220
179221 Raises:
180- SparkApiError: If the delete operation fails.
222+ AssertionError: If the parameter types are incorrect.
223+ SparkApiError: If the Cisco Spark cloud returns an error.
224+
181225 """
182226 # Process args
183227 assert isinstance (roomId , basestring )
0 commit comments