Class: Userbin::Current

Inherits:
Object
  • Object
show all
Defined in:
lib/userbin/current.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_atObject

Returns the value of attribute expires_at.



3
4
5
# File 'lib/userbin/current.rb', line 3

def expires_at
  @expires_at
end

#tokenObject

Returns the value of attribute token.



3
4
5
# File 'lib/userbin/current.rb', line 3

def token
  @token
end

#userObject

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

Returns:

  • (Boolean)


13
14
15
# File 'lib/userbin/current.rb', line 13

def authenticated?
  !@user.nil?
end