dnsimple 6.0.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -0
- data/.rubocop.yml +4 -13
- data/.rubocop_todo.yml +9 -28
- data/.travis.yml +7 -3
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -1
- data/dnsimple.gemspec +1 -1
- data/lib/dnsimple/client/clients.rb +3 -2
- data/lib/dnsimple/client/registrar.rb +3 -0
- data/lib/dnsimple/error.rb +1 -1
- data/lib/dnsimple/extra.rb +1 -1
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/domains_collaborators_spec.rb +2 -2
- data/spec/dnsimple/client_spec.rb +15 -15
- data/spec/dnsimple/options/list_options_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- metadata +8 -8
- data/.dependabot/config.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf8d057d98c78bf3b8584e15b561624dfb35f1264f80d0c5861e970053b18f3
|
4
|
+
data.tar.gz: acc7e6f33680ba4195243b474dca108e566c953ed2474e36fd9631c9f6b1f2fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504d15c395fcbbb08a4c351912f9cb47e0dac082ae9da5ef22161bc5bc6a5fc6e1f46466ab7c482385c996a558a10dad4d12fc2cd1eac130c417f6c21e70cfd0
|
7
|
+
data.tar.gz: 3ebc372cd78a2bc5d4cf3bdcab9168e572856fe0614da843949c5a58a1508399281b25a621e399280b1e4464a72ea5099d9e88e227aec7a564213297d81a6720
|
data/.rubocop.yml
CHANGED
@@ -8,21 +8,12 @@ require:
|
|
8
8
|
- rubocop-rspec
|
9
9
|
|
10
10
|
AllCops:
|
11
|
+
TargetRubyVersion: 2.6
|
11
12
|
Exclude:
|
12
13
|
- '*.gemspec'
|
13
14
|
- 'Rakefile'
|
15
|
+
- 'vendor/**/*'
|
14
16
|
|
15
|
-
#
|
16
|
-
|
17
|
-
# Hence keep it disabled, but don't include it in the DNSimple suite.
|
18
|
-
Lint/Loop:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
# It doesn't seem to work as expected.
|
22
|
-
Style/IfUnlessModifier:
|
23
|
-
Enabled: false
|
24
|
-
|
25
|
-
# This rule suggest to use safe navigation (&.) operator which was introduced
|
26
|
-
# with Ruby 2.3. Because we are supporting Ruby 2.0+ we can't use this operator.
|
27
|
-
Style/SafeNavigation:
|
17
|
+
# This rule conflicts with our specs codebase using Ruby 2.x and 3.x
|
18
|
+
Lint/NonDeterministicRequireOrder:
|
28
19
|
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,49 +1,36 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-
|
3
|
+
# on 2021-06-01 13:07:05 UTC using RuboCop version 1.16.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters:
|
11
|
-
# Prefixes: when, with, without
|
12
|
-
RSpec/ContextWording:
|
13
|
-
Exclude:
|
14
|
-
- 'spec/dnsimple/client/domains_collaborators_spec.rb'
|
15
|
-
- 'spec/dnsimple/options/list_options_spec.rb'
|
16
|
-
|
17
|
-
# Offense count: 70
|
18
|
-
# Configuration parameters: Max.
|
9
|
+
# Offense count: 71
|
10
|
+
# Configuration parameters: CountAsOne.
|
19
11
|
RSpec/ExampleLength:
|
20
|
-
|
12
|
+
Max: 17
|
21
13
|
|
22
14
|
# Offense count: 1
|
23
15
|
RSpec/LeakyConstantDeclaration:
|
24
16
|
Exclude:
|
25
17
|
- 'spec/dnsimple/client/client_service_spec.rb'
|
26
18
|
|
27
|
-
# Offense count:
|
19
|
+
# Offense count: 11
|
28
20
|
# Configuration parameters: .
|
29
21
|
# SupportedStyles: have_received, receive
|
30
22
|
RSpec/MessageSpies:
|
31
23
|
EnforcedStyle: receive
|
32
24
|
|
33
|
-
# Offense count:
|
25
|
+
# Offense count: 112
|
34
26
|
RSpec/MultipleExpectations:
|
35
|
-
Max:
|
27
|
+
Max: 15
|
36
28
|
|
37
|
-
# Offense count:
|
29
|
+
# Offense count: 375
|
38
30
|
# Configuration parameters: IgnoreSharedExamples.
|
39
31
|
RSpec/NamedSubject:
|
40
32
|
Enabled: false
|
41
33
|
|
42
|
-
# Offense count: 10
|
43
|
-
RSpec/StubbedMock:
|
44
|
-
Exclude:
|
45
|
-
- 'spec/dnsimple/client_spec.rb'
|
46
|
-
|
47
34
|
# Offense count: 16
|
48
35
|
RSpec/SubjectStub:
|
49
36
|
Exclude:
|
@@ -60,13 +47,7 @@ RSpec/SubjectStub:
|
|
60
47
|
- 'spec/dnsimple/client/zones_spec.rb'
|
61
48
|
- 'spec/dnsimple/client_spec.rb'
|
62
49
|
|
63
|
-
# Offense count:
|
64
|
-
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
65
|
-
RSpec/VerifiedDoubles:
|
66
|
-
Exclude:
|
67
|
-
- 'spec/dnsimple/client_spec.rb'
|
68
|
-
|
69
|
-
# Offense count: 39
|
50
|
+
# Offense count: 37
|
70
51
|
# Configuration parameters: AllowedConstants.
|
71
52
|
Style/Documentation:
|
72
53
|
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,16 +1,20 @@
|
|
1
|
+
dist: focal
|
2
|
+
|
1
3
|
language: ruby
|
2
4
|
|
3
5
|
rvm:
|
4
|
-
- 2.4
|
5
|
-
- 2.5
|
6
6
|
- 2.6
|
7
7
|
- 2.7
|
8
8
|
- 3.0
|
9
9
|
- ruby-head
|
10
|
+
- truffleruby-head
|
11
|
+
|
12
|
+
cache: bundler
|
10
13
|
|
11
|
-
|
14
|
+
jobs:
|
12
15
|
allow_failures:
|
13
16
|
- rvm: ruby-head
|
17
|
+
- rvm: truffleruby-head
|
14
18
|
|
15
19
|
env:
|
16
20
|
- COVERALL=1
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).
|
|
4
4
|
|
5
5
|
## main
|
6
6
|
|
7
|
+
## 0.7.0
|
8
|
+
|
9
|
+
- CHANGED: Minimum Ruby version is now 2.6
|
10
|
+
- CHANGED: Deprecates `registrar.getDomainPremiumPrice` in favour of `registrar.getDomainPrices`
|
11
|
+
|
7
12
|
## 6.0.0
|
8
13
|
|
9
14
|
- NEW: Added `registrar.get_domain_prices` to retrieve whether a domain is premium and the prices to register, transfer, and renew. (dnsimple/dnsimple-ruby#230)
|
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.
|
8
|
+
gem 'rubocop', '1.16.0', require: false
|
9
9
|
gem 'rubocop-performance', require: false
|
10
10
|
gem 'rubocop-rake', require: false
|
11
11
|
gem 'rubocop-rspec', require: false
|
data/dnsimple.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = 'The DNSimple API client for Ruby'
|
12
12
|
s.description = 'The DNSimple API client for Ruby.'
|
13
13
|
|
14
|
-
s.required_ruby_version = ">= 2.
|
14
|
+
s.required_ruby_version = ">= 2.6"
|
15
15
|
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
s.files = `git ls-files`.split("\n")
|
@@ -98,14 +98,15 @@ module Dnsimple
|
|
98
98
|
options = args.pop
|
99
99
|
response = nil
|
100
100
|
|
101
|
-
|
101
|
+
loop do
|
102
102
|
current_page += 1
|
103
103
|
query = Extra.deep_merge(options, query: { page: current_page, per_page: 100 })
|
104
104
|
|
105
105
|
response = send(method, *(args + [query]))
|
106
106
|
total_pages ||= response.total_pages
|
107
107
|
collection.concat(response.data)
|
108
|
-
|
108
|
+
break unless current_page < total_pages
|
109
|
+
end
|
109
110
|
|
110
111
|
CollectionResponse.new(response.http_response, collection)
|
111
112
|
end
|
@@ -42,7 +42,10 @@ module Dnsimple
|
|
42
42
|
# @return [Struct::DomainPremiumPrice]
|
43
43
|
#
|
44
44
|
# @raise [RequestError] When the request fails.
|
45
|
+
#
|
46
|
+
# @deprecated Use {#get_domain_prices} instead of this one as it will soon be removed from the API.
|
45
47
|
def domain_premium_price(account_id, domain_name, options = {})
|
48
|
+
Dnsimple.deprecate("Use {#get_domain_prices} instead of this one as it will soon be removed from the API.")
|
46
49
|
endpoint = Client.versioned("/%s/registrar/domains/%s/premium_price" % [account_id, domain_name])
|
47
50
|
options[:query] = { action: options.delete(:action) } if options.key?(:action)
|
48
51
|
response = client.get(endpoint, options)
|
data/lib/dnsimple/error.rb
CHANGED
@@ -18,7 +18,7 @@ module Dnsimple
|
|
18
18
|
|
19
19
|
def message_from(http_response)
|
20
20
|
content_type = http_response.headers["Content-Type"]
|
21
|
-
if content_type
|
21
|
+
if content_type&.start_with?("application/json")
|
22
22
|
http_response.parsed_response["message"]
|
23
23
|
else
|
24
24
|
net_http_response = http_response.response
|
data/lib/dnsimple/extra.rb
CHANGED
@@ -55,7 +55,7 @@ module Dnsimple
|
|
55
55
|
# @raise [ArgumentError]
|
56
56
|
def self.validate_mandatory_attributes(attributes, required)
|
57
57
|
required.each do |name|
|
58
|
-
attributes
|
58
|
+
attributes&.key?(name) or raise(ArgumentError, ":#{name} is required")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
data/lib/dnsimple/version.rb
CHANGED
@@ -63,7 +63,7 @@ describe Dnsimple::Client, ".domains" do
|
|
63
63
|
let(:account_id) { 1010 }
|
64
64
|
let(:domain_id) { "example.com" }
|
65
65
|
|
66
|
-
context "
|
66
|
+
context "when inviting a user already registered on DNSimple" do
|
67
67
|
before do
|
68
68
|
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators$})
|
69
69
|
.to_return(read_http_fixture("addCollaborator/success.http"))
|
@@ -93,7 +93,7 @@ describe Dnsimple::Client, ".domains" do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
context "
|
96
|
+
context "when inviting a user not registered on DNSimple" do
|
97
97
|
before do
|
98
98
|
stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/collaborators$})
|
99
99
|
.to_return(read_http_fixture("addCollaborator/invite-success.http"))
|
@@ -49,35 +49,35 @@ describe Dnsimple::Client do
|
|
49
49
|
|
50
50
|
describe "#get" do
|
51
51
|
it "delegates to #request" do
|
52
|
-
|
52
|
+
allow(subject).to receive(:execute).with(:get, "path", nil, foo: "bar").and_return(:returned)
|
53
53
|
expect(subject.get("path", foo: "bar")).to eq(:returned)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe "#post" do
|
58
58
|
it "delegates to #request" do
|
59
|
-
|
59
|
+
allow(subject).to receive(:execute).with(:post, "path", { foo: "bar" }, {}).and_return(:returned)
|
60
60
|
expect(subject.post("path", foo: "bar")).to eq(:returned)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "#put" do
|
65
65
|
it "delegates to #request" do
|
66
|
-
|
66
|
+
allow(subject).to receive(:execute).with(:put, "path", { foo: "bar" }, {}).and_return(:returned)
|
67
67
|
expect(subject.put("path", foo: "bar")).to eq(:returned)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
describe "#patch" do
|
72
72
|
it "delegates to #request" do
|
73
|
-
|
73
|
+
allow(subject).to receive(:execute).with(:patch, "path", { foo: "bar" }, {}).and_return(:returned)
|
74
74
|
expect(subject.patch("path", foo: "bar")).to eq(:returned)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
describe "#delete" do
|
79
79
|
it "delegates to #request" do
|
80
|
-
|
80
|
+
allow(subject).to receive(:execute).with(:delete, "path", { foo: "bar" }, {}).and_return(:returned)
|
81
81
|
expect(subject.delete("path", foo: "bar")).to eq(:returned)
|
82
82
|
end
|
83
83
|
end
|
@@ -126,20 +126,20 @@ describe Dnsimple::Client do
|
|
126
126
|
it "delegates to HTTParty" do
|
127
127
|
stub_request(:get, %r{/foo})
|
128
128
|
|
129
|
-
|
129
|
+
allow(HTTParty).to receive(:get)
|
130
130
|
.with(
|
131
131
|
"#{subject.base_url}foo",
|
132
132
|
format: :json,
|
133
133
|
basic_auth: { username: "user", password: "pass" },
|
134
134
|
headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
|
135
135
|
)
|
136
|
-
.and_return(
|
136
|
+
.and_return(instance_double('response', code: 200))
|
137
137
|
|
138
138
|
subject.request(:get, 'foo')
|
139
139
|
end
|
140
140
|
|
141
141
|
it "properly extracts processes options and encodes data" do
|
142
|
-
|
142
|
+
allow(HTTParty).to receive(:put)
|
143
143
|
.with(
|
144
144
|
"#{subject.base_url}foo",
|
145
145
|
format: :json,
|
@@ -148,13 +148,13 @@ describe Dnsimple::Client do
|
|
148
148
|
basic_auth: { username: "user", password: "pass" },
|
149
149
|
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT, "Custom" => "Header" }
|
150
150
|
)
|
151
|
-
.and_return(
|
151
|
+
.and_return(instance_double('response', code: 200))
|
152
152
|
|
153
153
|
subject.request(:put, 'foo', { something: "else" }, { query: { foo: "bar" }, headers: { "Custom" => "Header" } })
|
154
154
|
end
|
155
155
|
|
156
156
|
it "handles non application/json content types" do
|
157
|
-
|
157
|
+
allow(HTTParty).to receive(:post)
|
158
158
|
.with(
|
159
159
|
"#{subject.base_url}foo",
|
160
160
|
format: :json,
|
@@ -162,13 +162,13 @@ describe Dnsimple::Client do
|
|
162
162
|
basic_auth: { username: "user", password: "pass" },
|
163
163
|
headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => Dnsimple::Default::USER_AGENT }
|
164
164
|
)
|
165
|
-
.and_return(
|
165
|
+
.and_return(instance_double('response', code: 200))
|
166
166
|
|
167
167
|
subject.request(:post, 'foo', { something: "else" }, { headers: { "Content-Type" => "application/x-www-form-urlencoded" } })
|
168
168
|
end
|
169
169
|
|
170
170
|
it "includes options for proxy support" do
|
171
|
-
|
171
|
+
allow(HTTParty).to receive(:get)
|
172
172
|
.with(
|
173
173
|
"#{subject.base_url}test",
|
174
174
|
format: :json,
|
@@ -176,20 +176,20 @@ describe Dnsimple::Client do
|
|
176
176
|
http_proxyport: "4321",
|
177
177
|
headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
|
178
178
|
)
|
179
|
-
.and_return(
|
179
|
+
.and_return(instance_double('response', code: 200))
|
180
180
|
|
181
181
|
subject = described_class.new(proxy: "example-proxy.com:4321")
|
182
182
|
subject.request(:get, "test", nil, {})
|
183
183
|
end
|
184
184
|
|
185
185
|
it "supports custom user agent" do
|
186
|
-
|
186
|
+
allow(HTTParty).to receive(:get)
|
187
187
|
.with(
|
188
188
|
"#{subject.base_url}test",
|
189
189
|
format: :json,
|
190
190
|
headers: hash_including("User-Agent" => "customAgent #{Dnsimple::Default::USER_AGENT}")
|
191
191
|
)
|
192
|
-
.and_return(
|
192
|
+
.and_return(instance_double("response", code: 200))
|
193
193
|
|
194
194
|
subject = described_class.new(user_agent: "customAgent")
|
195
195
|
subject.request(:get, "test", nil)
|
@@ -14,14 +14,14 @@ RSpec.describe Dnsimple::Options::ListOptions do
|
|
14
14
|
expect(options.to_h).to eq({})
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
describe 'query' do
|
18
18
|
it 'adds "query" key if given options are filled' do
|
19
19
|
options = described_class.new(a: 1)
|
20
20
|
expect(options.to_h).to have_key(:query)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
describe 'pagination' do
|
25
25
|
it 'adds "page" to "query"' do
|
26
26
|
raw = { page: '23' }
|
27
27
|
expected = { query: raw }
|
@@ -47,7 +47,7 @@ RSpec.describe Dnsimple::Options::ListOptions do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
describe 'sorting' do
|
51
51
|
it 'adds sorting policy to "query"' do
|
52
52
|
raw = { sort: 'name:desc' }
|
53
53
|
expected = { query: raw }
|
@@ -73,7 +73,7 @@ RSpec.describe Dnsimple::Options::ListOptions do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
|
76
|
+
describe 'filtering' do
|
77
77
|
it 'adds filtering policy to "query"' do
|
78
78
|
raw = { filter: { name_like: 'example' } }
|
79
79
|
expected = { query: raw.fetch(:filter) }
|
data/spec/spec_helper.rb
CHANGED
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: 7.0.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: 2021-
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -88,7 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files:
|
89
89
|
- LICENSE.txt
|
90
90
|
files:
|
91
|
-
- ".dependabot
|
91
|
+
- ".github/dependabot.yml"
|
92
92
|
- ".gitignore"
|
93
93
|
- ".rspec"
|
94
94
|
- ".rubocop.yml"
|
@@ -356,7 +356,7 @@ files:
|
|
356
356
|
homepage: https://github.com/dnsimple/dnsimple-ruby
|
357
357
|
licenses: []
|
358
358
|
metadata: {}
|
359
|
-
post_install_message:
|
359
|
+
post_install_message:
|
360
360
|
rdoc_options: []
|
361
361
|
require_paths:
|
362
362
|
- lib
|
@@ -364,15 +364,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
364
364
|
requirements:
|
365
365
|
- - ">="
|
366
366
|
- !ruby/object:Gem::Version
|
367
|
-
version: '2.
|
367
|
+
version: '2.6'
|
368
368
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
369
369
|
requirements:
|
370
370
|
- - ">="
|
371
371
|
- !ruby/object:Gem::Version
|
372
372
|
version: '0'
|
373
373
|
requirements: []
|
374
|
-
rubygems_version: 3.
|
375
|
-
signing_key:
|
374
|
+
rubygems_version: 3.1.4
|
375
|
+
signing_key:
|
376
376
|
specification_version: 4
|
377
377
|
summary: The DNSimple API client for Ruby
|
378
378
|
test_files:
|