Class: ContextIO::ConnectToken

Inherits:
Object
  • Object
show all
Includes:
API::Resource
Defined in:
lib/contextio/connect_token.rb

Overview

Represents a single connect token for an account. You can use this to inspect or delete the token. Most of the attributes are lazily loaded, meaning that the API won't get hit until you ask for an attribute the object doesn't already have (presumably from a previous API call).

Instance Attribute Summary collapse

Attributes included from API::Resource

#api_attributes, #primary_key, #resource_url

Instance Method Summary collapse

Instance Attribute Details

#accountContextIO::Account? (readonly)

Returns The Account associated with this token, if any. Will fetch from the API if necessary.

Returns:

  • (ContextIO::Account, nil)

    The Account associated with this token, if any. Will fetch from the API if necessary.



18
# File 'lib/contextio/connect_token.rb', line 18

belongs_to :account

#callback_urlString (readonly)

Returns The url that Context.IO will redirect the user to when the account is created. Will fetch from the API if necessary.

Returns:

  • (String)

    The url that Context.IO will redirect the user to when the account is created. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#created_atTime (readonly)

Returns The time this token was created. Will fetch from the API if necessary.

Returns:

  • (Time)

    The time this token was created. Will fetch from the API if necessary.



49
50
51
# File 'lib/contextio/connect_token.rb', line 49

def created_at
  @created_at ||= Time.at(created)
end

#emailString (readonly)

Returns The email address associated with this token. Will fetch from the API if necessary.

Returns:

  • (String)

    The email address associated with this token. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#first_nameString (readonly)

Returns The first name of the owner of the email account associated with this token. Will fetch from the API if necessary.

Returns:

  • (String)

    The first name of the owner of the email account associated with this token. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#last_nameString (readonly)

Returns The last name of the owner of the email account associated with this token. Will fetch from the API if necessary.

Returns:

  • (String)

    The last name of the owner of the email account associated with this token. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#service_levelString (readonly)

Returns The Context.IO service level for this account. Will fetch from the API if necessary.

Returns:

  • (String)

    The Context.IO service level for this account. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#tokenString (readonly)

Returns The token associated with this connect token. Will fetch from the API if necessary.

Returns:

  • (String)

    The token associated with this connect token. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

#usedBoolean (readonly)

Returns Whether this token has been used ot not. Will fetch from the API if necessary.

Returns:

  • (Boolean)

    Whether this token has been used ot not. Will fetch from the API if necessary.



41
42
# File 'lib/contextio/connect_token.rb', line 41

lazy_attributes :token, :email, :created, :used, :callback_url,
:service_level, :first_name, :last_name

Instance Method Details

#deleteObject



53
54
55
# File 'lib/contextio/connect_token.rb', line 53

def delete
  api.request(:delete, resource_url)['success']
end