Module: Dnsimple::Client::RegistrarRegistrantChanges

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

Instance Method Summary collapse

Instance Method Details

#check_registrant_change(account_id, attributes, options = {}) ⇒ Struct::RegistrantChangeCheck

Retrieves the requirements of a registrant change

Examples:

Check the requirements to change the contact for example.com to contact 1234:

client.registrar.check_registrant_change(1010, { domain_id: "example.com", contact_id: 1234 })

Parameters:

  • account_id (Integer)

    the account ID

  • attributes (Hash)

    the attributes to check the registrant change

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

Options Hash (attributes):

  • :domain_id (String, Integer)

    the domain ID to check

  • :contact_id (Integer)

    the contact ID to check against

Returns:

Raises:



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

def check_registrant_change(, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:domain_id, :contact_id])
  endpoint = Client.versioned("/%s/registrar/registrant_changes/check" % [])
  response = client.post(endpoint, attributes, options)

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

#create_registrant_change(account_id, attributes, options = {}) ⇒ Struct::RegistrantChange

Start registrant change.

Examples:

Start a registrant change for example.com to contact 1234:

including WHOIS privacy for the domain and enabling auto renewal:
client.registrar.create_registrant_change(1010, { domain_id: "example.com", contact_id: 1234, extended_attributes: { "x-fi-registrant-idnumber" => "1234" } })

Parameters:

  • account_id (Integer)

    the account ID

  • attributes (Hash)

    the attributes to start a registrant change

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

Options Hash (attributes):

  • :domain_id (String, Integer)

    the domain ID

  • :contact_id (Integer)

    the contact ID to change to

  • :extended_attributes (Array<Hash>, nil)

    the extended attributes to pass to the registry

Returns:

Raises:



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

def create_registrant_change(, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:domain_id, :contact_id])
  endpoint = Client.versioned("/%s/registrar/registrant_changes" % [])
  response = client.post(endpoint, attributes, options)

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

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

Cancel an ongoing registrant change from the account.

Examples:

Cancel a registrant change 42:

client.registrar.delete_registrant_change(1010, 42)

Parameters:

  • account_id (Integer)

    the account ID

  • registrant_change_id (#to_s)

    the registrant change ID

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

Returns:

Raises:



101
102
103
104
105
106
# File 'lib/dnsimple/client/registrar_registrant_changes.rb', line 101

def delete_registrant_change(, registrant_change_id, options = {})
  endpoint = Client.versioned("/%s/registrar/registrant_changes/%s" % [, registrant_change_id])
  response = client.delete(endpoint, nil, options)

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

#get_registrant_change(account_id, registrant_change_id, options = {}) ⇒ Struct::RegistrantChange

Retrieves the details of an existing registrant change.

Examples:

Retrieve the registrant change 42:

client.registrar.get_registrant_change(1010, 42)

Parameters:

  • account_id (Integer)

    the Account id

  • registrant_change_id (#to_s)

    the registrant change id

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

Returns:

Raises:



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

def get_registrant_change(, registrant_change_id, options = {})
  endpoint = Client.versioned("/%s/registrar/registrant_changes/%s" % [, registrant_change_id])
  response = client.get(endpoint, options)

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

#list_registrant_changes(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Struct::DomainRegistration>

List registrant changes in the account.

Examples:

List registrant changes for the account:

client.registrar.list_registrant_changes(1010)

Parameters:

  • account_id (Integer)

    the account ID

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

Returns:

Raises:



82
83
84
85
86
87
# File 'lib/dnsimple/client/registrar_registrant_changes.rb', line 82

def list_registrant_changes(, options = {})
  endpoint = Client.versioned("/%s/registrar/registrant_changes" % [])
  response = client.get(endpoint, options)

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::RegistrantChange.new(r) })
end