1- """Cisco Spark rooms API wrapper classes.
1+ """Cisco Spark Rooms- API wrapper classes.
22
33Classes:
44 Room: Models a Spark 'room' JSON object as a native Python object.
@@ -18,7 +18,7 @@ class Room(SparkData):
1818 """Model a Spark 'room' JSON object as a native Python object."""
1919
2020 def __init__ (self , json ):
21- """Initialize a new Room data object from a JSON dictionary or string.
21+ """Init a new Person data object from a JSON dictionary or string.
2222
2323 Args:
2424 json(dict, unicode, str): Input JSON object.
@@ -78,7 +78,7 @@ class RoomsAPI(object):
7878 """
7979
8080 def __init__ (self , session ):
81- """Inits a new RoomAPI object with the provided RestSession.
81+ """Init a new RoomAPI object with the provided RestSession.
8282
8383 Args:
8484 session(RestSession): The RESTful session object to be used for
@@ -111,14 +111,14 @@ def list(self, max=None, **query_params):
111111 max(int): Limits the maximum number of rooms returned from the
112112 Spark service per request.
113113 **query_params:
114- teamId(string ): Limit the rooms to those associated with a
115- team.
116- type(string ):
114+ teamId(unicode, str ): Limit the rooms to those associated with
115+ a team.
116+ type(unicode, str ):
117117 'direct': returns all 1-to-1 rooms.
118118 'group': returns all group rooms.
119119
120120 Yields:
121- Room : The the next room from the Cisco Spark query.
121+ Person : The the next room from the Cisco Spark query.
122122
123123 Raises:
124124 AssertionError: If the parameter types are incorrect.
@@ -136,22 +136,24 @@ def list(self, max=None, **query_params):
136136 params [utf8 (param )] = value
137137 # API request - get items
138138 items = self .session .get_items ('rooms' , params = params )
139- # Yield Room objects created from the returned items JSON objects
139+ # Yield Person objects created from the returned items JSON objects
140140 for item in items :
141141 yield Room (item )
142142
143143 def create (self , title , teamId = None ):
144- """Creates a room.
144+ """Create a room.
145145
146146 The authenticated user is automatically added as a member of the room.
147147
148148 Args:
149- title(string): A user-friendly name for the room.
150- teamId(string): The team ID with which this room is associated.
149+ title(unicode, str): A user-friendly name for the room.
150+ teamId(unicode, str): The team ID with which this room is
151+ associated.
151152
152153 Raises:
153154 AssertionError: If the parameter types are incorrect.
154155 SparkApiError: If the Cisco Spark cloud returns an error.
156+
155157 """
156158 # Process args
157159 assert isinstance (title , basestring )
@@ -160,15 +162,15 @@ def create(self, title, teamId=None):
160162 post_data [u'title' ] = utf8 (title )
161163 if teamId : post_data [u'teamId' ] = utf8 (teamId )
162164 # API request
163- json_room_obj = self .session .post ('rooms' , json = post_data )
164- # Return a Room object created from the response JSON data
165- return Room (json_room_obj )
165+ json_obj = self .session .post ('rooms' , json = post_data )
166+ # Return a Person object created from the response JSON data
167+ return Room (json_obj )
166168
167169 def get (self , roomId ):
168- """Gets the details of a room.
170+ """Get the details of a room, by ID .
169171
170172 Args:
171- roomId(string ): The roomId of the room.
173+ roomId(unicode, str ): The roomId of the room.
172174
173175 Raises:
174176 AssertionError: If the parameter types are incorrect.
@@ -178,21 +180,21 @@ def get(self, roomId):
178180 # Process args
179181 assert isinstance (roomId , basestring )
180182 # API request
181- json_room_obj = self .session .get ('rooms/' + roomId )
182- # Return a Room object created from the response JSON data
183- return Room (json_room_obj )
183+ json_obj = self .session .get ('rooms/' + roomId )
184+ # Return a Person object created from the response JSON data
185+ return Room (json_obj )
184186
185187 def update (self , roomId , ** update_attributes ):
186- """Updates details for a room.
188+ """Update details for a room.
187189
188190 Args:
189- roomId(string ): The roomId of the room to be updated.
191+ roomId(unicode, str ): The roomId of the room to be updated.
190192
191193 **update_attributes:
192- title(string ): A user-friendly name for the room.
194+ title(unicode, str ): A user-friendly name for the room.
193195
194196 Returns:
195- A Room object with the updated Spark room details.
197+ A Person object with the updated Spark room details.
196198
197199 Raises:
198200 AssertionError: If the parameter types are incorrect.
@@ -204,23 +206,23 @@ def update(self, roomId, **update_attributes):
204206 assert isinstance (roomId , basestring )
205207 # Process update_attributes keyword arguments
206208 if not update_attributes :
207- error_message = "You must provide at least one " \
208- "**update_attributes keyword argument; 0 provided ."
209+ error_message = "At least one **update_attributes keyword " \
210+ "argument must be specified ."
209211 raise ciscosparkapiException (error_message )
210212 put_data = {}
211213 for param , value in update_attributes .items ():
212214 if isinstance (value , basestring ): value = utf8 (value )
213215 put_data [utf8 (param )] = value
214216 # API request
215- json_room_obj = self .session .post ('rooms' , json = put_data )
216- # Return a Room object created from the response JSON data
217- return Room (json_room_obj )
217+ json_obj = self .session .post ('rooms' , json = put_data )
218+ # Return a Person object created from the response JSON data
219+ return Room (json_obj )
218220
219221 def delete (self , roomId ):
220222 """Delete a room.
221223
222224 Args:
223- roomId(string ): The roomId of the room to be deleted.
225+ roomId(unicode, str ): The roomId of the room to be deleted.
224226
225227 Raises:
226228 AssertionError: If the parameter types are incorrect.
0 commit comments