Module: Dnsimple::Client::Registrar

Included in:
RegistrarService
Defined in:
lib/dnsimple/client/registrar.rb

Instance Method Summary collapse

Instance Method Details

#cancel_domain_transfer(account_id, domain_name, domain_transfer_id, options = {}) ⇒ Struct::DomainTransfer

Cancels an in progress domain transfer.

Examples:

Cancel the transfer 42 for example.com:

client.registrar.cancel_domain_transfer(1010, "example.com", 42)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • domain_transfer_id (Integer)

    the domain transfer ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



194
195
196
197
198
199
# File 'lib/dnsimple/client/registrar.rb', line 194

def cancel_domain_transfer(, domain_name, domain_transfer_id, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [, domain_name, domain_transfer_id])
  response = client.delete(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
end

#check_domain(account_id, domain_name, options = {}) ⇒ Struct::DomainCheck

Checks whether a domain is available to be registered.

Examples:

Check whether example.com is available:

client.registrar.check_domain(1010, "example.com")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to check

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



20
21
22
23
24
25
# File 'lib/dnsimple/client/registrar.rb', line 20

def check_domain(, domain_name, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/check" % [, domain_name])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainCheck.new(response["data"]))
end

#get_domain_prices(account_id, domain_name, options = {}) ⇒ Struct::DomainPrice

Get prices for a domain.

Examples:

Check prices for example.com:

client.registrar.get_domain_prices(1010, "example.com")

Parameters:

  • account_id (Integer)

    the Account id

  • domain_name (String)

    the domain name to find the prices

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



40
41
42
43
44
45
# File 'lib/dnsimple/client/registrar.rb', line 40

def get_domain_prices(, domain_name, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/prices" % [, domain_name])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainPrice.new(response["data"]))
end

#get_domain_registration(account_id, domain_name, domain_registration_id, options = {}) ⇒ Struct::DomainRegistration

Retrieves the details of an existing domain registration.

Examples:

Retrieve the registration 42 for example.com:

client.registrar.get_domain_registration(1010, "example.com", 42)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • domain_registration_id (Integer)

    the domain registration ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



85
86
87
88
89
90
# File 'lib/dnsimple/client/registrar.rb', line 85

def get_domain_registration(, domain_name, domain_registration_id, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/registrations/%s" % [, domain_name, domain_registration_id])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainRegistration.new(response["data"]))
end

#get_domain_renewal(account_id, domain_name, domain_renewal_id, options = {}) ⇒ Struct::DomainRenewal

Retrieve the details of an existing domain renewal.

Examples:

Retrieve the renewal 42 for example.com:

client.registrar.get_domain_renewal(1010, "example.com", 42)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • domain_renewal_id (Integer)

    the domain renewal ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



128
129
130
131
132
133
# File 'lib/dnsimple/client/registrar.rb', line 128

def get_domain_renewal(, domain_name, domain_renewal_id, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/renewals/%s" % [, domain_name, domain_renewal_id])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainRenewal.new(response["data"]))
end

#get_domain_restore(account_id, domain_name, domain_restore_id, options = {}) ⇒ Struct::DomainRestore

Retrieve the details of an existing domain restore.

Examples:

Retrieve the restore 42 for example.com:

client.registrar.get_domain_restore(1010, "example.com", 42)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • domain_restore_id (Integer)

    the domain restore ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



257
258
259
260
261
262
# File 'lib/dnsimple/client/registrar.rb', line 257

def get_domain_restore(, domain_name, domain_restore_id, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/restores/%s" % [, domain_name, domain_restore_id])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainRestore.new(response["data"]))
end

#get_domain_transfer(account_id, domain_name, domain_transfer_id, options = {}) ⇒ Struct::DomainTransfer

Retrieves the details of an existing domain transfer.

Examples:

Retrieve the transfer 42 for example.com:

client.registrar.get_domain_transfer(1010, "example.com", 42)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name

  • domain_transfer_id (Integer)

    the domain transfer ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



172
173
174
175
176
177
# File 'lib/dnsimple/client/registrar.rb', line 172

def get_domain_transfer(, domain_name, domain_transfer_id, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [, domain_name, domain_transfer_id])
  response = client.get(endpoint, options)

  Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
end

#register_domain(account_id, domain_name, attributes, options = {}) ⇒ Struct::DomainRegistration

Registers a domain.

Examples:

Initiate the registration of example.com using the contact 1234 as registrant

including WHOIS privacy for the domain and enabling auto renewal:
client.registrar.register_domain(1010, "example.com", registrant_id: 1234, private_whois: true, auto_renew: true)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to register

  • attributes (Hash)
  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



62
63
64
65
66
67
68
# File 'lib/dnsimple/client/registrar.rb', line 62

def register_domain(, domain_name, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:registrant_id])
  endpoint = Client.versioned("/%s/registrar/domains/%s/registrations" % [, domain_name])
  response = client.post(endpoint, attributes, options)

  Dnsimple::Response.new(response, Struct::DomainRegistration.new(response["data"]))
end

#renew_domain(account_id, domain_name, attributes = nil, options = {}) ⇒ Struct::DomainRenewal

Renews a domain.

Examples:

Renew example.com for 3 years:

client.registrar.renew_domain(1010, "example.com", period: 3)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to renew

  • attributes (Hash) (defaults to: nil)
  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



106
107
108
109
110
111
# File 'lib/dnsimple/client/registrar.rb', line 106

def renew_domain(, domain_name, attributes = nil, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/renewals" % [, domain_name])
  response = client.post(endpoint, attributes, options)

  Dnsimple::Response.new(response, Struct::DomainRenewal.new(response["data"]))
end

#restore_domain(account_id, domain_name, attributes = nil, options = {}) ⇒ Struct::DomainRestore

Restores a domain.

Examples:

Restore example.com:

client.registrar.restore_domain(1010, "example.com", {})

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to restore

  • attributes (Hash) (defaults to: nil)
  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



235
236
237
238
239
240
# File 'lib/dnsimple/client/registrar.rb', line 235

def restore_domain(, domain_name, attributes = nil, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/restores" % [, domain_name])
  response = client.post(endpoint, attributes, options)

  Dnsimple::Response.new(response, Struct::DomainRestore.new(response["data"]))
end

#transfer_domain(account_id, domain_name, attributes, options = {}) ⇒ Struct::DomainTransfer

Starts the transfer of a domain to DNSimple.

Examples:

Initiate the transfer for example.com using the contact 1234 as registrant:

client.registrar.transfer_domain(1010, "example.com", registrant_id: 1234, auth_code: "x1y2z3")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to transfer

  • attributes (Hash)
  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



149
150
151
152
153
154
155
# File 'lib/dnsimple/client/registrar.rb', line 149

def transfer_domain(, domain_name, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:registrant_id])
  endpoint = Client.versioned("/%s/registrar/domains/%s/transfers" % [, domain_name])
  response = client.post(endpoint, attributes, options)

  Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
end

#transfer_domain_out(account_id, domain_name, options = {}) ⇒ Dnsimple::Response<nil>

Requests the transfer of a domain out of DNSimple.

Examples:

Request to transfer of example.com out of DNSimple:

client.registrar.transfer_domain_out(1010, "example.com")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_name (#to_s)

    the domain name to transfer out

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



214
215
216
217
218
219
# File 'lib/dnsimple/client/registrar.rb', line 214

def transfer_domain_out(, domain_name, options = {})
  endpoint = Client.versioned("/%s/registrar/domains/%s/authorize_transfer_out" % [, domain_name])
  response = client.post(endpoint, nil, options)

  Dnsimple::Response.new(response, nil)
end