Class: Userbin::Current
- Inherits:
-
Object
- Object
- Userbin::Current
- Defined in:
- lib/userbin/current.rb
Instance Attribute Summary collapse
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(data) ⇒ Current
constructor
A new instance of Current.
Constructor Details
#initialize(data) ⇒ Current
Returns a new instance of Current.
5 6 7 8 9 10 11 |
# File 'lib/userbin/current.rb', line 5 def initialize(data) if data @token = data['id'] @expires_at = data['expires_at'] @user = Userbin::User.new(data['user']) end end |
Instance Attribute Details
#expires_at ⇒ Object
Returns the value of attribute expires_at.
3 4 5 |
# File 'lib/userbin/current.rb', line 3 def expires_at @expires_at end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/userbin/current.rb', line 3 def token @token end |
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/userbin/current.rb', line 3 def user @user end |
Instance Method Details
#authenticated? ⇒ Boolean
13 14 15 |
# File 'lib/userbin/current.rb', line 13 def authenticated? !@user.nil? end |