Commit 9980927d by liyijie

Add adapters

parent de99506d
module RailsApiAuthentication
module Adapter
def base_class
raise NotImplementedError
end
end
end
require 'active_record'
require 'rails_api_authentication/adapter'
module RailsApiAuthentication
module Adapters
class ActiveRecordAdapter
extend RailsApiAuthentication::Adapter
def self.base_class
::ActiveRecord::Base
end
end
end
end
require 'mongoid'
require 'rails_api_authentication/adapter'
module RailsApiAuthentication
module Adapters
class MongoidAdapter
extend RailsApiAuthentication::Adapter
def self.base_class
::Mongoid::Document
end
end
end
end
require 'action_controller'
require 'rails_api_authentication/adapter'
module RailsApiAuthentication
module Adapters
class RailsAdapter
extend RailsApiAuthentication::Adapter
def self.base_class
::ActionController::Base
end
end
end
end
require 'action_controller'
require 'rails_api_authentication/adapter'
module RailsApiAuthentication
module Adapters
class RailsAPIAdapter
extend RailsApiAuthentication::Adapter
def self.base_class
::ActionController::API
end
end
# make the adpater available even if the 'API' acronym is not defined
RailsApiAdapter = RailsAPIAdapter
end
end
require 'action_controller'
require 'rails_api_authentication/adapter'
module RailsApiAuthentication
module Adapters
class RailsMetalAdapter
extend RailsApiAuthentication::Adapter
def self.base_class
::ActionController::Metal
end
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment