Class: ApiCanon::ApiCanonController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/api_canon_controller.rb

Instance Method Summary collapse

Instance Method Details

#testObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/api_canon_controller.rb', line 3

def test
  response = {:methods => matching_methods, :params => sanitized(params[:doco])}
  #TODO: Put routes in here, too.
  matching_methods.each do |m|
    response[:curl] ||= {}
    response[:urls] ||= {}
    if m == :get
      response[:curl][m] = as_curl(api_request_url)
      response[:urls][m] = api_request_url
    else
      response[:curl][m] = as_curl(api_request_url_for_non_get_requests, m, non_url_parameters_for_request_generation)
      response[:urls][m] = api_request_url_for_non_get_requests
    end
  end
  render :json => response
end