Add basic REST API

This commit is contained in:
Martin Lensment 2015-01-07 12:39:17 +02:00
parent b934850ba7
commit dc2270491d
5 changed files with 53 additions and 0 deletions

22
app/api/repp/api.rb Normal file
View file

@ -0,0 +1,22 @@
module Repp
class API < Grape::API
format :json
prefix :repp
version 'v1', using: :path
http_basic do |username, password|
@current_user ||= EppUser.find_by(username: username, password: password)
end
helpers do
attr_reader :current_user
end
resource :domains do
desc 'Return list of domains'
get '/' do
current_user.registrar.domains
end
end
end
end