Skip to content

Commit

Permalink
Move collaborators methods under DomainsService
Browse files Browse the repository at this point in the history
  • Loading branch information
jodosha committed Nov 22, 2016
1 parent 65ee899 commit 556ff17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
14 changes: 2 additions & 12 deletions lib/dnsimple/client/clients.rb
Expand Up @@ -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)
Expand Down Expand Up @@ -130,13 +125,6 @@ class CertificatesService < ClientService
end


require_relative 'collaborators'

class CollaboratorsService < ClientService
include Client::Collaborators
end


require_relative 'contacts'

class ContactsService < ClientService
Expand All @@ -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


Expand Down
9 changes: 6 additions & 3 deletions lib/dnsimple/client/collaborators.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions 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
Expand Down

0 comments on commit 556ff17

Please sign in to comment.