Class: OauthToken

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/generators/mongoid/oauth_provider_templates/oauth_token.rb,
lib/generators/active_record/oauth_provider_templates/oauth_token.rb

Direct Known Subclasses

AccessToken, Oauth2Verifier, RequestToken

Instance Method Summary collapse

Instance Method Details

#authorized?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/generators/mongoid/oauth_provider_templates/oauth_token.rb', line 31

def authorized?
  !authorized_at.nil? && !invalidated?
end

#invalidate!Object



27
28
29
# File 'lib/generators/mongoid/oauth_provider_templates/oauth_token.rb', line 27

def invalidate!
  update_attribute(:invalidated_at, Time.now)
end

#invalidated?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/generators/mongoid/oauth_provider_templates/oauth_token.rb', line 23

def invalidated?
  !invalidated_at.nil?
end

#to_queryObject



35
36
37
# File 'lib/generators/mongoid/oauth_provider_templates/oauth_token.rb', line 35

def to_query
  "oauth_token=#{token}&oauth_token_secret=#{secret}"
end