Module: EasyApiDoc::Options

Defined in:
lib/easy_api_doc/options.rb

Class Method Summary collapse

Class Method Details

.authenticate_with(&block) ⇒ Object



5
6
7
8
# File 'lib/easy_api_doc/options.rb', line 5

def authenticate_with(&block)
  @authenticate = block if block
  @authenticate || Proc.new {}
end

.authorize_with(*args, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/easy_api_doc/options.rb', line 10

def authorize_with(*args, &block)
  authorization_type = args.shift
  current_user_method = args.shift
  if authorization_type
    @authorize = Proc.new {
      @current_user_method = current_user_method
      @authorization_type = ('EasyApiDoc::' + authorization_type.to_s.classify).constantize.new(self, @current_user_method)
    }
  else
    @authorize = block if block
  end
  @authorize || Proc.new {}
end