Class: Token
- Inherits:
-
Object
- Object
- Token
- Defined in:
- lib/track-r/token.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Token
Returns a new instance of Token.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/track-r/token.rb', line 2 def initialize( = {}) @token = case when .include?(:token) [:token] when .include?(:username) && .include?(:password) # If a token is not provided, it can be generated by passing a # hash with :user and :password keys get_token([:username], [:password] ) else raise ArgumentError, "Invalid argument, expecting either <:token> or <:username> and <:password>" end end |
Instance Method Details
#to_s ⇒ Object
18 19 20 |
# File 'lib/track-r/token.rb', line 18 def to_s @token end |