dnsimple 9.0.1 → 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 +4 -4
- 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 +9 -0
- data/Gemfile +7 -7
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- 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
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".oauth" do
|
6
6
|
|
@@ -23,7 +23,7 @@ describe Dnsimple::Client, ".oauth" do
|
|
23
23
|
|
24
24
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
|
25
25
|
.with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, grant_type: "authorization_code" })
|
26
|
-
.with(headers: {
|
26
|
+
.with(headers: { "Accept" => "application/json" })
|
27
27
|
end
|
28
28
|
|
29
29
|
it "returns oauth token" do
|
@@ -43,7 +43,7 @@ describe Dnsimple::Client, ".oauth" do
|
|
43
43
|
|
44
44
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/oauth/access_token")
|
45
45
|
.with(body: { client_id: client_id, client_secret: client_secret, code: code, state: state, redirect_uri: redirect_uri, grant_type: "authorization_code" })
|
46
|
-
.with(headers: {
|
46
|
+
.with(headers: { "Accept" => "application/json" })
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".registrar" do
|
6
6
|
|
@@ -20,7 +20,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
20
20
|
subject.enable_auto_renewal(account_id, domain_id)
|
21
21
|
|
22
22
|
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal")
|
23
|
-
.with(headers: {
|
23
|
+
.with(headers: { "Accept" => "application/json" })
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns nothing" do
|
@@ -57,7 +57,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
57
57
|
subject.disable_auto_renewal(account_id, domain_id)
|
58
58
|
|
59
59
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/auto_renewal")
|
60
|
-
.with(headers: {
|
60
|
+
.with(headers: { "Accept" => "application/json" })
|
61
61
|
end
|
62
62
|
|
63
63
|
it "returns nothing" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".registrar" do
|
6
6
|
subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").registrar }
|
@@ -18,7 +18,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
18
18
|
subject.get_domain_transfer_lock(account_id, domain_id)
|
19
19
|
|
20
20
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
|
21
|
-
.with(headers: {
|
21
|
+
.with(headers: { "Accept" => "application/json" })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns the transfer lock state" do
|
@@ -55,7 +55,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
55
55
|
subject.enable_domain_transfer_lock(account_id, domain_id)
|
56
56
|
|
57
57
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
|
58
|
-
.with(headers: {
|
58
|
+
.with(headers: { "Accept" => "application/json" })
|
59
59
|
end
|
60
60
|
|
61
61
|
it "returns the transfer lock state" do
|
@@ -92,7 +92,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
92
92
|
subject.disable_domain_transfer_lock(account_id, domain_id)
|
93
93
|
|
94
94
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_id}/transfer_lock")
|
95
|
-
.with(headers: {
|
95
|
+
.with(headers: { "Accept" => "application/json" })
|
96
96
|
end
|
97
97
|
|
98
98
|
it "returns the transfer lock state" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".services" do
|
6
6
|
|
@@ -9,7 +9,7 @@ describe Dnsimple::Client, ".services" do
|
|
9
9
|
|
10
10
|
describe "#applied_services" do
|
11
11
|
let(:account_id) { 1010 }
|
12
|
-
let(:domain_id) {
|
12
|
+
let(:domain_id) { "example.com" }
|
13
13
|
|
14
14
|
before do
|
15
15
|
stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/services})
|
@@ -74,7 +74,7 @@ describe Dnsimple::Client, ".services" do
|
|
74
74
|
|
75
75
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
76
76
|
.with(body: settings)
|
77
|
-
.with(headers: {
|
77
|
+
.with(headers: { "Accept" => "application/json" })
|
78
78
|
end
|
79
79
|
|
80
80
|
it "returns empty response" do
|
@@ -100,7 +100,7 @@ describe Dnsimple::Client, ".services" do
|
|
100
100
|
subject.unapply_service(account_id, service_id, domain_id)
|
101
101
|
|
102
102
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/services/#{service_id}")
|
103
|
-
.with(headers: {
|
103
|
+
.with(headers: { "Accept" => "application/json" })
|
104
104
|
end
|
105
105
|
|
106
106
|
it "returns empty response" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".templates" do
|
6
6
|
|
@@ -10,7 +10,7 @@ describe Dnsimple::Client, ".templates" do
|
|
10
10
|
describe "#apply_template" do
|
11
11
|
let(:account_id) { 1010 }
|
12
12
|
let(:template_id) { 5410 }
|
13
|
-
let(:domain_id) {
|
13
|
+
let(:domain_id) { "example.com" }
|
14
14
|
|
15
15
|
before do
|
16
16
|
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".templates" do
|
6
6
|
|
@@ -92,7 +92,7 @@ describe Dnsimple::Client, ".templates" do
|
|
92
92
|
|
93
93
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records")
|
94
94
|
.with(body: attributes)
|
95
|
-
.with(headers: {
|
95
|
+
.with(headers: { "Accept" => "application/json" })
|
96
96
|
end
|
97
97
|
|
98
98
|
it "returns the record" do
|
@@ -157,7 +157,7 @@ describe Dnsimple::Client, ".templates" do
|
|
157
157
|
subject.record(account_id, template_id, record_id = 301)
|
158
158
|
|
159
159
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}")
|
160
|
-
.with(headers: {
|
160
|
+
.with(headers: { "Accept" => "application/json" })
|
161
161
|
end
|
162
162
|
|
163
163
|
it "returns the record" do
|
@@ -191,7 +191,7 @@ describe Dnsimple::Client, ".templates" do
|
|
191
191
|
subject.delete_record(account_id, template_id, record_id = 301)
|
192
192
|
|
193
193
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/templates/#{template_id}/records/#{record_id}")
|
194
|
-
.with(headers: {
|
194
|
+
.with(headers: { "Accept" => "application/json" })
|
195
195
|
end
|
196
196
|
|
197
197
|
it "returns nothing" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".templates" do
|
6
6
|
|
@@ -194,7 +194,7 @@ describe Dnsimple::Client, ".templates" do
|
|
194
194
|
describe "#apply_template" do
|
195
195
|
let(:account_id) { 1010 }
|
196
196
|
let(:template_id) { 5410 }
|
197
|
-
let(:domain_id) {
|
197
|
+
let(:domain_id) { "example.com" }
|
198
198
|
|
199
199
|
before do
|
200
200
|
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/templates/#{template_id}$})
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".tlds" do
|
6
6
|
subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").tlds }
|
@@ -15,7 +15,7 @@ describe Dnsimple::Client, ".tlds" do
|
|
15
15
|
subject.list_tlds
|
16
16
|
|
17
17
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds")
|
18
|
-
.with(headers: {
|
18
|
+
.with(headers: { "Accept" => "application/json" })
|
19
19
|
end
|
20
20
|
|
21
21
|
it "supports pagination" do
|
@@ -89,7 +89,7 @@ describe Dnsimple::Client, ".tlds" do
|
|
89
89
|
subject.tld(tld = "com")
|
90
90
|
|
91
91
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}")
|
92
|
-
.with(headers: {
|
92
|
+
.with(headers: { "Accept" => "application/json" })
|
93
93
|
end
|
94
94
|
|
95
95
|
it "returns the tld" do
|
@@ -98,7 +98,7 @@ describe Dnsimple::Client, ".tlds" do
|
|
98
98
|
|
99
99
|
result = response.data
|
100
100
|
expect(result).to be_a(Dnsimple::Struct::Tld)
|
101
|
-
expect(result.tld).to eq(
|
101
|
+
expect(result.tld).to eq("com")
|
102
102
|
expect(result.tld_type).to eq(1)
|
103
103
|
expect(result.whois_privacy).to be(true)
|
104
104
|
expect(result.auto_renew_only).to be(false)
|
@@ -121,7 +121,7 @@ describe Dnsimple::Client, ".tlds" do
|
|
121
121
|
subject.tld_extended_attributes(tld = "uk")
|
122
122
|
|
123
123
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/tlds/#{tld}/extended_attributes")
|
124
|
-
.with(headers: {
|
124
|
+
.with(headers: { "Accept" => "application/json" })
|
125
125
|
end
|
126
126
|
|
127
127
|
it "returns the extended attributes" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".webhooks" do
|
6
6
|
|
@@ -18,7 +18,7 @@ describe Dnsimple::Client, ".webhooks" do
|
|
18
18
|
subject.webhooks(account_id)
|
19
19
|
|
20
20
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks")
|
21
|
-
.with(headers: {
|
21
|
+
.with(headers: { "Accept" => "application/json" })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "supports extra request options" do
|
@@ -62,7 +62,7 @@ describe Dnsimple::Client, ".webhooks" do
|
|
62
62
|
|
63
63
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/webhooks")
|
64
64
|
.with(body: attributes)
|
65
|
-
.with(headers: {
|
65
|
+
.with(headers: { "Accept" => "application/json" })
|
66
66
|
end
|
67
67
|
|
68
68
|
it "returns the webhook" do
|
@@ -87,7 +87,7 @@ describe Dnsimple::Client, ".webhooks" do
|
|
87
87
|
subject.webhook(account_id, webhook_id = "1")
|
88
88
|
|
89
89
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}")
|
90
|
-
.with(headers: {
|
90
|
+
.with(headers: { "Accept" => "application/json" })
|
91
91
|
end
|
92
92
|
|
93
93
|
it "returns the webhook" do
|
@@ -124,7 +124,7 @@ describe Dnsimple::Client, ".webhooks" do
|
|
124
124
|
subject.delete_webhook(account_id, webhook_id = "1")
|
125
125
|
|
126
126
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/webhooks/#{webhook_id}")
|
127
|
-
.with(headers: {
|
127
|
+
.with(headers: { "Accept" => "application/json" })
|
128
128
|
end
|
129
129
|
|
130
130
|
it "returns nothing" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".zones" do
|
6
6
|
|
@@ -18,7 +18,7 @@ describe Dnsimple::Client, ".zones" do
|
|
18
18
|
subject.zone_distribution(account_id, zone = "example.com")
|
19
19
|
|
20
20
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/distribution")
|
21
|
-
.with(headers: {
|
21
|
+
.with(headers: { "Accept" => "application/json" })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "returns the zone distribution check with true when the zone is fully distributed" do
|
@@ -78,7 +78,7 @@ describe Dnsimple::Client, ".zones" do
|
|
78
78
|
subject.zone_record_distribution(account_id, zone_id, record_id)
|
79
79
|
|
80
80
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records/#{record_id}/distribution")
|
81
|
-
.with(headers: {
|
81
|
+
.with(headers: { "Accept" => "application/json" })
|
82
82
|
end
|
83
83
|
|
84
84
|
it "returns the zone record distribution check with true when the zone is fully distributed" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".zones" do
|
6
6
|
|
@@ -20,7 +20,7 @@ describe Dnsimple::Client, ".zones" do
|
|
20
20
|
subject.list_zone_records(account_id, zone_id)
|
21
21
|
|
22
22
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records")
|
23
|
-
.with(headers: {
|
23
|
+
.with(headers: { "Accept" => "application/json" })
|
24
24
|
end
|
25
25
|
|
26
26
|
it "supports pagination" do
|
@@ -126,7 +126,7 @@ describe Dnsimple::Client, ".zones" do
|
|
126
126
|
|
127
127
|
expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records")
|
128
128
|
.with(body: attributes)
|
129
|
-
.with(headers: {
|
129
|
+
.with(headers: { "Accept" => "application/json" })
|
130
130
|
end
|
131
131
|
|
132
132
|
it "returns the record" do
|
@@ -168,7 +168,7 @@ describe Dnsimple::Client, ".zones" do
|
|
168
168
|
subject.zone_record(account_id, zone_id, record_id)
|
169
169
|
|
170
170
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records/#{record_id}")
|
171
|
-
.with(headers: {
|
171
|
+
.with(headers: { "Accept" => "application/json" })
|
172
172
|
end
|
173
173
|
|
174
174
|
it "returns the record" do
|
@@ -216,7 +216,7 @@ describe Dnsimple::Client, ".zones" do
|
|
216
216
|
|
217
217
|
describe "#update_zone_record" do
|
218
218
|
let(:account_id) { 1010 }
|
219
|
-
let(:attributes) { { content: "mxb.example.com", priority: "20", regions: [
|
219
|
+
let(:attributes) { { content: "mxb.example.com", priority: "20", regions: ["global"] } }
|
220
220
|
let(:zone_id) { "example.com" }
|
221
221
|
let(:record_id) { 5 }
|
222
222
|
|
@@ -231,7 +231,7 @@ describe Dnsimple::Client, ".zones" do
|
|
231
231
|
|
232
232
|
expect(WebMock).to have_requested(:patch, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records/#{record_id}")
|
233
233
|
.with(body: attributes)
|
234
|
-
.with(headers: {
|
234
|
+
.with(headers: { "Accept" => "application/json" })
|
235
235
|
end
|
236
236
|
|
237
237
|
it "returns the record" do
|
@@ -282,7 +282,7 @@ describe Dnsimple::Client, ".zones" do
|
|
282
282
|
subject.delete_zone_record(account_id, zone_id, record_id = 2)
|
283
283
|
|
284
284
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone_id}/records/#{record_id}")
|
285
|
-
.with(headers: {
|
285
|
+
.with(headers: { "Accept" => "application/json" })
|
286
286
|
end
|
287
287
|
|
288
288
|
it "returns nothing" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client, ".zones" do
|
6
6
|
subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").zones }
|
@@ -18,7 +18,7 @@ describe Dnsimple::Client, ".zones" do
|
|
18
18
|
subject.zones(account_id)
|
19
19
|
|
20
20
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones")
|
21
|
-
.with(headers: {
|
21
|
+
.with(headers: { "Accept" => "application/json" })
|
22
22
|
end
|
23
23
|
|
24
24
|
it "supports pagination" do
|
@@ -107,7 +107,7 @@ describe Dnsimple::Client, ".zones" do
|
|
107
107
|
subject.zone(account_id, zone = "example.com")
|
108
108
|
|
109
109
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}")
|
110
|
-
.with(headers: {
|
110
|
+
.with(headers: { "Accept" => "application/json" })
|
111
111
|
end
|
112
112
|
|
113
113
|
it "returns the zone" do
|
@@ -151,7 +151,7 @@ describe Dnsimple::Client, ".zones" do
|
|
151
151
|
subject.zone_file(account_id, zone = "example.com")
|
152
152
|
|
153
153
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/file")
|
154
|
-
.with(headers: {
|
154
|
+
.with(headers: { "Accept" => "application/json" })
|
155
155
|
end
|
156
156
|
|
157
157
|
it "returns the zone id" do
|
@@ -187,7 +187,7 @@ describe Dnsimple::Client, ".zones" do
|
|
187
187
|
subject.activate_dns(account_id, zone = "example.com")
|
188
188
|
|
189
189
|
expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/activation")
|
190
|
-
.with(headers: {
|
190
|
+
.with(headers: { "Accept" => "application/json" })
|
191
191
|
end
|
192
192
|
|
193
193
|
it "returns the zone" do
|
@@ -229,7 +229,7 @@ describe Dnsimple::Client, ".zones" do
|
|
229
229
|
subject.deactivate_dns(account_id, zone = "example.com")
|
230
230
|
|
231
231
|
expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/activation")
|
232
|
-
.with(headers: {
|
232
|
+
.with(headers: { "Accept" => "application/json" })
|
233
233
|
end
|
234
234
|
|
235
235
|
it "returns the zone" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
describe Dnsimple::Client do
|
6
6
|
|
@@ -135,11 +135,11 @@ describe Dnsimple::Client do
|
|
135
135
|
it "performs a request" do
|
136
136
|
stub_request(:get, %r{/foo})
|
137
137
|
|
138
|
-
subject.request(:get,
|
138
|
+
subject.request(:get, "foo", {})
|
139
139
|
|
140
140
|
expect(WebMock).to have_requested(:get, "https://api.dnsimple.com/foo")
|
141
141
|
.with(basic_auth: %w[user pass],
|
142
|
-
headers: {
|
142
|
+
headers: { "Accept" => "application/json", "User-Agent" => Dnsimple::Default::USER_AGENT })
|
143
143
|
end
|
144
144
|
|
145
145
|
it "delegates to HTTParty" do
|
@@ -150,11 +150,11 @@ describe Dnsimple::Client do
|
|
150
150
|
"#{subject.base_url}foo", {
|
151
151
|
format: :json,
|
152
152
|
basic_auth: { username: "user", password: "pass" },
|
153
|
-
headers: {
|
153
|
+
headers: { "Accept" => "application/json", "User-Agent" => Dnsimple::Default::USER_AGENT },
|
154
154
|
}
|
155
155
|
)
|
156
156
|
|
157
|
-
subject.request(:get,
|
157
|
+
subject.request(:get, "foo")
|
158
158
|
end
|
159
159
|
|
160
160
|
it "properly extracts processes options and encodes data" do
|
@@ -165,12 +165,12 @@ describe Dnsimple::Client do
|
|
165
165
|
body: JSON.dump(something: "else"),
|
166
166
|
query: { foo: "bar" },
|
167
167
|
basic_auth: { username: "user", password: "pass" },
|
168
|
-
headers: {
|
168
|
+
headers: { "Accept" => "application/json", "Content-Type" => "application/json", "User-Agent" => Dnsimple::Default::USER_AGENT, "Custom" => "Header" },
|
169
169
|
}
|
170
170
|
)
|
171
171
|
|
172
172
|
expect {
|
173
|
-
subject.request(:put,
|
173
|
+
subject.request(:put, "foo", { something: "else" }, { query: { foo: "bar" }, headers: { "Custom" => "Header" } })
|
174
174
|
}.not_to raise_error
|
175
175
|
end
|
176
176
|
|
@@ -181,12 +181,12 @@ describe Dnsimple::Client do
|
|
181
181
|
format: :json,
|
182
182
|
body: { something: "else" },
|
183
183
|
basic_auth: { username: "user", password: "pass" },
|
184
|
-
headers: {
|
184
|
+
headers: { "Accept" => "application/json", "Content-Type" => "application/x-www-form-urlencoded", "User-Agent" => Dnsimple::Default::USER_AGENT },
|
185
185
|
}
|
186
186
|
)
|
187
187
|
|
188
188
|
expect {
|
189
|
-
subject.request(:post,
|
189
|
+
subject.request(:post, "foo", { something: "else" }, { headers: { "Content-Type" => "application/x-www-form-urlencoded" } })
|
190
190
|
}.not_to raise_error
|
191
191
|
end
|
192
192
|
|
@@ -197,7 +197,7 @@ describe Dnsimple::Client do
|
|
197
197
|
format: :json,
|
198
198
|
http_proxyaddr: "example-proxy.com",
|
199
199
|
http_proxyport: "4321",
|
200
|
-
headers: {
|
200
|
+
headers: { "Accept" => "application/json", "User-Agent" => Dnsimple::Default::USER_AGENT },
|
201
201
|
}
|
202
202
|
)
|
203
203
|
|
data/spec/dnsimple/extra_spec.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "spec_helper"
|
4
4
|
|
5
5
|
RSpec.describe Dnsimple::Options::Base do
|
6
|
-
describe
|
7
|
-
it
|
6
|
+
describe "#initialize" do
|
7
|
+
it "accepts a hash" do
|
8
8
|
hash = { a: 1 }
|
9
9
|
expect(described_class.new(hash).to_h).to eq(hash)
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
12
|
+
it "accepts nil" do
|
13
13
|
expect(described_class.new(nil).to_h).to eq({})
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
16
|
+
it "duplicates given hash" do
|
17
17
|
hash = { a: [1] }
|
18
18
|
base = described_class.new(hash)
|
19
19
|
base.to_h[:a] << 2
|