Module: Dnsimple::Client::DomainsCollaborators
- Included in:
- DomainsService
- Defined in:
- lib/dnsimple/client/domains_collaborators.rb
Instance Method Summary collapse
-
#add_collaborator(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>
Add a collaborator to the domain.
-
#collaborators(account_id, domain_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>
Lists the collaborators for a domain.
-
#remove_collaborator(account_id, domain_id, contact_id, options = {}) ⇒ Dnsimple::Response<nil>
Removes a collaborator from the domain.
Instance Method Details
#add_collaborator(account_id, domain_id, attributes, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>
Add a collaborator to the domain.
46 47 48 49 50 51 |
# File 'lib/dnsimple/client/domains_collaborators.rb', line 46 def add_collaborator(account_id, domain_id, attributes, = {}) Extra.validate_mandatory_attributes(attributes, [:email]) response = client.post(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), attributes, ) 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.
25 26 27 28 29 |
# File 'lib/dnsimple/client/domains_collaborators.rb', line 25 def collaborators(account_id, domain_id, = {}) response = client.get(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), Options::ListOptions.new()) 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.
70 71 72 73 74 |
# File 'lib/dnsimple/client/domains_collaborators.rb', line 70 def remove_collaborator(account_id, domain_id, contact_id, = {}) response = client.delete(Client.versioned("/%s/domains/%s/collaborators/%s" % [account_id, domain_id, contact_id]), ) Dnsimple::Response.new(response, nil) end |