I've got a vanilla rails 4 application and I'm trying to add a versioned Grape API. The rails server starts up fine, but when I try to access the API URL (http://localhost:3000/v1/user/ping
), I get the error:
undefined method `call' for V1:Module
So far, the API I have setup is very simple, but I can't figure out why it is not working
root/app/api/api.rb:
# root/app/api/api.rb
class API < Grape::API
mount V1
end
Within the version folder, I want to have all the classes that the version of the API supports: root/app/api/v1/user.rb:
# root/app/api/v1/user.rb
module V1
class user < Grape::API
get :ping do
{ :ping => params[:pong] || 'pong' }
end
end
end
root/config/routes:
TestApp::Application.routes.draw do
mount API => '/'
end