Class: RocketChat::PresenceStatus
- Inherits:
-
Object
- Object
- RocketChat::PresenceStatus
- Defined in:
- lib/rocket_chat/presence_status.rb
Overview
Rocket.Chat PresenceStatus
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Raw presence status data.
Instance Method Summary collapse
-
#connection_status ⇒ Object
Connection status.
-
#initialize(data) ⇒ PresenceStatus
constructor
A new instance of PresenceStatus.
- #inspect ⇒ Object
-
#last_login ⇒ Object
Last login.
-
#presence ⇒ Object
Presence.
Constructor Details
#initialize(data) ⇒ PresenceStatus
Returns a new instance of PresenceStatus.
14 15 16 |
# File 'lib/rocket_chat/presence_status.rb', line 14 def initialize(data) @data = Util.stringify_hash_keys data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Raw presence status data
9 10 11 |
# File 'lib/rocket_chat/presence_status.rb', line 9 def data @data end |
Instance Method Details
#connection_status ⇒ Object
Connection status
24 25 26 |
# File 'lib/rocket_chat/presence_status.rb', line 24 def connection_status data['connectionStatus'] end |
#inspect ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/rocket_chat/presence_status.rb', line 35 def inspect format( '#<%<class_name>s:0x%<object_id>p @presence="%<presence>s">', class_name: self.class.name, object_id: object_id, presence: presence ) end |
#last_login ⇒ Object
Last login
29 30 31 32 33 |
# File 'lib/rocket_chat/presence_status.rb', line 29 def last_login Time.parse data['lastLogin'] rescue ArgumentError, TypeError nil end |
#presence ⇒ Object
Presence
19 20 21 |
# File 'lib/rocket_chat/presence_status.rb', line 19 def presence data['presence'] end |