Class: RocketChat::Token

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

Overview

Rocket.Chat Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Token

Returns a new instance of Token.

Parameters:

  • data (Hash)

    Raw token data



14
15
16
# File 'lib/rocket_chat/token.rb', line 14

def initialize(data)
  @data = Util.stringify_hash_keys data
end

Instance Attribute Details

#dataObject (readonly)

Raw token data



9
10
11
# File 'lib/rocket_chat/token.rb', line 9

def data
  @data
end

Instance Method Details

#auth_tokenObject

Authentication token



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

def auth_token
  data['authToken']
end

#inspectObject



28
29
30
31
32
33
34
35
36
# File 'lib/rocket_chat/token.rb', line 28

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

#user_idObject

User ID



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

def user_id
  data['userId']
end