dnsimple 10.0.0 → 11.1.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 +15 -31
- data/CHANGELOG.md +9 -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/zones_records.rb +33 -0
- 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/zone_record_id.rb +12 -0
- data/lib/dnsimple/struct/zone_records_batch_change.rb +18 -0
- data/lib/dnsimple/struct.rb +42 -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 +7 -7
- 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 +102 -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/batchChangeZoneRecords/error_400_create_validation_failed.http +16 -0
- data/spec/fixtures.http/batchChangeZoneRecords/error_400_delete_validation_failed.http +15 -0
- data/spec/fixtures.http/batchChangeZoneRecords/error_400_update_validation_failed.http +15 -0
- data/spec/fixtures.http/batchChangeZoneRecords/success.http +16 -0
- 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 +15 -13
- 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 +14 -12
- 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 +14 -12
- 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
- /data/spec/fixtures.http/{notfound-delegationsignerrecord.http → notfound-delegationSignerRecord.http} +0 -0
@@ -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
|
-
|
File without changes
|