Class: LearnLab::Token
- Inherits:
-
Object
- Object
- LearnLab::Token
- Defined in:
- lib/learn_lab/token.rb
Overview
Encodable token. Consists of an email, GitHub URL, and timestamp encoded as a Base64 URL safe string.
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #encoded ⇒ Object
-
#initialize(email, url, timestamp = Time.now.utc) ⇒ Token
constructor
A new instance of Token.
Constructor Details
permalink #initialize(email, url, timestamp = Time.now.utc) ⇒ Token
Returns a new instance of Token.
10 11 12 13 14 |
# File 'lib/learn_lab/token.rb', line 10 def initialize(email, url, =Time.now.utc) @email = email @url = url @timestamp = end |
Instance Attribute Details
permalink #email ⇒ Object (readonly)
Returns the value of attribute email.
8 9 10 |
# File 'lib/learn_lab/token.rb', line 8 def email @email end |
permalink #timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
8 9 10 |
# File 'lib/learn_lab/token.rb', line 8 def @timestamp end |
permalink #url ⇒ Object (readonly)
Returns the value of attribute url.
8 9 10 |
# File 'lib/learn_lab/token.rb', line 8 def url @url end |
Instance Method Details
permalink #encoded ⇒ Object
[View source]
16 17 18 |
# File 'lib/learn_lab/token.rb', line 16 def encoded Base64.urlsafe_encode64(payload.to_json) end |