diff --git a/app/controllers/registrar/nameservers_controller.rb b/app/controllers/registrar/nameservers_controller.rb index 38f2a6231..89a5736b1 100644 --- a/app/controllers/registrar/nameservers_controller.rb +++ b/app/controllers/registrar/nameservers_controller.rb @@ -10,20 +10,17 @@ class Registrar return csv_list_empty_guard if domains == [] - # uri = URI.parse("#{ENV['repp_url']}registrar/nameservers") - # request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json') - # request.body = { data: { type: 'nameserver', id: params[:old_hostname], - # domains: domains || [], - # attributes: { hostname: params[:new_hostname], - # ipv4: ipv4, - # ipv6: ipv6 } } }.to_json - # request.basic_auth(current_registrar_user.username, - # current_registrar_user.plain_text_password) + uri = URI.parse("#{ENV['repp_url']}registrar/nameservers") + request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json') + request.body = { data: { type: 'nameserver', id: params[:old_hostname], + domains: domains || [], + attributes: { hostname: params[:new_hostname], + ipv4: ipv4, + ipv6: ipv6 } } }.to_json + request.basic_auth(current_registrar_user.username, + current_registrar_user.plain_text_password) - # response = do_request(request, uri) - - response = Actions::NameserverBulkChange.new(domains, params) - response.call + response = do_request(request, uri) parsed_response = JSON.parse(response.body, symbolize_names: true) @@ -54,7 +51,7 @@ class Registrar end def domain_list_from_csv - return [] if params[:puny_file].blank? + return if params[:puny_file].blank? domains = [] csv = CSV.read(params[:puny_file].path, headers: true) diff --git a/app/interactions/actions/nameserver_bulk_change.rb b/app/interactions/actions/nameserver_bulk_change.rb deleted file mode 100644 index 2ba05eb43..000000000 --- a/app/interactions/actions/nameserver_bulk_change.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Actions - class NameserverBulkChange - def initialize(domains, params, ipv4, ipv6) - @domains = domains - @params = params - @ipv4 = ipv4 - @ipv6 = ipv6 - end - - def call - uri = URI.parse("#{ENV['repp_url']}registrar/nameservers") - request = Net::HTTP::Put.new(uri, 'Content-Type' => 'application/json') - request.body = { data: { type: 'nameserver', id: @params[:old_hostname], - domains: @domains || [], - attributes: { hostname: @params[:new_hostname], - ipv4: ipv4, - ipv6: ipv6 } } }.to_json - request.basic_auth(current_registrar_user.username, - current_registrar_user.plain_text_password) - - response = do_request(request, uri) - end - end -end \ No newline at end of file