Class: Dnsimple::Client::NameServersService

Inherits:
ClientService
  • Object
show all
Defined in:
lib/dnsimple/client/name_servers_service.rb

Instance Attribute Summary

Attributes inherited from ClientService

#client

Instance Method Summary collapse

Instance Method Details

#change(domain, servers) ⇒ Array<String>

Changes the name servers for a domain.

Parameters:

  • domain (#to_s)

    The domain id or domain name.

  • servers (Array<String>)

    The name server list.

Returns:

  • (Array<String>)

    The delegates name servers.

Raises:

See Also:


29
30
31
32
33
34
# File 'lib/dnsimple/client/name_servers_service.rb', line 29

def change(domain, servers)
  servers = servers.inject({}) { |hash, server| hash.merge("ns#{hash.length + 1}" => server) }
  options = { name_servers: servers }
  response = client.post("v1/domains/#{domain}/name_servers", options)
  response.parsed_response
end

#list(domain) ⇒ Array<String>

Lists the name servers for a domain.

Parameters:

  • domain (#to_s)

    The domain id or domain name.

Returns:

  • (Array<String>)

    The delegates name servers.

Raises:

See Also:


14
15
16
17
# File 'lib/dnsimple/client/name_servers_service.rb', line 14

def list(domain)
  response = client.get("v1/domains/#{domain}/name_servers")
  response.parsed_response
end