3
3
4
4
Classes:
5
5
Room: Models a Spark 'room' JSON object as a native Python object.
6
- RoomsAPI: Wrappers the Cisco Spark Rooms-API and exposes the API calls as
7
- Python method calls that return native Python objects.
6
+ RoomsAPI: Wraps the Cisco Spark Rooms-API and exposes the APIs as native
7
+ Python methods that return native Python objects.
8
8
9
9
"""
10
10
@@ -35,10 +35,10 @@ class Room(SparkData):
35
35
"""Model a Spark 'room' JSON object as a native Python object."""
36
36
37
37
def __init__ (self , json ):
38
- """Init a new Room data object from a JSON dictionary or string.
38
+ """Initialize a Room data object from a dictionary or JSON string.
39
39
40
40
Args:
41
- json(dict, basestring): Input JSON object .
41
+ json(dict, basestring): Input dictionary or JSON string .
42
42
43
43
Raises:
44
44
TypeError: If the input object is not a dictionary or string.
@@ -48,42 +48,43 @@ def __init__(self, json):
48
48
49
49
@property
50
50
def id (self ):
51
- return self ._json ['id' ]
51
+ """The rooms's unique ID."""
52
+ return self ._json .get ('id' )
52
53
53
54
@property
54
55
def title (self ):
55
- return self ._json ['title' ]
56
+ """A user-friendly name for the room."""
57
+ return self ._json .get ('title' )
56
58
57
59
@property
58
60
def type (self ):
59
- return self ._json ['type' ]
61
+ """The type of room (i.e. 'group', 'direct' etc.)."""
62
+ return self ._json .get ('type' )
60
63
61
64
@property
62
65
def isLocked (self ):
63
- return self ._json ['isLocked' ]
66
+ """Whether or not the room is locked and controled by moderator(s)."""
67
+ return self ._json .get ('isLocked' )
64
68
65
69
@property
66
70
def lastActivity (self ):
67
- return self ._json ['lastActivity' ]
71
+ """The date and time when the room was last active."""
72
+ return self ._json .get ('lastActivity' )
68
73
69
74
@property
70
75
def created (self ):
71
- return self ._json ['created' ]
76
+ """The date and time when the room was created."""
77
+ return self ._json .get ('created' )
72
78
73
79
@property
74
80
def creatorId (self ):
75
- return self ._json ['creatorId' ]
81
+ """The ID of the person who created the room."""
82
+ return self ._json .get ('creatorId' )
76
83
77
84
@property
78
85
def teamId (self ):
79
- """Return the room teamId, if it exists, otherwise return None.
80
-
81
- teamId is an 'optional' attribute that only exists for Spark rooms that
82
- are associated with a Spark Team. To simplify use, rather than
83
- requiring use of try/catch statements or hasattr() calls, we simply
84
- return None if a room does not have a teamId attribute.
85
- """
86
- return self ._json .get ('teamId' , None )
86
+ """The ID for the team with which this room is associated."""
87
+ return self ._json .get ('teamId' )
87
88
88
89
89
90
class RoomsAPI (object ):
0 commit comments