Module: Dnsimple::Client::DomainsCollaborators

Included in:
DomainsService
Defined in:
lib/dnsimple/client/domains_collaborators.rb

Instance Method Summary collapse

Instance Method Details

#add_collaborator(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>

Add a collaborator to the domain.

Examples:

Add collaborator

client.domains.add_collaborator(1010, "example.com", email: "[email protected]")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or name

  • attributes (Hash)

    user attributes

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

    request options

Options Hash (attributes):

  • :email (String)

    user email (mandatory)

Returns:

Raises:

See Also:



46
47
48
49
50
51
# File 'lib/dnsimple/client/domains_collaborators.rb', line 46

def add_collaborator(, domain_id, attributes, options = {})
  Extra.validate_mandatory_attributes(attributes, [:email])
  response = client.post(Client.versioned("/%s/domains/%s/collaborators" % [, domain_id]), attributes, options)

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

#collaborators(account_id, domain_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>

Lists the collaborators for a domain.

Examples:

List collaborators in the first page

client.domains.collaborators(1010, "example.com")

List collaborators, provide a specific page

client.domains.collaborators(1010, "example.com", page: 2)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or name

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

    request options

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

Returns:

Raises:

See Also:



25
26
27
28
29
# File 'lib/dnsimple/client/domains_collaborators.rb', line 25

def collaborators(, domain_id, options = {})
  response = client.get(Client.versioned("/%s/domains/%s/collaborators" % [, domain_id]), Options::ListOptions.new(options))

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

#remove_collaborator(account_id, domain_id, contact_id, options = {}) ⇒ Dnsimple::Response<nil>

Removes a collaborator from the domain.

WARNING: this cannot be undone.

Examples:

Remove collaborator

client.domains.remove_collaborator(1010, "example.com", 999)

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain ID or name

  • contact_id (#to_s)

    the contact ID

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

    request options

Returns:

Raises:

See Also:



70
71
72
73
74
# File 'lib/dnsimple/client/domains_collaborators.rb', line 70

def remove_collaborator(, domain_id, contact_id, options = {})
  response = client.delete(Client.versioned("/%s/domains/%s/collaborators/%s" % [, domain_id, contact_id]), options)

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