Class: LWS::Auth::Token

Inherits:
Generic::Model show all
Defined in:
lib/lws/auth.rb

Overview

The token class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Token

Returns a new instance of Token.



263
264
265
# File 'lib/lws/auth.rb', line 263

def initialize(attrs = {})
  super
end

Instance Attribute Details

#accountAccount

Returns the account the token belongs to (through either the user or the device).

Returns:

  • (Account)

    the account the token belongs to (through either the user or the device)



233
# File 'lib/lws/auth.rb', line 233

belongs_to :account

#account_idFixnum

Returns the ID of the account the token belongs to.

Returns:

  • (Fixnum)

    the ID of the account the token belongs to



# File 'lib/lws/auth.rb', line 235

#created_atString

Returns the timestamp of when the token was created.

Returns:

  • (String)

    the timestamp of when the token was created



# File 'lib/lws/auth.rb', line 257

#deviceDevice

Note:

Each token is associated to either a user or a device.

Returns the device the token belongs to.

Returns:

  • (Device)

    the device the token belongs to



249
# File 'lib/lws/auth.rb', line 249

belongs_to :device

#device_idFixnum

Returns the ID of the device the token belongs to.

Returns:

  • (Fixnum)

    the ID of the device the token belongs to



# File 'lib/lws/auth.rb', line 251

#expires_onString

Returns the timestamp the token will (or has) expire(d).

Returns:

  • (String)

    the timestamp the token will (or has) expire(d)



# File 'lib/lws/auth.rb', line 254

#idFixnum (readonly)

Returns the (unique) ID of the token.

Returns:

  • (Fixnum)

    the (unique) ID of the token



# File 'lib/lws/auth.rb', line 212

#ip_addressString

Returns the location/IP address the token is used on.

Returns:

  • (String)

    the location/IP address the token is used on



# File 'lib/lws/auth.rb', line 224

#nameString

Returns the name of the token.

Returns:

  • (String)

    the name of the token



# File 'lib/lws/auth.rb', line 215

#tokenString

Returns the actual token string.

Returns:

  • (String)

    the actual token string



# File 'lib/lws/auth.rb', line 218

#updated_atString

Returns the timestamp of when the token was last updated.

Returns:

  • (String)

    the timestamp of when the token was last updated



263
264
265
# File 'lib/lws/auth.rb', line 263

def initialize(attrs = {})
  super
end

#used_onString

Returns the timestamp the token was last used.

Returns:

  • (String)

    the timestamp the token was last used



# File 'lib/lws/auth.rb', line 221

#userUser

Note:

Each token is associated to either a user or a device.

Returns the user the token belongs to.

Returns:

  • (User)

    the user the token belongs to



241
# File 'lib/lws/auth.rb', line 241

belongs_to :user

#user_agentString

Returns the user agent/browser string when the token was used.

Returns:

  • (String)

    the user agent/browser string when the token was used



# File 'lib/lws/auth.rb', line 227

#user_idFixnum

Returns the ID of the user the token belongs to.

Returns:

  • (Fixnum)

    the ID of the user the token belongs to



# File 'lib/lws/auth.rb', line 243