module Grape::OAuth2::ActiveRecord::Client
Grape::OAuth2
Client
role mixin for ActiveRecord
. Includes all the required API, associations, validations and callbacks.
Public Class Methods
authenticate(key, secret = nil)
click to toggle source
# File lib/grape_oauth2/mixins/active_record/client.rb, line 18 def self.authenticate(key, secret = nil) if secret.nil? find_by(key: key) else find_by(key: key, secret: secret) end end
Public Instance Methods
generate_keys()
click to toggle source
# File lib/grape_oauth2/mixins/active_record/client.rb, line 28 def generate_keys self.key = Grape::OAuth2::UniqueToken.generate if key.blank? self.secret = Grape::OAuth2::UniqueToken.generate if secret.blank? end