mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
parent
3ef38768a5
commit
a5eaae562a
4 changed files with 62 additions and 2 deletions
|
@ -58,5 +58,6 @@ module Repp
|
|||
mount Repp::ContactV1
|
||||
mount Repp::AccountV1
|
||||
mount Repp::DomainTransfersV1
|
||||
mount Repp::NameserversV1
|
||||
end
|
||||
end
|
||||
|
|
30
app/api/repp/nameservers_v1.rb
Normal file
30
app/api/repp/nameservers_v1.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module Repp
|
||||
class NameserversV1 < Grape::API
|
||||
version 'v1', using: :path
|
||||
|
||||
resource :nameservers do
|
||||
put '/' do
|
||||
params do
|
||||
requires :data, type: Hash do
|
||||
requires :type, type: String, allow_blank: false
|
||||
requires :id, type: String, allow_blank: false
|
||||
requires :attributes, type: Hash do
|
||||
requires :hostname, type: String, allow_blank: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
current_user.registrar.nameservers.where(hostname: params[:data][:id]).each do |nameserver|
|
||||
nameserver.hostname = params[:data][:attributes][:hostname]
|
||||
nameserver.ipv4 = params[:data][:attributes][:ipv4]
|
||||
nameserver.ipv6 = params[:data][:attributes][:ipv6]
|
||||
nameserver.save!
|
||||
end
|
||||
|
||||
status 204
|
||||
body false
|
||||
@response = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue