dnsimple 8.3.1 → 8.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d47bee5f7278d2aab4a2faa9b88121cbec92c510f6bbb807d5d0dd973429e360
4
- data.tar.gz: abf2e8a9fe7a3613fbb3a80bcf375065f7a804fabd8369b1ec91760d8749e6c3
3
+ metadata.gz: 34867970ac25f062a88e64df5c8ffc1a4cebb69612aea702cf6075ca79a9f9e7
4
+ data.tar.gz: 79ffa15c0875466c11c175feeda98df3467ddeb0b2229c16aa6c92aecf1e0a39
5
5
  SHA512:
6
- metadata.gz: a2bbab24f39ead5c46bb0657bae0d67c2a98e0a5648d45baf9f4a03d497c2a38bb677ffde8f039b1fe6fc380c731376c948211927ddb94c969027ed89dafb828
7
- data.tar.gz: f041d09f3b51854c802af60219e2713a3f42544dca0efc2b3cd28f179c8f225d52c4ae46b8aeb6ae18c67a6bdadfee8c3ab84096da1d6f33c850e2ec7636c16b
6
+ metadata.gz: d7d71422305173c73b5dc948ffaf006d76b651697afc072b90e494dd9051c90424409ad7f16366bbec4ea5992fadcad6463c133c7b0ef522bbabe03c6b78f766
7
+ data.tar.gz: 980c1e8c59db95933ab3d6e95eea871fcaaf9234b4866efbfc105c7da2fb841097a8e9aec2deb467d3ca1a6a7e9db79bcaed9b3851c6da4429c5799e3ded2a92
@@ -5,7 +5,6 @@ updates:
5
5
  directory: /
6
6
  schedule:
7
7
  interval: monthly
8
- time: '12:00'
9
8
  open-pull-requests-limit: 10
10
9
  labels:
11
10
  - task
@@ -18,22 +18,13 @@ jobs:
18
18
  - name: Checkout Code
19
19
  uses: actions/checkout@v3
20
20
  - name: Run markdownlint-cli
21
- uses: nosborn/github-action-markdown-cli@v3.2.0
21
+ uses: nosborn/github-action-markdown-cli@v3.3.0
22
22
  with:
23
23
  files: .
24
24
  config_file: ".markdownlint.yaml"
25
25
 
26
- yamllint:
27
- name: Lint YAML
28
- runs-on: ubuntu-latest
29
- steps:
30
- - name: Checkout Code
31
- uses: actions/checkout@v3
32
- - name: Run YAML Lint
33
- uses: actionshub/yamllint@main
34
-
35
26
  test:
36
- needs: [markdownlint-cli, yamllint]
27
+ needs: [markdownlint-cli]
37
28
  runs-on: ubuntu-latest
38
29
  name: Ruby ${{ matrix.ruby-version }}
39
30
  strategy:
data/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
  ## main
6
6
 
7
+ ## 8.4.0
8
+
9
+ FEATURES:
10
+
11
+ - NEW: Added `Dnsimple::Client::Zones#activate_dns` to activate DNS services (resolution) for a zone. (dnsimple/dnsimple-ruby#354)
12
+ - NEW: Added `Dnsimple::Client::Zones#deactivate_dns` to deactivate DNS services (resolution) for a zone. (dnsimple/dnsimple-ruby#354)
13
+
7
14
  ## 8.3.1
8
15
 
9
16
  - FIXED: Our release process had failed to push correctly `8.2.0` and `8.3.0` to RubyGems resulting in empty gem releases. This releases fixes the issue and contains the same changes of `8.2.0` and `8.3.0`.
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  gem 'coveralls', require: false
8
- gem 'rubocop', '1.48.0', require: false
9
- gem 'rubocop-performance', '1.16.0', require: false
8
+ gem 'rubocop', '1.55.1', require: false
9
+ gem 'rubocop-performance', '1.18.0', require: false
10
10
  gem 'rubocop-rake', '0.6.0', require: false
11
- gem 'rubocop-rspec', '2.19.0', require: false
11
+ gem 'rubocop-rspec', '2.23.0', require: false
data/README.md CHANGED
@@ -23,7 +23,7 @@ gem install dnsimple
23
23
  Or use Bundler and define it as a dependency in your Gemfile:
24
24
 
25
25
  ```ruby
26
- gem 'dnsimple', '~> 6.0'
26
+ gem 'dnsimple', '~> 8.0'
27
27
  ```
28
28
 
29
29
  ## Documentation
@@ -110,4 +110,4 @@ puts response.data
110
110
 
111
111
  ## License
112
112
 
113
- Copyright (c) 2010-2022 DNSimple Corporation. This is Free Software distributed under the MIT license.
113
+ Copyright (c) 2010-2023 DNSimple Corporation. This is Free Software distributed under the MIT license.
@@ -95,6 +95,40 @@ module Dnsimple
95
95
  Dnsimple::Response.new(response, Struct::ZoneFile.new(response["data"]))
96
96
  end
97
97
 
98
+ # Activate DNS resolution for the zone in the account.
99
+ #
100
+ # @see https://developer.dnsimple.com/v2/zones/#activateZoneService
101
+ #
102
+ # @param [#to_s] account_id the account ID
103
+ # @param [#to_s] zone_id the zone name
104
+ # @param [Hash] options
105
+ # @return [Dnsimple::Response<Dnsimple::Struct::Zone>]
106
+ #
107
+ # @raise [Dnsimple::NotFoundError]
108
+ # @raise [Dnsimple::RequestError]
109
+ def activate_dns(account_id, zone_id, options = {})
110
+ response = client.put(Client.versioned("/%s/zones/%s/activation" % [account_id, zone_id]), options)
111
+
112
+ Dnsimple::Response.new(response, Struct::Zone.new(response["data"]))
113
+ end
114
+
115
+ # Deactivate DNS resolution for the zone in the account.
116
+ #
117
+ # @see https://developer.dnsimple.com/v2/zones/#deactivateZoneService
118
+ #
119
+ # @param [#to_s] account_id the account ID
120
+ # @param [#to_s] zone_id the zone name
121
+ # @param [Hash] options
122
+ # @return [Dnsimple::Response<Dnsimple::Struct::Zone>]
123
+ #
124
+ # @raise [Dnsimple::NotFoundError]
125
+ # @raise [Dnsimple::RequestError]
126
+ def deactivate_dns(account_id, zone_id, options = {})
127
+ response = client.delete(Client.versioned("/%s/zones/%s/activation" % [account_id, zone_id]), options)
128
+
129
+ Dnsimple::Response.new(response, Struct::Zone.new(response["data"]))
130
+ end
131
+
98
132
  end
99
133
  end
100
134
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dnsimple
4
- VERSION = "8.3.1"
4
+ VERSION = "8.4.0"
5
5
  end
@@ -3,7 +3,6 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Dnsimple::Client, ".zones" do
6
-
7
6
  subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").zones }
8
7
 
9
8
 
@@ -173,4 +172,85 @@ describe Dnsimple::Client, ".zones" do
173
172
  end
174
173
  end
175
174
 
175
+ describe "#activate_dns" do
176
+ let(:account_id) { 1010 }
177
+
178
+ before do
179
+ stub_request(:put, %r{/v2/#{account_id}/zones/.+/activation})
180
+ .to_return(read_http_fixture("activateZoneService/success.http"))
181
+ end
182
+
183
+ it "builds the correct request" do
184
+ subject.activate_dns(account_id, zone = "example.com")
185
+
186
+ expect(WebMock).to have_requested(:put, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/activation")
187
+ .with(headers: { 'Accept' => 'application/json' })
188
+ end
189
+
190
+ it "returns the zone" do
191
+ response = subject.activate_dns(account_id, "example.com")
192
+ expect(response).to be_a(Dnsimple::Response)
193
+
194
+ result = response.data
195
+ expect(result).to be_a(Dnsimple::Struct::Zone)
196
+ expect(result.id).to eq(1)
197
+ expect(result.account_id).to eq(1010)
198
+ expect(result.name).to eq("example.com")
199
+ expect(result.reverse).to be(false)
200
+ expect(result.created_at).to eq("2022-09-28T04:45:24Z")
201
+ expect(result.updated_at).to eq("2023-07-06T11:19:48Z")
202
+ end
203
+
204
+ context "when the zone does not exist" do
205
+ it "raises NotFoundError" do
206
+ stub_request(:put, %r{/v2})
207
+ .to_return(read_http_fixture("notfound-zone.http"))
208
+
209
+ expect {
210
+ subject.activate_dns(account_id, "example.com")
211
+ }.to raise_error(Dnsimple::NotFoundError)
212
+ end
213
+ end
214
+ end
215
+
216
+ describe "#deactivate_dns" do
217
+ let(:account_id) { 1010 }
218
+
219
+ before do
220
+ stub_request(:delete, %r{/v2/#{account_id}/zones/.+/activation})
221
+ .to_return(read_http_fixture("deactivateZoneService/success.http"))
222
+ end
223
+
224
+ it "builds the correct request" do
225
+ subject.deactivate_dns(account_id, zone = "example.com")
226
+
227
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/zones/#{zone}/activation")
228
+ .with(headers: { 'Accept' => 'application/json' })
229
+ end
230
+
231
+ it "returns the zone" do
232
+ response = subject.deactivate_dns(account_id, "example.com")
233
+ expect(response).to be_a(Dnsimple::Response)
234
+
235
+ result = response.data
236
+ expect(result).to be_a(Dnsimple::Struct::Zone)
237
+ expect(result.id).to eq(1)
238
+ expect(result.account_id).to eq(1010)
239
+ expect(result.name).to eq("example.com")
240
+ expect(result.reverse).to be(false)
241
+ expect(result.created_at).to eq("2022-09-28T04:45:24Z")
242
+ expect(result.updated_at).to eq("2023-08-08T04:19:52Z")
243
+ end
244
+
245
+ context "when the zone does not exist" do
246
+ it "raises NotFoundError" do
247
+ stub_request(:delete, %r{/v2})
248
+ .to_return(read_http_fixture("notfound-zone.http"))
249
+
250
+ expect {
251
+ subject.deactivate_dns(account_id, "example.com")
252
+ }.to raise_error(Dnsimple::NotFoundError)
253
+ end
254
+ end
255
+ end
176
256
  end
@@ -0,0 +1,16 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Tue, 08 Aug 2023 04:19:23 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Connection: keep-alive
6
+ X-RateLimit-Limit: 2400
7
+ X-RateLimit-Remaining: 2399
8
+ X-RateLimit-Reset: 1691471963
9
+ X-WORK-WITH-US: Love automation? So do we! https://dnsimple.com/jobs
10
+ ETag: W/"fe6afd982459be33146933235343d51d"
11
+ Cache-Control: max-age=0, private, must-revalidate
12
+ X-Request-Id: 8e8ac535-9f46-4304-8440-8c68c30427c3
13
+ X-Runtime: 0.176579
14
+ Strict-Transport-Security: max-age=63072000
15
+
16
+ {"data":{"id":1,"account_id":1010,"name":"example.com","reverse":false,"secondary":false,"last_transferred_at":null,"active":true,"created_at":"2022-09-28T04:45:24Z","updated_at":"2023-07-06T11:19:48Z"}}
@@ -0,0 +1,16 @@
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Tue, 08 Aug 2023 04:19:52 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: 1691471962
9
+ X-WORK-WITH-US: Love automation? So do we! https://dnsimple.com/jobs
10
+ ETag: W/"5f30a37d01b99bb9e620ef1bbce9a014"
11
+ Cache-Control: max-age=0, private, must-revalidate
12
+ X-Request-Id: d2f7bba4-4c81-4818-81d2-c9bbe95f104e
13
+ X-Runtime: 0.133278
14
+ Strict-Transport-Security: max-age=63072000
15
+
16
+ {"data":{"id":1,"account_id":1010,"name":"example.com","reverse":false,"secondary":false,"last_transferred_at":null,"active":false,"created_at":"2022-09-28T04:45:24Z","updated_at":"2023-08-08T04:19:52Z"}}
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: 8.3.1
4
+ version: 8.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DNSimple
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-10 00:00:00.000000000 Z
11
+ date: 2023-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -99,7 +99,6 @@ files:
99
99
  - ".rubocop.yml"
100
100
  - ".rubocop_dnsimple.yml"
101
101
  - ".rubocop_todo.yml"
102
- - ".yamllint.yml"
103
102
  - CHANGELOG.md
104
103
  - CONTRIBUTING.md
105
104
  - Gemfile
@@ -212,6 +211,7 @@ files:
212
211
  - spec/fixtures.http/acceptPush/success.http
213
212
  - spec/fixtures.http/accounts/success-account.http
214
213
  - spec/fixtures.http/accounts/success-user.http
214
+ - spec/fixtures.http/activateZoneService/success.http
215
215
  - spec/fixtures.http/addCollaborator/invite-success.http
216
216
  - spec/fixtures.http/addCollaborator/success.http
217
217
  - spec/fixtures.http/appliedServices/success.http
@@ -245,6 +245,7 @@ files:
245
245
  - spec/fixtures.http/createWebhook/created.http
246
246
  - spec/fixtures.http/createZoneRecord/created-apex.http
247
247
  - spec/fixtures.http/createZoneRecord/created.http
248
+ - spec/fixtures.http/deactivateZoneService/success.http
248
249
  - spec/fixtures.http/deleteContact/error-contact-in-use.http
249
250
  - spec/fixtures.http/deleteContact/success.http
250
251
  - spec/fixtures.http/deleteDelegationSignerRecord/success.http
@@ -363,7 +364,7 @@ files:
363
364
  homepage: https://github.com/dnsimple/dnsimple-ruby
364
365
  licenses: []
365
366
  metadata: {}
366
- post_install_message:
367
+ post_install_message:
367
368
  rdoc_options: []
368
369
  require_paths:
369
370
  - lib
@@ -378,8 +379,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
378
379
  - !ruby/object:Gem::Version
379
380
  version: '0'
380
381
  requirements: []
381
- rubygems_version: 3.4.6
382
- signing_key:
382
+ rubygems_version: 3.4.10
383
+ signing_key:
383
384
  specification_version: 4
384
385
  summary: The DNSimple API client for Ruby
385
386
  test_files: []
data/.yamllint.yml DELETED
@@ -1,29 +0,0 @@
1
- ---
2
-
3
- extends: default
4
-
5
- rules:
6
- braces:
7
- level: warning
8
- max-spaces-inside: 1
9
- brackets:
10
- level: warning
11
- max-spaces-inside: 1
12
- colons:
13
- level: warning
14
- commas:
15
- level: warning
16
- comments: disable
17
- comments-indentation: disable
18
- document-start: disable
19
- empty-lines:
20
- level: warning
21
- hyphens:
22
- level: warning
23
- indentation:
24
- level: warning
25
- indent-sequences: consistent
26
- line-length:
27
- level: warning
28
- allow-non-breakable-inline-mappings: true
29
- truthy: disable