Sha256: 3bfc736bab8ed9c231cd10182453cd0dbc1f5e03c0f800a499aaa3c0f92aecd8

Contents?: true

Size: 687 Bytes

Versions: 14

Compression:

Stored size: 687 Bytes

Contents

module RocketChat
  #
  # Rocket.Chat PresenceStatus
  #
  class PresenceStatus
    # Raw presence status data
    attr_reader :data

    #
    # @param [Hash] data Raw presence status data
    #
    def initialize(data)
      @data = Util.stringify_hash_keys data
    end

    # Presence
    def presence
      data['presence']
    end

    # Connection status
    def connection_status
      data['connectionStatus']
    end

    # Last login
    def last_login
      DateTime.parse data['lastLogin']
    rescue
      nil
    end

    def inspect
      format(
        '#<%s:0x%p @presence="%s">',
        self.class.name,
        object_id,
        presence
      )
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rocketchat-0.1.13 lib/rocket_chat/presence_status.rb
rocketchat-0.1.12 lib/rocket_chat/presence_status.rb
rocketchat-0.1.11 lib/rocket_chat/presence_status.rb
rocketchat-0.1.10 lib/rocket_chat/presence_status.rb
rocketchat-0.1.9 lib/rocket_chat/presence_status.rb
rocketchat-0.1.8 lib/rocket_chat/presence_status.rb
rocketchat-0.1.7 lib/rocket_chat/presence_status.rb
rocketchat-0.1.6 lib/rocket_chat/presence_status.rb
rocketchat-0.1.5 lib/rocket_chat/presence_status.rb
rocketchat-0.1.4 lib/rocket_chat/presence_status.rb
rocketchat-0.1.3 lib/rocket_chat/presence_status.rb
rocketchat-0.1.2 lib/rocket_chat/presence_status.rb
rocketchat-0.1.1 lib/rocket_chat/presence_status.rb
rocketchat-0.0.8 lib/rocket_chat/presence_status.rb