dnsimple 10.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +5 -7
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/sync-test-fixtures.yml +55 -0
- data/.markdownlint.yaml +15 -1
- data/.rubocop.yml +1 -1
- data/.rubocop_dnsimple.yml +14 -30
- data/CHANGELOG.md +5 -0
- data/Gemfile +7 -7
- data/lib/dnsimple/client/clients.rb +29 -31
- data/lib/dnsimple/client/domains_email_forwards.rb +1 -1
- data/lib/dnsimple/client.rb +5 -5
- data/lib/dnsimple/default.rb +7 -7
- data/lib/dnsimple/response.rb +3 -3
- data/lib/dnsimple/struct/charge.rb +1 -1
- data/lib/dnsimple/struct/email_forward.rb +0 -8
- data/lib/dnsimple/struct.rb +40 -40
- data/lib/dnsimple/version.rb +1 -1
- data/lib/dnsimple.rb +5 -5
- data/spec/dnsimple/client/accounts_spec.rb +2 -2
- data/spec/dnsimple/client/billing_spec.rb +3 -3
- data/spec/dnsimple/client/certificates_spec.rb +11 -11
- data/spec/dnsimple/client/client_service_spec.rb +1 -1
- data/spec/dnsimple/client/contacts_spec.rb +6 -6
- data/spec/dnsimple/client/dns_analytics_spec.rb +9 -9
- data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +5 -5
- data/spec/dnsimple/client/domains_dnssec_spec.rb +4 -4
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +8 -15
- data/spec/dnsimple/client/domains_pushes_spec.rb +5 -5
- data/spec/dnsimple/client/domains_spec.rb +6 -6
- data/spec/dnsimple/client/identity_spec.rb +2 -2
- data/spec/dnsimple/client/oauth_spec.rb +3 -3
- data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +3 -3
- data/spec/dnsimple/client/registrar_delegation_spec.rb +1 -1
- data/spec/dnsimple/client/registrar_spec.rb +1 -1
- data/spec/dnsimple/client/registrar_transfer_lock_spec.rb +4 -4
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +1 -1
- data/spec/dnsimple/client/services_domains_spec.rb +4 -4
- data/spec/dnsimple/client/services_spec.rb +1 -1
- data/spec/dnsimple/client/templates_domains_spec.rb +2 -2
- data/spec/dnsimple/client/templates_records_spec.rb +4 -4
- data/spec/dnsimple/client/templates_spec.rb +2 -2
- data/spec/dnsimple/client/tlds_spec.rb +5 -5
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +1 -1
- data/spec/dnsimple/client/webhooks_spec.rb +5 -5
- data/spec/dnsimple/client/zones_distributions_spec.rb +3 -3
- data/spec/dnsimple/client/zones_records_spec.rb +7 -7
- data/spec/dnsimple/client/zones_spec.rb +6 -6
- data/spec/dnsimple/client_spec.rb +10 -10
- data/spec/dnsimple/extra_spec.rb +1 -1
- data/spec/dnsimple/options/base_spec.rb +5 -5
- data/spec/dnsimple/options/list_options_spec.rb +21 -21
- data/spec/fixtures.http/accounts/success-user.http +2 -1
- data/spec/fixtures.http/checkRegistrantChange/error-contactnotfound.http +4 -4
- data/spec/fixtures.http/checkRegistrantChange/error-domainnotfound.http +4 -4
- data/spec/fixtures.http/checkRegistrantChange/success.http +5 -5
- data/spec/fixtures.http/createContact/error-validation-errors.http +18 -0
- data/spec/fixtures.http/createEmailForward/created.http +1 -2
- data/spec/fixtures.http/createRegistrantChange/success.http +5 -5
- data/spec/fixtures.http/createWebhook/created.http +16 -16
- data/spec/fixtures.http/deleteRegistrantChange/success.http +4 -4
- data/spec/fixtures.http/deleteRegistrantChange/success_async.http +14 -0
- data/spec/fixtures.http/dnsAnalytics/success.http +1 -1
- data/spec/fixtures.http/getDomainPrices/failure.http +18 -18
- data/spec/fixtures.http/getDomainPrices/success.http +21 -21
- data/spec/fixtures.http/getDomainRestore/success.http +13 -14
- data/spec/fixtures.http/getEmailForward/success.http +1 -2
- data/spec/fixtures.http/getRegistrantChange/success.http +5 -5
- data/spec/fixtures.http/getTld/success.http +1 -1
- data/spec/fixtures.http/getWebhook/success.http +16 -16
- data/spec/fixtures.http/listAccounts/success-user.http +1 -1
- data/spec/fixtures.http/listCharges/fail-400-bad-filter.http +0 -2
- data/spec/fixtures.http/listCharges/fail-403.http +0 -2
- data/spec/fixtures.http/listCharges/success.http +0 -2
- data/spec/fixtures.http/listEmailForwards/success.http +1 -1
- data/spec/fixtures.http/listRegistrantChanges/success.http +5 -5
- data/spec/fixtures.http/listTlds/success.http +1 -1
- data/spec/fixtures.http/listWebhooks/success.http +16 -16
- data/spec/fixtures.http/registerDomain/error-extended-attributes.http +18 -0
- data/spec/fixtures.http/restoreDomain/success.http +12 -13
- data/spec/fixtures.http/updateZoneNsRecords/success.http +16 -0
- data/spec/fixtures.http/whoami/success-account.http +1 -1
- data/spec/fixtures.http/whoami/success.http +1 -1
- data/spec/spec_helper.rb +4 -4
- data/spec/support/webmock.rb +1 -1
- metadata +7 -11
- data/.github/CODEOWNERS +0 -1
- data/.github/workflows/auto-merge.yml +0 -32
- data/lib/dnsimple/client/domains_collaborators.rb +0 -87
- data/spec/dnsimple/client/domains_collaborators_spec.rb +0 -164
- data/spec/fixtures.http/addCollaborator/invite-success.http +0 -20
- data/spec/fixtures.http/addCollaborator/success.http +0 -20
- data/spec/fixtures.http/listCollaborators/success.http +0 -20
- data/spec/fixtures.http/notfound-collaborator.http +0 -15
- data/spec/fixtures.http/removeCollaborator/success.http +0 -17
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnsimple
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 11.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DNSimple
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -88,11 +88,10 @@ extensions: []
|
|
88
88
|
extra_rdoc_files:
|
89
89
|
- LICENSE.txt
|
90
90
|
files:
|
91
|
-
- ".github/CODEOWNERS"
|
92
91
|
- ".github/dependabot.yml"
|
93
|
-
- ".github/workflows/auto-merge.yml"
|
94
92
|
- ".github/workflows/ci.yml"
|
95
93
|
- ".github/workflows/release.yml"
|
94
|
+
- ".github/workflows/sync-test-fixtures.yml"
|
96
95
|
- ".gitignore"
|
97
96
|
- ".markdownlint.yaml"
|
98
97
|
- ".rspec"
|
@@ -116,7 +115,6 @@ files:
|
|
116
115
|
- lib/dnsimple/client/contacts.rb
|
117
116
|
- lib/dnsimple/client/dns_analytics.rb
|
118
117
|
- lib/dnsimple/client/domains.rb
|
119
|
-
- lib/dnsimple/client/domains_collaborators.rb
|
120
118
|
- lib/dnsimple/client/domains_delegation_signer_records.rb
|
121
119
|
- lib/dnsimple/client/domains_dnssec.rb
|
122
120
|
- lib/dnsimple/client/domains_email_forwards.rb
|
@@ -193,7 +191,6 @@ files:
|
|
193
191
|
- spec/dnsimple/client/client_service_spec.rb
|
194
192
|
- spec/dnsimple/client/contacts_spec.rb
|
195
193
|
- spec/dnsimple/client/dns_analytics_spec.rb
|
196
|
-
- spec/dnsimple/client/domains_collaborators_spec.rb
|
197
194
|
- spec/dnsimple/client/domains_delegation_signer_records_spec.rb
|
198
195
|
- spec/dnsimple/client/domains_dnssec_spec.rb
|
199
196
|
- spec/dnsimple/client/domains_email_forwards_spec.rb
|
@@ -225,8 +222,6 @@ files:
|
|
225
222
|
- spec/fixtures.http/accounts/success-account.http
|
226
223
|
- spec/fixtures.http/accounts/success-user.http
|
227
224
|
- spec/fixtures.http/activateZoneService/success.http
|
228
|
-
- spec/fixtures.http/addCollaborator/invite-success.http
|
229
|
-
- spec/fixtures.http/addCollaborator/success.http
|
230
225
|
- spec/fixtures.http/appliedServices/success.http
|
231
226
|
- spec/fixtures.http/applyService/success.http
|
232
227
|
- spec/fixtures.http/applyTemplate/success.http
|
@@ -250,6 +245,7 @@ files:
|
|
250
245
|
- spec/fixtures.http/checkZoneRecordDistribution/failure.http
|
251
246
|
- spec/fixtures.http/checkZoneRecordDistribution/success.http
|
252
247
|
- spec/fixtures.http/createContact/created.http
|
248
|
+
- spec/fixtures.http/createContact/error-validation-errors.http
|
253
249
|
- spec/fixtures.http/createDelegationSignerRecord/created.http
|
254
250
|
- spec/fixtures.http/createDelegationSignerRecord/validation-error.http
|
255
251
|
- spec/fixtures.http/createDomain/created.http
|
@@ -269,6 +265,7 @@ files:
|
|
269
265
|
- spec/fixtures.http/deleteDomain/success.http
|
270
266
|
- spec/fixtures.http/deleteEmailForward/success.http
|
271
267
|
- spec/fixtures.http/deleteRegistrantChange/success.http
|
268
|
+
- spec/fixtures.http/deleteRegistrantChange/success_async.http
|
272
269
|
- spec/fixtures.http/deleteTemplate/success.http
|
273
270
|
- spec/fixtures.http/deleteTemplateRecord/success.http
|
274
271
|
- spec/fixtures.http/deleteWebhook/success.http
|
@@ -329,7 +326,6 @@ files:
|
|
329
326
|
- spec/fixtures.http/listCharges/fail-400-bad-filter.http
|
330
327
|
- spec/fixtures.http/listCharges/fail-403.http
|
331
328
|
- spec/fixtures.http/listCharges/success.http
|
332
|
-
- spec/fixtures.http/listCollaborators/success.http
|
333
329
|
- spec/fixtures.http/listContacts/success.http
|
334
330
|
- spec/fixtures.http/listDelegationSignerRecords/success.http
|
335
331
|
- spec/fixtures.http/listDomains/success.http
|
@@ -346,7 +342,6 @@ files:
|
|
346
342
|
- spec/fixtures.http/listZones/success.http
|
347
343
|
- spec/fixtures.http/method-not-allowed.http
|
348
344
|
- spec/fixtures.http/notfound-certificate.http
|
349
|
-
- spec/fixtures.http/notfound-collaborator.http
|
350
345
|
- spec/fixtures.http/notfound-contact.http
|
351
346
|
- spec/fixtures.http/notfound-delegationsignerrecord.http
|
352
347
|
- spec/fixtures.http/notfound-domain.http
|
@@ -364,9 +359,9 @@ files:
|
|
364
359
|
- spec/fixtures.http/pages-3of3.http
|
365
360
|
- spec/fixtures.http/purchaseLetsencryptCertificate/success.http
|
366
361
|
- spec/fixtures.http/purchaseRenewalLetsencryptCertificate/success.http
|
362
|
+
- spec/fixtures.http/registerDomain/error-extended-attributes.http
|
367
363
|
- spec/fixtures.http/registerDomain/success.http
|
368
364
|
- spec/fixtures.http/rejectPush/success.http
|
369
|
-
- spec/fixtures.http/removeCollaborator/success.http
|
370
365
|
- spec/fixtures.http/renewDomain/error-tooearly.http
|
371
366
|
- spec/fixtures.http/renewDomain/success.http
|
372
367
|
- spec/fixtures.http/renewWhoisPrivacy/success.http
|
@@ -382,6 +377,7 @@ files:
|
|
382
377
|
- spec/fixtures.http/unlinkPrimaryServer/success.http
|
383
378
|
- spec/fixtures.http/updateContact/success.http
|
384
379
|
- spec/fixtures.http/updateTemplate/success.http
|
380
|
+
- spec/fixtures.http/updateZoneNsRecords/success.http
|
385
381
|
- spec/fixtures.http/updateZoneRecord/success.http
|
386
382
|
- spec/fixtures.http/validation-error.http
|
387
383
|
- spec/fixtures.http/whoami/success-account.http
|
data/.github/CODEOWNERS
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
* @dnsimple/external-integrations
|
@@ -1,32 +0,0 @@
|
|
1
|
-
name: Auto-merge
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
types:
|
6
|
-
- labeled
|
7
|
-
- synchronize
|
8
|
-
- opened
|
9
|
-
|
10
|
-
jobs:
|
11
|
-
auto-merge:
|
12
|
-
name: 'Auto-merge'
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
permissions: write-all
|
15
|
-
|
16
|
-
if: github.event.pull_request.user.login == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'automerge')
|
17
|
-
steps:
|
18
|
-
- name: Wait for tests to succeed
|
19
|
-
uses: lewagon/wait-on-check-action@v1.3.4
|
20
|
-
timeout-minutes: 15
|
21
|
-
with:
|
22
|
-
ref: ${{ github.ref }}
|
23
|
-
running-workflow-name: 'Auto-merge'
|
24
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
25
|
-
wait-interval: 10
|
26
|
-
allowed-conclusions: success
|
27
|
-
- uses: juliangruber/merge-pull-request-action@v1
|
28
|
-
with:
|
29
|
-
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
30
|
-
number: ${{ github.event.number }}
|
31
|
-
method: squash
|
32
|
-
repo: dnsimple/dnsimple-ruby
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Dnsimple
|
4
|
-
class Client
|
5
|
-
module DomainsCollaborators
|
6
|
-
|
7
|
-
# Lists the collaborators for a domain.
|
8
|
-
#
|
9
|
-
# @see https://developer.dnsimple.com/v2/domains/collaborators/#list
|
10
|
-
#
|
11
|
-
# @example List collaborators in the first page
|
12
|
-
# client.domains.collaborators(1010, "example.com")
|
13
|
-
#
|
14
|
-
# @example List collaborators, provide a specific page
|
15
|
-
# client.domains.collaborators(1010, "example.com", page: 2)
|
16
|
-
#
|
17
|
-
# @param [Integer] account_id the account ID
|
18
|
-
# @param [#to_s] domain_id the domain ID or name
|
19
|
-
# @param [Hash] options request options
|
20
|
-
# @option options [Integer] :page current page (pagination)
|
21
|
-
# @option options [Integer] :per_page number of entries to return (pagination)
|
22
|
-
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>]
|
23
|
-
# @deprecated `DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.
|
24
|
-
#
|
25
|
-
# @raise [Dnsimple::RequestError]
|
26
|
-
def collaborators(account_id, domain_id, options = {})
|
27
|
-
Dnsimple.deprecate('`DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.')
|
28
|
-
|
29
|
-
response = client.get(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), Options::ListOptions.new(options))
|
30
|
-
|
31
|
-
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Collaborator.new(r) })
|
32
|
-
end
|
33
|
-
|
34
|
-
# Add a collaborator to the domain.
|
35
|
-
#
|
36
|
-
# @see https://developer.dnsimple.com/v2/domains/collaborators/#add
|
37
|
-
#
|
38
|
-
# @example Add collaborator
|
39
|
-
# client.domains.add_collaborator(1010, "example.com", email: "user@example.com")
|
40
|
-
#
|
41
|
-
# @param [Integer] account_id the account ID
|
42
|
-
# @param [#to_s] domain_id the domain ID or name
|
43
|
-
# @param [Hash] attributes user attributes
|
44
|
-
# @option attributes [String] :email user email (mandatory)
|
45
|
-
# @param [Hash] options request options
|
46
|
-
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>]
|
47
|
-
# @deprecated `DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.
|
48
|
-
#
|
49
|
-
# @raise [Dnsimple::RequestError]
|
50
|
-
def add_collaborator(account_id, domain_id, attributes, options = {})
|
51
|
-
Dnsimple.deprecate('`DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.')
|
52
|
-
|
53
|
-
Extra.validate_mandatory_attributes(attributes, [:email])
|
54
|
-
response = client.post(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), attributes, options)
|
55
|
-
|
56
|
-
Dnsimple::Response.new(response, Struct::Collaborator.new(response["data"]))
|
57
|
-
end
|
58
|
-
|
59
|
-
# Removes a collaborator from the domain.
|
60
|
-
#
|
61
|
-
# WARNING: this cannot be undone.
|
62
|
-
#
|
63
|
-
# @see https://developer.dnsimple.com/v2/domains/collaborators/#remove
|
64
|
-
#
|
65
|
-
# @example Remove collaborator
|
66
|
-
# client.domains.remove_collaborator(1010, "example.com", 999)
|
67
|
-
#
|
68
|
-
# @param [Integer] account_id the account ID
|
69
|
-
# @param [#to_s] domain_id the domain ID or name
|
70
|
-
# @param [#to_s] contact_id the contact ID
|
71
|
-
# @param [Hash] options request options
|
72
|
-
# @return [Dnsimple::Response<nil>]
|
73
|
-
#
|
74
|
-
# @deprecated `DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.
|
75
|
-
# @raise [Dnsimple::NotFoundError]
|
76
|
-
# @raise [Dnsimple::RequestError]
|
77
|
-
def remove_collaborator(account_id, domain_id, contact_id, options = {})
|
78
|
-
Dnsimple.deprecate('`DomainCollaborators` have been deprecated and will be removed in the next major version. Please use our Domain Access Control feature.')
|
79
|
-
|
80
|
-
response = client.delete(Client.versioned("/%s/domains/%s/collaborators/%s" % [account_id, domain_id, contact_id]), options)
|
81
|
-
|
82
|
-
Dnsimple::Response.new(response, nil)
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,164 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Dnsimple::Client, ".domains" do
|
6
|
-
|
7
|
-
subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").domains }
|
8
|
-
|
9
|
-
|
10
|
-
describe "#collaborators" do
|
11
|
-
let(:account_id) { 1010 }
|
12
|
-
let(:domain_id) { "example.com" }
|
13
|
-
|
14
|
-
before do
|
15
|
-
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators})
|
16
|
-
.to_return(read_http_fixture("listCollaborators/success.http"))
|
17
|
-
end
|
18
|
-
|
19
|
-
it "builds the correct request" do
|
20
|
-
subject.collaborators(account_id, domain_id)
|
21
|
-
|
22
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators")
|
23
|
-
.with(headers: { 'Accept' => 'application/json' })
|
24
|
-
end
|
25
|
-
|
26
|
-
it "supports pagination" do
|
27
|
-
subject.collaborators(account_id, domain_id, page: 2)
|
28
|
-
|
29
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators?page=2")
|
30
|
-
end
|
31
|
-
|
32
|
-
it "supports extra request options" do
|
33
|
-
subject.collaborators(account_id, domain_id, query: { foo: "bar" })
|
34
|
-
|
35
|
-
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators?foo=bar")
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns the collaborators" do
|
39
|
-
response = subject.collaborators(account_id, domain_id)
|
40
|
-
|
41
|
-
expect(response).to be_a(Dnsimple::PaginatedResponse)
|
42
|
-
expect(response.data).to be_a(Array)
|
43
|
-
expect(response.data.size).to eq(2)
|
44
|
-
|
45
|
-
response.data.each do |result|
|
46
|
-
expect(result).to be_a(Dnsimple::Struct::Collaborator)
|
47
|
-
expect(result.id).to be_a(Integer)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
it "exposes the pagination information" do
|
52
|
-
response = subject.collaborators(account_id, domain_id)
|
53
|
-
|
54
|
-
expect(response.respond_to?(:page)).to be(true)
|
55
|
-
expect(response.page).to eq(1)
|
56
|
-
expect(response.per_page).to be_a(Integer)
|
57
|
-
expect(response.total_entries).to be_a(Integer)
|
58
|
-
expect(response.total_pages).to be_a(Integer)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
describe "#add_collaborator" do
|
63
|
-
let(:account_id) { 1010 }
|
64
|
-
let(:domain_id) { "example.com" }
|
65
|
-
|
66
|
-
context "when inviting a user already registered on DNSimple" do
|
67
|
-
before do
|
68
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators$})
|
69
|
-
.to_return(read_http_fixture("addCollaborator/success.http"))
|
70
|
-
end
|
71
|
-
|
72
|
-
let(:attributes) { { email: "existing-user@example.com" } }
|
73
|
-
|
74
|
-
it "builds the correct request" do
|
75
|
-
subject.add_collaborator(account_id, domain_id, attributes)
|
76
|
-
|
77
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators")
|
78
|
-
.with(body: attributes)
|
79
|
-
.with(headers: { 'Accept' => 'application/json' })
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns the contact" do
|
83
|
-
response = subject.add_collaborator(account_id, domain_id, attributes)
|
84
|
-
expect(response).to be_a(Dnsimple::Response)
|
85
|
-
|
86
|
-
result = response.data
|
87
|
-
expect(result).to be_a(Dnsimple::Struct::Collaborator)
|
88
|
-
expect(result.id).to be_a(Integer)
|
89
|
-
expect(result.user_id).to be_a(Integer)
|
90
|
-
expect(result.accepted_at).to be_a(String)
|
91
|
-
expect(result.user_email).to eq(attributes.fetch(:email))
|
92
|
-
expect(result.invitation).to be(false)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context "when inviting a user not registered on DNSimple" do
|
97
|
-
before do
|
98
|
-
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators$})
|
99
|
-
.to_return(read_http_fixture("addCollaborator/invite-success.http"))
|
100
|
-
end
|
101
|
-
|
102
|
-
let(:attributes) { { email: "invited-user@example.com" } }
|
103
|
-
|
104
|
-
it "builds the correct request" do
|
105
|
-
subject.add_collaborator(account_id, domain_id, attributes)
|
106
|
-
|
107
|
-
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators")
|
108
|
-
.with(body: attributes)
|
109
|
-
.with(headers: { 'Accept' => 'application/json' })
|
110
|
-
end
|
111
|
-
|
112
|
-
it "returns the contact" do
|
113
|
-
response = subject.add_collaborator(account_id, domain_id, attributes)
|
114
|
-
expect(response).to be_a(Dnsimple::Response)
|
115
|
-
|
116
|
-
result = response.data
|
117
|
-
expect(result).to be_a(Dnsimple::Struct::Collaborator)
|
118
|
-
expect(result.id).to be_a(Integer)
|
119
|
-
expect(result.user_id).to be_nil
|
120
|
-
expect(result.accepted_at).to be_nil
|
121
|
-
expect(result.user_email).to eq(attributes.fetch(:email))
|
122
|
-
expect(result.invitation).to be(true)
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
describe "#remove_collaborator" do
|
128
|
-
let(:account_id) { 1010 }
|
129
|
-
let(:domain_id) { "example.com" }
|
130
|
-
let(:collaborator_id) { 100 }
|
131
|
-
|
132
|
-
before do
|
133
|
-
stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators/.+$})
|
134
|
-
.to_return(read_http_fixture("removeCollaborator/success.http"))
|
135
|
-
end
|
136
|
-
|
137
|
-
it "builds the correct request" do
|
138
|
-
subject.remove_collaborator(account_id, domain_id, collaborator_id)
|
139
|
-
|
140
|
-
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/collaborators/#{collaborator_id}")
|
141
|
-
.with(headers: { 'Accept' => 'application/json' })
|
142
|
-
end
|
143
|
-
|
144
|
-
it "returns nothing" do
|
145
|
-
response = subject.remove_collaborator(account_id, domain_id, collaborator_id)
|
146
|
-
expect(response).to be_a(Dnsimple::Response)
|
147
|
-
|
148
|
-
result = response.data
|
149
|
-
expect(result).to be_nil
|
150
|
-
end
|
151
|
-
|
152
|
-
context "when the collaborator does not exist" do
|
153
|
-
it "raises NotFoundError" do
|
154
|
-
stub_request(:delete, %r{/v2})
|
155
|
-
.to_return(read_http_fixture("notfound-collaborator.http"))
|
156
|
-
|
157
|
-
expect {
|
158
|
-
subject.remove_collaborator(account_id, domain_id, collaborator_id)
|
159
|
-
}.to raise_error(Dnsimple::NotFoundError)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
HTTP/1.1 201 Created
|
2
|
-
Server: nginx
|
3
|
-
Date: Fri, 07 Oct 2016 08:51:12 GMT
|
4
|
-
Content-Type: application/json; charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
X-RateLimit-Limit: 2400
|
7
|
-
X-RateLimit-Remaining: 2398
|
8
|
-
X-RateLimit-Reset: 1475833772
|
9
|
-
ETag: W/"3e59e2eafbf1d4b626413a5703309b57"
|
10
|
-
Cache-Control: max-age=0, private, must-revalidate
|
11
|
-
X-Request-Id: 9f27e164-2448-4d23-ad67-4ecedaec063e
|
12
|
-
X-Runtime: 0.387144
|
13
|
-
X-Content-Type-Options: nosniff
|
14
|
-
X-Download-Options: noopen
|
15
|
-
X-Frame-Options: DENY
|
16
|
-
X-Permitted-Cross-Domain-Policies: none
|
17
|
-
X-XSS-Protection: 1; mode=block
|
18
|
-
Strict-Transport-Security: max-age=31536000
|
19
|
-
|
20
|
-
{"data":{"id":101,"domain_id":1,"domain_name":"example.com","user_id":null,"user_email":"invited-user@example.com","invitation":true,"created_at":"2016-10-07T08:51:12Z","updated_at":"2016-10-07T08:51:12Z","accepted_at":null}}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
HTTP/1.1 201 Created
|
2
|
-
Server: nginx
|
3
|
-
Date: Fri, 07 Oct 2016 08:53:41 GMT
|
4
|
-
Content-Type: application/json; charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
X-RateLimit-Limit: 2400
|
7
|
-
X-RateLimit-Remaining: 2397
|
8
|
-
X-RateLimit-Reset: 1475833772
|
9
|
-
ETag: W/"d35fa3da40b4f6586503174563d71bfc"
|
10
|
-
Cache-Control: max-age=0, private, must-revalidate
|
11
|
-
X-Request-Id: 42de3144-37c7-4329-88c4-fdc103cb150f
|
12
|
-
X-Runtime: 0.156436
|
13
|
-
X-Content-Type-Options: nosniff
|
14
|
-
X-Download-Options: noopen
|
15
|
-
X-Frame-Options: DENY
|
16
|
-
X-Permitted-Cross-Domain-Policies: none
|
17
|
-
X-XSS-Protection: 1; mode=block
|
18
|
-
Strict-Transport-Security: max-age=31536000
|
19
|
-
|
20
|
-
{"data":{"id":100,"domain_id":1,"domain_name":"example.com","user_id":999,"user_email":"existing-user@example.com","invitation":false,"created_at":"2016-10-07T08:53:41Z","updated_at":"2016-10-07T08:53:41Z","accepted_at":"2016-10-07T08:53:41Z"}}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
HTTP/1.1 200 OK
|
2
|
-
Server: nginx
|
3
|
-
Date: Fri, 07 Oct 2016 08:58:05 GMT
|
4
|
-
Content-Type: application/json; charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
X-RateLimit-Limit: 2400
|
7
|
-
X-RateLimit-Remaining: 2396
|
8
|
-
X-RateLimit-Reset: 1475833772
|
9
|
-
ETag: W/"6e597053b3cfbbfec6801fcdc2e98466"
|
10
|
-
Cache-Control: max-age=0, private, must-revalidate
|
11
|
-
X-Request-Id: ccbbef00-d0a7-442f-9f40-80df8cea868d
|
12
|
-
X-Runtime: 0.063426
|
13
|
-
X-Content-Type-Options: nosniff
|
14
|
-
X-Download-Options: noopen
|
15
|
-
X-Frame-Options: DENY
|
16
|
-
X-Permitted-Cross-Domain-Policies: none
|
17
|
-
X-XSS-Protection: 1; mode=block
|
18
|
-
Strict-Transport-Security: max-age=31536000
|
19
|
-
|
20
|
-
{"data":[{"id":100,"domain_id":1,"domain_name":"example.com","user_id":999,"user_email":"existing-user@example.com","invitation":false,"created_at":"2016-10-07T08:53:41Z","updated_at":"2016-10-07T08:53:41Z","accepted_at":"2016-10-07T08:53:41Z"},{"id":101,"domain_id":1,"domain_name":"example.com","user_id":null,"user_email":"invited-user@example.com","invitation":true,"created_at":"2016-10-07T08:51:12Z","updated_at":"2016-10-07T08:51:12Z","accepted_at":null}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
HTTP/1.1 404 Not Found
|
2
|
-
Server: nginx
|
3
|
-
Date: Mon, 21 Nov 2016 09:32:48 GMT
|
4
|
-
Content-Type: application/json; charset=utf-8
|
5
|
-
Connection: keep-alive
|
6
|
-
Cache-Control: no-cache
|
7
|
-
X-Request-Id: 3e76b10b-412c-42ef-87d1-f8ff327df997
|
8
|
-
X-Runtime: 0.030250
|
9
|
-
X-Content-Type-Options: nosniff
|
10
|
-
X-Download-Options: noopen
|
11
|
-
X-Frame-Options: DENY
|
12
|
-
X-Permitted-Cross-Domain-Policies: none
|
13
|
-
X-XSS-Protection: 1; mode=block
|
14
|
-
|
15
|
-
{"message":"Membership `0` not found"}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
HTTP/1.1 204 No Content
|
2
|
-
Server: nginx
|
3
|
-
Date: Fri, 07 Oct 2016 09:08:51 GMT
|
4
|
-
Connection: keep-alive
|
5
|
-
X-RateLimit-Limit: 2400
|
6
|
-
X-RateLimit-Remaining: 2395
|
7
|
-
X-RateLimit-Reset: 1475833773
|
8
|
-
Cache-Control: no-cache
|
9
|
-
X-Request-Id: 732cdd0a-9ae5-4853-93ef-3511652b687a
|
10
|
-
X-Runtime: 0.098437
|
11
|
-
X-Content-Type-Options: nosniff
|
12
|
-
X-Download-Options: noopen
|
13
|
-
X-Frame-Options: DENY
|
14
|
-
X-Permitted-Cross-Domain-Policies: none
|
15
|
-
X-XSS-Protection: 1; mode=block
|
16
|
-
Strict-Transport-Security: max-age=31536000
|
17
|
-
|