Class: Apify::ApiController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Apify::ApiController
- Defined in:
- lib/apify/api_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.api(api) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/apify/api_controller.rb', line 14 def api(api) @api = api @api.indexed_actions.each do |name, methods| define_method name do if action = methods[request.method] if params[:schema].present? render_schema(params[:schema], action) elsif params[:example].present? render_example(params[:example], action) else respond_with_action(action) end else render_method_not_allowed(request.method) end end end @api end |
.authenticate(options) ⇒ Object
8 9 10 11 12 |
# File 'lib/apify/api_controller.rb', line 8 def authenticate() @user = [:user] or raise "Missing user for authentication" @password = [:password] or raise "Missing password for authentication" @authenticate_condition = [:if] || lambda { true } end |
Instance Method Details
#api ⇒ Object
44 45 46 |
# File 'lib/apify/api_controller.rb', line 44 def api configuration(:api) end |
#authentication_configured? ⇒ Boolean
48 49 50 |
# File 'lib/apify/api_controller.rb', line 48 def authentication_configured? !!@authenticate_condition end |
#docs ⇒ Object
40 41 42 |
# File 'lib/apify/api_controller.rb', line 40 def docs render 'apify/api/docs', :layout => false end |