diff --git a/lib/dnsimple/client/clients.rb b/lib/dnsimple/client/clients.rb index 869e17d5..c0c98633 100644 --- a/lib/dnsimple/client/clients.rb +++ b/lib/dnsimple/client/clients.rb @@ -11,11 +11,6 @@ def certificates @services[:certificates] ||= Client::CertificatesService.new(self) end - # @return [Dnsimple::Client::CollaboratorsService] The collaborator-related API proxy. - def collaborators - @services[:collaborators] ||= Client::CollaboratorsService.new(self) - end - # @return [Dnsimple::Client::ContactsService] The contact-related API proxy. def contacts @services[:contacts] ||= Client::ContactsService.new(self) @@ -130,13 +125,6 @@ class CertificatesService < ClientService end - require_relative 'collaborators' - - class CollaboratorsService < ClientService - include Client::Collaborators - end - - require_relative 'contacts' class ContactsService < ClientService @@ -147,11 +135,13 @@ class ContactsService < ClientService require_relative 'domains' require_relative 'domains_email_forwards' require_relative 'domains_pushes' + require_relative 'collaborators' class DomainsService < ClientService include Client::Domains include Client::DomainsEmailForwards include Client::DomainsPushes + include Client::Collaborators end diff --git a/lib/dnsimple/client/collaborators.rb b/lib/dnsimple/client/collaborators.rb index 14c58f24..f9a746a9 100644 --- a/lib/dnsimple/client/collaborators.rb +++ b/lib/dnsimple/client/collaborators.rb @@ -7,10 +7,10 @@ module Collaborators # @see https://developer.dnsimple.com/v2/domains/collaborators/#list # # @example List collaborators in the first page - # client.collaborators.collaborators(1010, "example.com") + # client.domains.collaborators(1010, "example.com") # # @example List collaborators, provide a specific page - # client.collaborators.collaborators(1010, "example.com", page: 2) + # client.domains.collaborators(1010, "example.com", page: 2) # # @param [Fixnum] account_id the account ID # @param [#to_s] domain_id the domain ID or name @@ -31,7 +31,7 @@ def collaborators(account_id, domain_id, options = {}) # @see https://developer.dnsimple.com/v2/domains/collaborators/#add # # @example Add collaborator - # client.collaborators.add_collaborator(1010, "example.com", email: "user@example.com") + # client.domains.add_collaborator(1010, "example.com", email: "user@example.com") # # @param [Fixnum] account_id the account ID # @param [#to_s] domain_id the domain ID or name @@ -54,6 +54,9 @@ def add_collaborator(account_id, domain_id, attributes, options = {}) # # @see https://developer.dnsimple.com/v2/domains/collaborators/#remove # + # @example Remove collaborator + # client.domains.remove_collaborator(1010, "example.com", 999) + # # @param [Fixnum] account_id the account ID # @param [#to_s] domain_id the domain ID or name # @param [#to_s] contact_id the contact ID diff --git a/spec/dnsimple/client/collaborators_spec.rb b/spec/dnsimple/client/collaborators_spec.rb index 24c87f40..83cd1ec6 100644 --- a/spec/dnsimple/client/collaborators_spec.rb +++ b/spec/dnsimple/client/collaborators_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe Dnsimple::Client, ".collaborators" do +describe Dnsimple::Client, ".domains" do - subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").collaborators } + subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").domains } describe "#collaborators" do