Commit c34fadbb authored by John E. Vincent's avatar John E. Vincent

updating sample index page with modified links

parent bc9007be
......@@ -82,6 +82,15 @@ module Noah
r.to_json
end
def find_named_link(path)
link = Noah::Link.find(:path => "/"+path).first
if link.nil?
# try finding it wihtout the slash
link = Noah::Link.find(:path => path).first
(halt 404) if link.nil?
end
return link
end
def add_config_to_app(appname, config_hash)
begin
config = Noah::Configuration.find_or_create(config_hash)
......
class Noah::App
get '/:link_name/:model_name/:item/?' do |path, model, item|
link_name = find_named_link(path)
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
(halt 404) if link_name.to_hash[model.to_sym].has_key?(item) == false
link_name.to_hash[model.to_sym][item].merge({:name => item}).to_json
end
get '/:link_name/:model_name/?' do |path, model|
link_name = Noah::Link.find(:path => "/"+path).first
if link_name.nil?
# So maybe they forgot to add the path with a leading slash?
link_name = Noah::Link.find(:path => path).first
(halt 404) if link_name.nil?
end
link_name = find_named_link(path)
(halt 404) if link_name.to_hash.has_key?(model.to_sym) == false
link_name.to_hash[model.to_sym].to_json
end
get '/:link_name/?' do |link|
link_name = Noah::Link.find(:path => "/"+link).first
if link_name.nil?
# So maybe they forgot to add the path with a leading slash?
link_name = Noah::Link.find(:path => link).first
(halt 404) if link_name.nil?
end
get '/:link_name/?' do |path|
link_name = find_named_link(path)
link_name.to_json
end
......
module Noah
VERSION = "0.8.1"
VERSION = "0.8.2"
end
......@@ -4,6 +4,11 @@
#header
%h1 Sample links
%p If these links return 404 messages, that simply means the sample data has not been populated.
%p You can click the "All" links on each category to see if there is any data for those object types.
%p The best way to interact with Noah is via API calls.
%a{:href => "http://goo.gl/jYqp2"} Documentation
%h2 System Information
%ul
%li
......@@ -18,7 +23,7 @@
%li
%a{:href => "hosts/localhost"} localhost (this server)
%li
%a{:href => "hosts/localhost/noah"} localhost noah service
%a{:href => "hosts/localhost/services/noah"} localhost noah service
#header
%h2 Services
%ul
......@@ -36,22 +41,18 @@
%li
%a{:href => "applications/noah"} Noah Application entry
%li
%a{:href => "applications/noah/redis"} Noah Redis configuration entry
%a{:href => "applications/noah/configurations/redis_url"} Noah Redis configuration entry
#header
%h2 Configurations
%ul
%li
%a{:href => "configurations/"} All registered Configurations
%li
%a{:href => "configurations/noah"} Noah Configuration entry
%li
%a{:href => "configurations/myrailsapp1"} myrailsapp1 Configuration entry
%li
%a{:href => "configurations/myrestapp1"} myrestapp1 Configuration entry
%a{:href => "configurations/redis_url"} A Redis URL Configuration entry
%li
%a{:href => "configurations/myrailsapp1/database.yml"} database.yml file for myrailsapp1 (should return the proper content-type)
%a{:href => "configurations/database.yml"} database.yml file (most likely will return JSON representation. Send "Accept: application/octet" headers for raw version)
%li
%a{:href => "configurations/myrestapp1/config.json"} config.json file for myrestapp1
%a{:href => "configurations/config.json"} config.json file (see above note about headers)
#header
%h2 Links
%ul
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment