end
end
+ resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :destroy], :controller => "messages", :as => :api_messages do
+ collection do
+ get "inbox"
+ get "outbox"
+ end
+ end
+
+ post "/user/messages/:id" => "messages#update", :as => :api_message_update
+
post "gpx/create" => "traces#create"
get "gpx/:id" => "traces#show", :as => :api_trace, :id => /\d+/
put "gpx/:id" => "traces#update", :id => /\d+/
delete "gpx/:id" => "traces#destroy", :id => /\d+/
get "gpx/:id/details" => "traces#show", :id => /\d+/
get "gpx/:id/data" => "traces#data", :as => :api_trace_data
+ end
+ namespace :api, :path => "api/0.6" do
# Map notes API
- resources :notes, :except => [:new, :edit, :update], :constraints => { :id => /\d+/ }, :controller => "notes", :as => :api_notes do
+ resources :notes, :except => [:new, :edit, :update], :id => /\d+/, :controller => "notes" do
collection do
get "search"
get "feed", :defaults => { :format => "rss" }
end
end
- resources :user_blocks, :only => [:show], :constraints => { :id => /\d+/ }, :controller => "user_blocks", :as => :api_user_blocks
+ resources :user_blocks, :only => :show, :id => /\d+/, :controller => "user_blocks"
end
# Data browsing
get "/user/:display_name/diary" => "diary_entries#index"
get "/diary/:language" => "diary_entries#index"
scope "/user/:display_name" do
- resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/
+ resources :diary_entries, :path => "diary", :only => [:edit, :update, :show], :id => /\d+/ do
+ member do
+ post :hide, :unhide
+ end
+ end
end
- post "/user/:display_name/diary/:id/newcomment" => "diary_entries#comment", :id => /\d+/, :as => :comment_diary_entry
- post "/user/:display_name/diary/:id/hide" => "diary_entries#hide", :id => /\d+/, :as => :hide_diary_entry
- post "/user/:display_name/diary/:id/unhide" => "diary_entries#unhide", :id => /\d+/, :as => :unhide_diary_entry
- post "/user/:display_name/diary/:id/hidecomment/:comment" => "diary_comments#hide", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
- post "/user/:display_name/diary/:id/unhidecomment/:comment" => "diary_comments#unhide", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment
match "/user/:display_name/diary/:id/subscribe" => "diary_entries#subscribe", :via => [:get, :post], :as => :diary_entry_subscribe, :id => /\d+/
match "/user/:display_name/diary/:id/unsubscribe" => "diary_entries#unsubscribe", :via => [:get, :post], :as => :diary_entry_unsubscribe, :id => /\d+/
+ post "/user/:display_name/diary/:id/comments" => "diary_comments#create", :id => /\d+/, :as => :comment_diary_entry
+ post "/user/:display_name/diary/:id/comments/:comment/hide" => "diary_comments#hide", :id => /\d+/, :comment => /\d+/, :as => :hide_diary_comment
+ post "/user/:display_name/diary/:id/comments/:comment/unhide" => "diary_comments#unhide", :id => /\d+/, :comment => /\d+/, :as => :unhide_diary_comment
# user pages
resources :users, :path => "user", :param => :display_name, :only => [:show, :destroy]
get "/user/:display_name/blocks" => "user_blocks#blocks_on", :as => "user_blocks_on"
get "/user/:display_name/blocks_by" => "user_blocks#blocks_by", :as => "user_blocks_by"
get "/blocks/new/:display_name" => "user_blocks#new", :as => "new_user_block"
- resources :user_blocks
- match "/blocks/:id/revoke" => "user_blocks#revoke", :via => [:get, :post], :as => "revoke_user_block"
+ resources :user_blocks, :except => :new
match "/user/:display_name/blocks/revoke_all" => "user_blocks#revoke_all", :via => [:get, :post], :as => "revoke_all_user_blocks"
# issues and reports