Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Andres Keskküla 2015-01-08 11:37:47 +02:00
commit 8c20f2697b
9 changed files with 220 additions and 166 deletions

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

@ -0,0 +1,16 @@
module Repp
class API < Grape::API
format :json
prefix :repp
http_basic do |username, password|
@current_user ||= EppUser.find_by(username: username, password: password)
end
helpers do
attr_reader :current_user
end
mount Repp::DomainV1
end
end

16
app/api/repp/domain_v1.rb Normal file
View file

@ -0,0 +1,16 @@
module Repp
class DomainV1 < Grape::API
version 'v1', using: :path
resource :domains do
desc 'Return list of domains'
get '/' do
domains = current_user.registrar.domains.page(params[:page])
{
domains: domains,
total_pages: domains.total_pages
}
end
end
end
end

View file

@ -13,8 +13,8 @@ module Epp::DomainsHelper
end
def check_domain
ph = params_hash['epp']['command']['check']['check']
@domains = Epp::EppDomain.check_availability(ph[:name])
names = parsed_frame.css('name').map(&:text)
@domains = Epp::EppDomain.check_availability(names)
render '/epp/domains/check'
end
@ -119,6 +119,12 @@ module Epp::DomainsHelper
private
## CHECK
def validate_domain_check_request
epp_request_valid?('name')
end
## CREATE
def validate_domain_create_request
ret = true