5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/restapi/restapis_controller.rb', line 5
def index
respond_to do |format|
Restapi.reload_documentation if Restapi.configuration.reload_controllers?
@doc = Restapi.to_json(params[:resource], params[:method])
format.json do
render :json => @doc
end
format.html do
@doc = @doc[:docs]
if params[:resource].present? && params[:method].present?
@resource = @doc[:resources].first
@method = @resource[:methods].first
render 'method'
elsif params[:resource].present?
@resource = @doc[:resources].first
render 'resource'
else
render 'index'
end
end
end
end
|