Ramaze::Controller
Returns a response indicating whether the specified page name is valid and not already taken. Returns an HTTP 200 response on success or an HTTP 500 response on error.
name |
page name to check |
{"valid":true,"unique":true}
# File lib/thoth/controller/api/page.rb, line 51 def check_name error_403 unless auth_key_valid? unless request[:name] && request[:name].length > 0 error_400('Missing required parameter: name') end response['Content-Type'] = 'application/json' name = request[:name].to_s JSON.generate({ :valid => Page.name_valid?(name), :unique => Page.name_unique?(name) }) end
Suggests a valid and unique name for the specified page title. Returns an HTTP 200 response on success or an HTTP 500 response on error.
title |
page title |
{"name":"ninjas-are-awesome"}
# File lib/thoth/controller/api/page.rb, line 79 def suggest_name error_403 unless auth_key_valid? unless request[:title] && request[:title].length > 0 error_400('Missing required parameter: title') end response['Content-Type'] = 'application/json' JSON.generate({"name" => Page.suggest_name(request[:title])}) end
Generated with the Darkfish Rdoc Generator 2.