Class: Trophonius::Connection
- Inherits:
-
Object
- Object
- Trophonius::Connection
- Defined in:
- lib/connectors/connection.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
-
#token ⇒ String
Returns the last received token.
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
10 11 12 13 14 |
# File 'lib/connectors/connection.rb', line 10 def initialize @id = SecureRandom.uuid @token = '' connect end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/connectors/connection.rb', line 8 def id @id end |
Instance Method Details
#token ⇒ String
Returns the last received token
19 20 21 22 23 24 25 |
# File 'lib/connectors/connection.rb', line 19 def token if valid_connection? Trophonius.config.redis_connection ? Trophonius::RedisManager.get_key(key: 'token') : @token else connect end end |