dnsimple 4.5.0 → 4.6.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: 49d2f2a2d0892e3ae7e31b563035cd668200f164a05fcde6b59b5fb497a123ee
4
- data.tar.gz: 572cf3a3277efb2cb55cd5f9a0fc644bfe4a356a2853846e6f3af37a3964e28e
3
+ metadata.gz: 6ccd26ac738f667185d2005071eb215045dcce8bdcaaf48ba5b1b31f9187bdcf
4
+ data.tar.gz: a8474bcd18275b39465931d06230fd07434a839a39dbfeead1e130289929f7a6
5
5
  SHA512:
6
- metadata.gz: 90c025c122e88a6408f57abf2ff564ea309e10af4e85c16c2e1d8b513b58cfb726514634abd00e746e98a966827df7082d16ec333d32cb5290c0711a2ac94bd4
7
- data.tar.gz: ba8db8d64adddf8d7aa04f66527eaa0fb00a6ed00be88c52c0a23d21b616ef0ef03a7850e83b0571f6be7d2e227915a4b755b58064136d199adce9b3b2ccf117
6
+ metadata.gz: bb079ccceb1587b61ce3d0660a9963dad812d01da3634d0581dc80095fb2157fc86a191d711590bfb8d85c48c9c47e47a6a30b7e6e14c107b50195894e552c67
7
+ data.tar.gz: e7a5735a36b36dca5dee66104d90c0bbdb83afa878a9e5423bcac5b46b965a5324e16ad6380cb9f8a51ee91d3df8baa3bff47633c750b9ce529d0a9ed62c0e78
@@ -1,21 +1,18 @@
1
1
  language: ruby
2
2
 
3
- sudo: false
4
-
5
3
  rvm:
6
4
  - 2.1
7
5
  - 2.2
8
6
  - 2.3
9
7
  - 2.4
10
8
  - 2.5
9
+ - 2.6
11
10
 
12
11
  env:
13
12
  - COVERALL=1
14
13
 
15
14
  before_install:
16
- - rvm get latest
17
- - gem update --system
18
- - gem install bundler
15
+ - gem install bundler -v 1.17.3
19
16
 
20
17
  notifications:
21
18
  slack:
@@ -3,6 +3,11 @@
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
 
6
+ ### 4.6.0
7
+
8
+ - NEW: Added WHOIS privacy renewal (GH-171)
9
+
10
+
6
11
  ### 4.5.0
7
12
 
8
13
  - NEW: Added zone distribution and zone record distribution (GH-160)
@@ -204,8 +204,8 @@ module Dnsimple
204
204
 
205
205
  def base_options
206
206
  {
207
- format: :json,
208
- headers: {
207
+ format: :json,
208
+ headers: {
209
209
  "Accept" => "application/json",
210
210
  },
211
211
  }
@@ -50,7 +50,7 @@ module Dnsimple
50
50
  # client.registrar.disable_whois_privacy(1010, "example.com")
51
51
  #
52
52
  # @param [Integer] account_id the account ID
53
- # @param [#to_s] domain_name The domain name to check.
53
+ # @param [#to_s] domain_name The domain name
54
54
  # @param [Hash] options
55
55
  # @return [Struct::WhoisPrivacy]
56
56
  #
@@ -62,6 +62,26 @@ module Dnsimple
62
62
  Dnsimple::Response.new(response, Struct::WhoisPrivacy.new(response["data"]))
63
63
  end
64
64
 
65
+ # Renews whois privacy for the domain.
66
+ #
67
+ # @see https://developer.dnsimple.com/v2/registrar/whois-privacy/#renew
68
+ #
69
+ # @example Renew whois privacy for "example.com":
70
+ # client.registrar.renew_whois_privacy(1010, "example.com")
71
+ #
72
+ # @param account_id [Integer] the account ID
73
+ # @param domain_name [#to_s] The domain name
74
+ # @param options [Hash]
75
+ # @return [Struct::WhoisPrivacy]
76
+ #
77
+ # @raise [RequestError] When the request fails.
78
+ def renew_whois_privacy(account_id, domain_name, options = {})
79
+ endpoint = whois_privacy_endpoint(account_id, domain_name) + "/renewals"
80
+ response = client.post(endpoint, nil, options)
81
+
82
+ Dnsimple::Response.new(response, Struct::WhoisPrivacyRenewal.new(response["data"]))
83
+ end
84
+
65
85
 
66
86
  private
67
87
 
@@ -40,6 +40,7 @@ require_relative 'struct/tld'
40
40
  require_relative 'struct/user'
41
41
  require_relative 'struct/vanity_name_server'
42
42
  require_relative 'struct/whois_privacy'
43
+ require_relative 'struct/whois_privacy_renewal'
43
44
  require_relative 'struct/zone'
44
45
  require_relative 'struct/zone_file'
45
46
  require_relative 'struct/zone_distribution'
@@ -0,0 +1,28 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class WhoisPrivacyRenewal < Base
5
+ # @return [Integer] The associated domain ID.
6
+ attr_accessor :domain_id
7
+
8
+ # @return [Integer] The associated WHOIS Privacy ID.
9
+ attr_accessor :whois_privacy_id
10
+
11
+ # @return [String] The WHOIS Privacy order state.
12
+ attr_accessor :state
13
+
14
+ # @return [Boolean] Whether the WHOIS Privacy is enabled for the domain.
15
+ attr_accessor :enabled
16
+
17
+ # @return [String] The date the WHOIS Privacy will expire on.
18
+ attr_accessor :expires_on
19
+
20
+ # @return [String] When the WHOIS Privacy was created in DNSimple.
21
+ attr_accessor :created_at
22
+
23
+ # @return [String] When the WHOIS Privacy was last updated in DNSimple.
24
+ attr_accessor :updated_at
25
+ end
26
+
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = "4.5.0".freeze
2
+ VERSION = "4.6.0".freeze
3
3
  end
@@ -116,4 +116,59 @@ describe Dnsimple::Client, ".registrar" do
116
116
  end
117
117
  end
118
118
 
119
+
120
+ describe "#renew_whois_privacy" do
121
+ let(:account_id) { 1010 }
122
+
123
+ before do
124
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$})
125
+ .to_return(read_http_fixture("renewWhoisPrivacy/success.http"))
126
+ end
127
+
128
+ it "builds the correct request" do
129
+ subject.renew_whois_privacy(account_id, domain_name = "example.com")
130
+
131
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/whois_privacy/renewals")
132
+ .with(headers: { "Accept" => "application/json" })
133
+ end
134
+
135
+ it "returns the whois privacy order" do
136
+ response = subject.renew_whois_privacy(account_id, "example.com")
137
+ expect(response).to be_a(Dnsimple::Response)
138
+
139
+ result = response.data
140
+ expect(result).to be_a(Dnsimple::Struct::WhoisPrivacyRenewal)
141
+ expect(result.domain_id).to be_kind_of(Integer)
142
+ expect(result.whois_privacy_id).to be_kind_of(Integer)
143
+ expect(result.enabled).to be(true)
144
+ expect(result.expires_on).to be_kind_of(String)
145
+ end
146
+
147
+ context "when whois privacy was't previously purchased" do
148
+ before do
149
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$})
150
+ .to_return(read_http_fixture("renewWhoisPrivacy/whois-privacy-not-found.http"))
151
+ end
152
+
153
+ it "raises error" do
154
+ expect do
155
+ subject.renew_whois_privacy(account_id, "example.com")
156
+ end.to raise_error(Dnsimple::RequestError, "WHOIS privacy not found for example.com")
157
+ end
158
+ end
159
+
160
+ context "when there is already a whois privacy renewal order in progress" do
161
+ before do
162
+ stub_request(:post, %r{/v2/#{account_id}/registrar/domains/.+/whois_privacy/renewals$})
163
+ .to_return(read_http_fixture("renewWhoisPrivacy/whois-privacy-duplicated-order.http"))
164
+ end
165
+
166
+ it "raises error" do
167
+ expect do
168
+ subject.renew_whois_privacy(account_id, "example.com")
169
+ end.to raise_error(Dnsimple::RequestError, "The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time")
170
+ end
171
+ end
172
+ end
173
+
119
174
  end
@@ -0,0 +1,21 @@
1
+ HTTP/1.1 201 Created
2
+ Server: nginx
3
+ Date: Thu, 10 Jan 2019 12:12:50 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Transfer-Encoding: chunked
6
+ Connection: keep-alive
7
+ X-RateLimit-Limit: 2400
8
+ X-RateLimit-Remaining: 2398
9
+ X-RateLimit-Reset: 1547125899
10
+ ETag: W/"e5bf5d90a6c95e5f1443dcbaf2cc27c6"
11
+ Cache-Control: max-age=0, private, must-revalidate
12
+ X-Request-Id: 6e80e830-21ae-46ea-9191-98811884808a
13
+ X-Runtime: 1.459325
14
+ X-Frame-Options: DENY
15
+ X-Content-Type-Options: nosniff
16
+ X-XSS-Protection: 1; mode=block
17
+ X-Download-Options: noopen
18
+ X-Permitted-Cross-Domain-Policies: none
19
+ Strict-Transport-Security: max-age=31536000
20
+
21
+ {"data":{"id":1,"domain_id":100,"whois_privacy_id":999,"state":"new","expires_on":"2020-01-10","enabled":true,"created_at":"2019-01-10T12:12:48Z","updated_at":"2019-01-10T12:12:48Z"}}
@@ -0,0 +1,19 @@
1
+ HTTP/1.1 400 Bad Request
2
+ Server: nginx
3
+ Date: Thu, 10 Jan 2019 12:13:21 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Transfer-Encoding: chunked
6
+ Connection: keep-alive
7
+ X-RateLimit-Limit: 2400
8
+ X-RateLimit-Remaining: 2397
9
+ X-RateLimit-Reset: 1547125899
10
+ Cache-Control: no-cache
11
+ X-Request-Id: 16cc92bb-fe38-434b-b483-602d77ac77d3
12
+ X-Runtime: 0.122201
13
+ X-Frame-Options: DENY
14
+ X-Content-Type-Options: nosniff
15
+ X-XSS-Protection: 1; mode=block
16
+ X-Download-Options: noopen
17
+ X-Permitted-Cross-Domain-Policies: none
18
+
19
+ {"message":"The whois privacy for example.com has just been renewed, a new renewal cannot be started at this time","errors":{}}
@@ -0,0 +1,19 @@
1
+ HTTP/1.1 400 Bad Request
2
+ Server: nginx
3
+ Date: Thu, 10 Jan 2019 12:11:39 GMT
4
+ Content-Type: application/json; charset=utf-8
5
+ Transfer-Encoding: chunked
6
+ Connection: keep-alive
7
+ X-RateLimit-Limit: 2400
8
+ X-RateLimit-Remaining: 2399
9
+ X-RateLimit-Reset: 1547125899
10
+ Cache-Control: no-cache
11
+ X-Request-Id: 2727b7c4-97af-4e22-9c7f-bd84e20f2dc1
12
+ X-Runtime: 0.139925
13
+ X-Frame-Options: DENY
14
+ X-Content-Type-Options: nosniff
15
+ X-XSS-Protection: 1; mode=block
16
+ X-Download-Options: noopen
17
+ X-Permitted-Cross-Domain-Policies: none
18
+
19
+ {"message":"WHOIS privacy not found for example.com","errors":{}}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Eden
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-10-16 00:00:00.000000000 Z
14
+ date: 2019-02-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
@@ -172,6 +172,7 @@ files:
172
172
  - lib/dnsimple/struct/webhook.rb
173
173
  - lib/dnsimple/struct/whoami.rb
174
174
  - lib/dnsimple/struct/whois_privacy.rb
175
+ - lib/dnsimple/struct/whois_privacy_renewal.rb
175
176
  - lib/dnsimple/struct/zone.rb
176
177
  - lib/dnsimple/struct/zone_distribution.rb
177
178
  - lib/dnsimple/struct/zone_file.rb
@@ -324,6 +325,9 @@ files:
324
325
  - spec/fixtures.http/removeCollaborator/success.http
325
326
  - spec/fixtures.http/renewDomain/error-tooearly.http
326
327
  - spec/fixtures.http/renewDomain/success.http
328
+ - spec/fixtures.http/renewWhoisPrivacy/success.http
329
+ - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http
330
+ - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http
327
331
  - spec/fixtures.http/resetDomainToken/success.http
328
332
  - spec/fixtures.http/response.http
329
333
  - spec/fixtures.http/success-with-malformed-json.http
@@ -359,8 +363,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
363
  - !ruby/object:Gem::Version
360
364
  version: '0'
361
365
  requirements: []
362
- rubyforge_project:
363
- rubygems_version: 2.7.7
366
+ rubygems_version: 3.0.2
364
367
  signing_key:
365
368
  specification_version: 4
366
369
  summary: The DNSimple API client for Ruby
@@ -512,6 +515,9 @@ test_files:
512
515
  - spec/fixtures.http/removeCollaborator/success.http
513
516
  - spec/fixtures.http/renewDomain/error-tooearly.http
514
517
  - spec/fixtures.http/renewDomain/success.http
518
+ - spec/fixtures.http/renewWhoisPrivacy/success.http
519
+ - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http
520
+ - spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http
515
521
  - spec/fixtures.http/resetDomainToken/success.http
516
522
  - spec/fixtures.http/response.http
517
523
  - spec/fixtures.http/success-with-malformed-json.http