- 'app/controllers/notes_controller.rb'
- 'app/controllers/trace_controller.rb'
- 'app/controllers/user_controller.rb'
- - 'app/controllers/user_preference_controller.rb'
+ - 'app/controllers/user_preferences_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/browse_helper.rb'
- 'app/models/client_application.rb'
# Update and read user preferences, which are arbitrayr key/val pairs
-class UserPreferenceController < ApplicationController
+class UserPreferencesController < ApplicationController
skip_before_action :verify_authenticity_token
before_action :authorize
before_action :require_allow_read_prefs, :only => [:read_one, :read]
get "user/details" => "user#api_details"
get "user/gpx_files" => "user#api_gpx_files"
- get "user/preferences" => "user_preference#read"
- get "user/preferences/:preference_key" => "user_preference#read_one"
- put "user/preferences" => "user_preference#update"
- put "user/preferences/:preference_key" => "user_preference#update_one"
- delete "user/preferences/:preference_key" => "user_preference#delete_one"
+ get "user/preferences" => "user_preferences#read"
+ get "user/preferences/:preference_key" => "user_preferences#read_one"
+ put "user/preferences" => "user_preferences#update"
+ put "user/preferences/:preference_key" => "user_preferences#update_one"
+ delete "user/preferences/:preference_key" => "user_preferences#delete_one"
post "gpx/create" => "trace#api_create"
get "gpx/:id" => "trace#api_read", :id => /\d+/
require "test_helper"
-class UserPreferenceControllerTest < ActionController::TestCase
+class UserPreferencesControllerTest < ActionController::TestCase
##
# test all routes which lead to this controller
def test_routes
assert_routing(
{ :path => "/api/0.6/user/preferences", :method => :get },
- { :controller => "user_preference", :action => "read" }
+ { :controller => "user_preferences", :action => "read" }
)
assert_routing(
{ :path => "/api/0.6/user/preferences", :method => :put },
- { :controller => "user_preference", :action => "update" }
+ { :controller => "user_preferences", :action => "update" }
)
assert_routing(
{ :path => "/api/0.6/user/preferences/key", :method => :get },
- { :controller => "user_preference", :action => "read_one", :preference_key => "key" }
+ { :controller => "user_preferences", :action => "read_one", :preference_key => "key" }
)
assert_routing(
{ :path => "/api/0.6/user/preferences/key", :method => :put },
- { :controller => "user_preference", :action => "update_one", :preference_key => "key" }
+ { :controller => "user_preferences", :action => "update_one", :preference_key => "key" }
)
assert_routing(
{ :path => "/api/0.6/user/preferences/key", :method => :delete },
- { :controller => "user_preference", :action => "delete_one", :preference_key => "key" }
+ { :controller => "user_preferences", :action => "delete_one", :preference_key => "key" }
)
end