Class: RocketChat::PresenceStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_chat/presence_status.rb

Overview

Rocket.Chat PresenceStatus

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PresenceStatus

Returns a new instance of PresenceStatus.

Parameters:

  • data (Hash)

    Raw presence status data



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

#dataObject (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_statusObject

Connection status



24
25
26
# File 'lib/rocket_chat/presence_status.rb', line 24

def connection_status
  data['connectionStatus']
end

#inspectObject



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_loginObject

Last login



29
30
31
32
33
# File 'lib/rocket_chat/presence_status.rb', line 29

def 
  Time.parse data['lastLogin']
rescue ArgumentError, TypeError
  nil
end

#presenceObject

Presence



19
20
21
# File 'lib/rocket_chat/presence_status.rb', line 19

def presence
  data['presence']
end