class AdminAPI::Admin

Attributes

inheritance_class[RW]

Public Class Methods

routes() click to toggle source
# File lib/admin-api.rb, line 23
def self.routes
  #Define routes to our controller
  return @@routes
end

Public Instance Methods

config() { |config| ... } click to toggle source
# File lib/admin-api.rb, line 27
def config
  yield(self.config)
end
controller() { |inheritance_class| ... } click to toggle source
# File lib/admin-api.rb, line 14
def controller &block
  #define new route
  yield(@inheritance_class)
end
initializer() click to toggle source
# File lib/admin-api.rb, line 5
def initializer
  @inheritance_class = nil
end
register(_class) { |self| ... } click to toggle source
# File lib/admin-api.rb, line 8
def register _class, &block
  @inheritance_class = Class.new Admin::AdminController
  Admin::AdminController.const_set "AdminAPI#{_class.name}", @inheritance_class
  yield self
  save_routes
end
save_routes() click to toggle source
# File lib/admin-api.rb, line 18
def save_routes
  @inheritance_class.methods.each do
    #Will be configuered later for the rest of the application
  end
end

Private Instance Methods

complete_serializer(serializer) click to toggle source
# File lib/admin-api.rb, line 31
def complete_serializer serializer
  @inheritance_class.complete_serializer = serializer
end
permit_params(*attributes) click to toggle source
# File lib/admin-api.rb, line 37
def permit_params *attributes
  @inheritance_class.permit_params = *attributes
end
short_serializer(serializer) click to toggle source
# File lib/admin-api.rb, line 34
def short_serializer serializer
  @inheritance_class.short_serializer = serializer
end