dnsimple 7.1.1 → 8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 186f6faf074afa519d67b5397e0e1568ed6745948239a14fb8f72f39dccea390
4
- data.tar.gz: 605cf70471182fc26fb96cb99eadc204040040bee4481ff1de4837a8084940c8
3
+ metadata.gz: 54546cd64cb573f075ed2538cebd73573708a1f9919364b4b963a082b1dc97bf
4
+ data.tar.gz: 9e86592b7ff194316f5466d2b0a4cf0f988df1e90973bc29cfc30a4b7e2bccd8
5
5
  SHA512:
6
- metadata.gz: 76a9bdea4ba0618262230bea5daa1d5fe66a23e414ce7c5eae0115b343bb9355e277ef492d6f4f8ce8579609e3c511075dfed7080dfac3a34260c499faea1375
7
- data.tar.gz: 5c07656ba50cdd66cba4c51ea7085229c05f0140127061a0c567ec3940c9ab6e779aae9ff8627f4531fc9bdb2bdb150683f63e792a051c55be81d3e26f0f906e
6
+ metadata.gz: 997ac7555b02778d5bb10c03aa97640a5a2b3e2a55064785657774da5032a8b11cf009b0de1d47dc4864c5835ea1426bc46bed082119d7aae1c87dc5058d44ed
7
+ data.tar.gz: 7fee63c8c4f9ae899023989de18fc920b45bd5405b2075040ef167f1b7f82e0b8ddf7b6364dd23f42ac9f6ff5a53a900493af42eb489f7fa0f6acc17be74fd3b
@@ -10,4 +10,13 @@ updates:
10
10
  labels:
11
11
  - task
12
12
  - dependencies
13
- - backlog-dependencies
13
+
14
+ - package-ecosystem: "github-actions"
15
+ directory: "/"
16
+ schedule:
17
+ interval: "daily"
18
+ time: '12:00'
19
+ open-pull-requests-limit: 10
20
+ labels:
21
+ - task
22
+ - dependencies
@@ -1,47 +1,51 @@
1
- ---
2
- name: ci
1
+ name: CI
3
2
 
4
3
  on:
5
4
  push:
5
+ branches: [ main ]
6
6
  pull_request:
7
- # Allows you to run this workflow manually from the Actions tab
8
7
  workflow_dispatch:
9
8
 
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
10
13
  jobs:
11
14
  markdownlint-cli:
15
+ name: Lint markdown
12
16
  runs-on: ubuntu-latest
13
17
  steps:
14
18
  - name: Checkout Code
15
- uses: actions/checkout@v2
19
+ uses: actions/checkout@v3
16
20
  - name: Run markdownlint-cli
17
- uses: nosborn/github-action-markdown-cli@v2.0.0
21
+ uses: nosborn/github-action-markdown-cli@v3.1.0
18
22
  with:
19
23
  files: .
20
24
  config_file: ".markdownlint.yaml"
21
25
 
22
26
  yamllint:
27
+ name: Lint YAML
23
28
  runs-on: ubuntu-latest
24
29
  steps:
25
30
  - name: Checkout Code
26
- uses: actions/checkout@v2
31
+ uses: actions/checkout@v3
27
32
  - name: Run YAML Lint
28
33
  uses: actionshub/yamllint@main
29
34
 
30
- build:
35
+ test:
31
36
  needs: [markdownlint-cli, yamllint]
32
37
  runs-on: ubuntu-latest
33
38
  name: Ruby ${{ matrix.ruby-version }}
34
39
  strategy:
35
40
  matrix:
36
41
  ruby-version:
37
- - '2.6'
38
42
  - '2.7'
39
43
  - '3.0'
40
44
  - '3.1'
41
45
  - 'ruby-head'
42
46
  - 'truffleruby-head'
43
47
  steps:
44
- - uses: actions/checkout@v2
48
+ - uses: actions/checkout@v3
45
49
  - name: Set up Ruby
46
50
  uses: ruby/setup-ruby@v1
47
51
  with:
@@ -53,7 +57,7 @@ jobs:
53
57
  if: always()
54
58
  name: Post Workflow Status To Slack
55
59
  needs:
56
- - build
60
+ - test
57
61
  runs-on: ubuntu-latest
58
62
  steps:
59
63
  - name: Slack Workflow Notification
@@ -1,5 +1,4 @@
1
- ---
2
- name: release
1
+ name: Release
3
2
 
4
3
  on:
5
4
  push:
@@ -7,10 +6,20 @@ on:
7
6
  - v*.*.*
8
7
  jobs:
9
8
  publish:
9
+ name: Release to RubyGems
10
10
  runs-on: ubuntu-latest
11
11
 
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - name: Wait for tests to succeed
14
+ uses: lewagon/wait-on-check-action@v1.1.2
15
+ with:
16
+ ref: 'refs/heads/main'
17
+ running-workflow-name: 'Release to RubyGems'
18
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
19
+ wait-interval: 10
20
+ allowed-conclusions: success
21
+
22
+ - uses: actions/checkout@v3
14
23
 
15
24
  - name: Release Gem
16
25
  uses: cadwallion/publish-rubygems-action@8f9e0538302643309e4e43bf48cd34173ca48cfc # yamllint disable-line
@@ -140,7 +140,7 @@ Style/BarePercentLiterals:
140
140
  # braces_for_chaining seems a good fit of what we've been doing so far.
141
141
  Style/BlockDelimiters:
142
142
  EnforcedStyle: braces_for_chaining
143
- IgnoredMethods:
143
+ AllowedMethods:
144
144
  - expect
145
145
 
146
146
  # Warn on empty else.
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-12-31 12:20:10 UTC using RuboCop version 1.24.1.
3
+ # on 2022-08-09 14:54:31 UTC using RuboCop version 1.34.1.
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
data/.yamllint.yml ADDED
@@ -0,0 +1,29 @@
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
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.0.0
8
+
9
+ - CHANGED: Minimum Ruby version is now 2.7
10
+ - REMOVED: `registrar.getDomainPremiumPrice` in favour of `registrar.getDomainPrices`
11
+ - CHANGED: Deprecate Certificate's `contact_id` (dnsimple/dnsimple-ruby#276)
12
+ - FIXED: Remove stale reference to Client::DomainServicesService (dnsimple/dnsimple-ruby#267)
13
+
7
14
  ## 7.1.1
8
15
 
9
16
  - CHANGED: Bumped up dependencies
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.24.1', require: false
8
+ gem 'rubocop', '1.34.1', require: false
9
9
  gem 'rubocop-performance', require: false
10
10
  gem 'rubocop-rake', require: false
11
11
  gem 'rubocop-rspec', require: false
data/Rakefile CHANGED
@@ -33,5 +33,5 @@ task :clobber => "yardoc:clobber"
33
33
 
34
34
  desc "Open an irb session preloaded with this library"
35
35
  task :console do
36
- sh "irb -rubygems -I lib -r dnsimple.rb"
36
+ sh "irb -r rubygems -I lib -r dnsimple.rb"
37
37
  end
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.6"
14
+ s.required_ruby_version = ">= 2.7"
15
15
 
16
16
  s.require_paths = ['lib']
17
17
  s.files = `git ls-files`.split("\n")
@@ -121,7 +121,6 @@ module Dnsimple
121
121
  # @param account_id [Integer] the account ID
122
122
  # @param domain_id [#to_s] the domain ID or domain name
123
123
  # @param attributes [Hash]
124
- # @option attributes [Integer] :contact_id the contact ID (mandatory)
125
124
  # @option attributes [String] :name the certificate name (optional)
126
125
  # @option attributes [Array<String>] :alternate_names the certificate alternate names (optional)
127
126
  # @option attributes [TrueClass,FalseClass] :auto_renew enable certificate auto renew (optional)
@@ -133,7 +132,7 @@ module Dnsimple
133
132
  # @raise [Dnsimple::RequestError]
134
133
  #
135
134
  # @example Basic usage
136
- # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", contact_id: 1)
135
+ # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com")
137
136
  # certificate = response.data
138
137
  #
139
138
  # certificate.id # => 100
@@ -142,7 +141,7 @@ module Dnsimple
142
141
  # certificate.auto_renew # => false
143
142
  #
144
143
  # @example Custom name
145
- # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", contact_id: 1, name: "docs")
144
+ # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", name: "docs")
146
145
  # certificate = response.data
147
146
  #
148
147
  # certificate.id # => 100
@@ -151,7 +150,7 @@ module Dnsimple
151
150
  # certificate.auto_renew # => false
152
151
  #
153
152
  # @example SAN names
154
- # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", contact_id: 1, alternate_names: ["api.example.com", "status.example.com"])
153
+ # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", alternate_names: ["api.example.com", "status.example.com"])
155
154
  # certificate = response.data
156
155
  #
157
156
  # certificate.id # => 100
@@ -160,15 +159,14 @@ module Dnsimple
160
159
  # certificate.auto_renew # => false
161
160
  #
162
161
  # @example Auto renew
163
- # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", contact_id: 1, auto_renew: true)
162
+ # response = client.certificates.purchase_letsencrypt_certificate(1010, "example.com", auto_renew: true)
164
163
  # certificate = response.data
165
164
  #
166
165
  # certificate.id # => 100
167
166
  # certificate.common_name # => "www.example.com"
168
167
  # certificate.alternate_names # => []
169
168
  # certificate.auto_renew # => true
170
- def purchase_letsencrypt_certificate(account_id, domain_id, attributes, options = {})
171
- Extra.validate_mandatory_attributes(attributes, [:contact_id])
169
+ def purchase_letsencrypt_certificate(account_id, domain_id, attributes = {}, options = {})
172
170
  response = client.post(Client.versioned("/%s/domains/%s/certificates/letsencrypt" % [account_id, domain_id]), attributes, options)
173
171
 
174
172
  Dnsimple::Response.new(response, Struct::CertificatePurchase.new(response["data"]))
@@ -23,11 +23,6 @@ module Dnsimple
23
23
  @services[:domains] ||= Client::DomainsService.new(self)
24
24
  end
25
25
 
26
- # @return [Dnsimple::Client::DomainServicesService] The domain-services-related API proxy.
27
- def domain_services
28
- @services[:domains] ||= Client::DomainServicesService.new(self)
29
- end
30
-
31
26
  # @return [Dnsimple::Client::IdentityService] The identity-related API proxy.
32
27
  def identity
33
28
  @services[:auth] ||= Client::IdentityService.new(self)
@@ -24,35 +24,6 @@ module Dnsimple
24
24
  Dnsimple::Response.new(response, Struct::DomainCheck.new(response["data"]))
25
25
  end
26
26
 
27
- # Checks the premium price for a domain
28
- #
29
- # @see https://developer.dnsimple.com/v2/registrar/#premium-price
30
- #
31
- # @example Check the ruby.codes premium price:
32
- # client.registrar.domain_premium_price(1010, "ruby.codes")
33
- #
34
- # @example Check the ruby.codes premium price for transfer:
35
- # client.registrar.domain_premium_price(1010, "ruby.codes", action: "transfer")
36
- #
37
- # @param [Integer] account_id the account ID
38
- # @param [#to_s] domain_name the domain name to check
39
- # @param [Hash] options
40
- # @option options [String] :action Optional action between "registration",
41
- # "renewal", and "transfer". If omitted, it defaults to "registration".
42
- # @return [Struct::DomainPremiumPrice]
43
- #
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.
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.")
49
- endpoint = Client.versioned("/%s/registrar/domains/%s/premium_price" % [account_id, domain_name])
50
- options[:query] = { action: options.delete(:action) } if options.key?(:action)
51
- response = client.get(endpoint, options)
52
-
53
- Dnsimple::Response.new(response, Struct::DomainPremiumPrice.new(response["data"]))
54
- end
55
-
56
27
  # Get prices for a domain.
57
28
  # @see https://developer.dnsimple.com/v2/registrar/#getDomainPrices
58
29
  #
@@ -36,43 +36,43 @@ module Dnsimple
36
36
  # Default API endpoint from ENV or {BASE_URL}
37
37
  # @return [String]
38
38
  def base_url
39
- ENV['DNSIMPLE_BASE_URL'] || BASE_URL
39
+ ENV.fetch('DNSIMPLE_BASE_URL', BASE_URL)
40
40
  end
41
41
 
42
42
  # Default DNSimple username for Basic Auth from ENV
43
43
  # @return [String]
44
44
  def username
45
- ENV['DNSIMPLE_USERNAME']
45
+ ENV.fetch('DNSIMPLE_USERNAME', nil)
46
46
  end
47
47
 
48
48
  # Default DNSimple password for Basic Auth from ENV
49
49
  # @return [String]
50
50
  def password
51
- ENV['DNSIMPLE_PASSWORD']
51
+ ENV.fetch('DNSIMPLE_PASSWORD', nil)
52
52
  end
53
53
 
54
54
  # Default DNSimple access token for OAuth authentication from ENV
55
55
  # @return [String]
56
56
  def access_token
57
- ENV['DNSIMPLE_ACCESS_TOKEN']
57
+ ENV.fetch('DNSIMPLE_ACCESS_TOKEN', nil)
58
58
  end
59
59
 
60
60
  # Default DNSimple Domain API Token for Token Auth from ENV
61
61
  # @return [String]
62
62
  def domain_api_token
63
- ENV['DNSIMPLE_API_DOMAIN_TOKEN']
63
+ ENV.fetch('DNSIMPLE_API_DOMAIN_TOKEN', nil)
64
64
  end
65
65
 
66
66
  # Default User-Agent header string from ENV
67
67
  # @return [String]
68
68
  def user_agent
69
- ENV['DNSIMPLE_USER_AGENT']
69
+ ENV.fetch('DNSIMPLE_USER_AGENT', nil)
70
70
  end
71
71
 
72
72
  # Default Proxy address:port from ENV
73
73
  # @return [String]
74
74
  def proxy
75
- ENV['DNSIMPLE_PROXY']
75
+ ENV.fetch('DNSIMPLE_PROXY', nil)
76
76
  end
77
77
 
78
78
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dnsimple
4
- VERSION = "7.1.1"
4
+ VERSION = "8.0.0"
5
5
  end
@@ -68,8 +68,8 @@ describe Dnsimple::Client, ".certificates" do
68
68
  let(:domain_id) { "dnsimple.us" }
69
69
 
70
70
  it "delegates to client.paginate" do
71
- expect(subject).to receive(:paginate).with(:certificates, account_id, domain_id, foo: "bar")
72
- subject.all_certificates(account_id, domain_id, foo: "bar")
71
+ expect(subject).to receive(:paginate).with(:certificates, account_id, domain_id, { foo: "bar" })
72
+ subject.all_certificates(account_id, domain_id, { foo: "bar" })
73
73
  end
74
74
 
75
75
  it "supports sorting" do
@@ -232,7 +232,6 @@ describe Dnsimple::Client, ".certificates" do
232
232
  describe "#purchase_letsencrypt_certificate" do
233
233
  let(:account_id) { 1010 }
234
234
  let(:domain_id) { "bingo.pizza" }
235
- let(:contact_id) { 100 }
236
235
 
237
236
  before do
238
237
  stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt})
@@ -240,7 +239,7 @@ describe Dnsimple::Client, ".certificates" do
240
239
  end
241
240
 
242
241
  it "builds the correct request" do
243
- attributes = { contact_id: contact_id }
242
+ attributes = {}
244
243
  subject.purchase_letsencrypt_certificate(account_id, domain_id, attributes)
245
244
 
246
245
  expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt")
@@ -249,7 +248,7 @@ describe Dnsimple::Client, ".certificates" do
249
248
  end
250
249
 
251
250
  it "passes extra attributes" do
252
- attributes = { contact_id: contact_id, name: "www", auto_renew: true, alternate_names: ["api.example.com"] }
251
+ attributes = { name: "www", auto_renew: true, alternate_names: ["api.example.com"] }
253
252
  subject.purchase_letsencrypt_certificate(account_id, domain_id, attributes)
254
253
 
255
254
  expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/letsencrypt")
@@ -258,7 +257,7 @@ describe Dnsimple::Client, ".certificates" do
258
257
  end
259
258
 
260
259
  it "returns the certificate purchase" do
261
- response = subject.purchase_letsencrypt_certificate(account_id, domain_id, contact_id: contact_id)
260
+ response = subject.purchase_letsencrypt_certificate(account_id, domain_id)
262
261
  expect(response).to be_a(Dnsimple::Response)
263
262
 
264
263
  result = response.data
@@ -276,7 +275,7 @@ describe Dnsimple::Client, ".certificates" do
276
275
  .to_return(read_http_fixture("notfound-domain.http"))
277
276
 
278
277
  expect {
279
- subject.purchase_letsencrypt_certificate(account_id, domain_id, contact_id: contact_id)
278
+ subject.purchase_letsencrypt_certificate(account_id, domain_id)
280
279
  }.to raise_error(Dnsimple::NotFoundError)
281
280
  end
282
281
  end
@@ -311,7 +310,7 @@ describe Dnsimple::Client, ".certificates" do
311
310
  expect(result.common_name).to eq("www.bingo.pizza")
312
311
  expect(result.alternate_names).to eq([])
313
312
  expect(result.years).to eq(1)
314
- expect(result.csr).to be(nil)
313
+ expect(result.csr).to be_nil
315
314
  expect(result.state).to eq("requesting")
316
315
  expect(result.authority_identifier).to eq("letsencrypt")
317
316
  expect(result.auto_renew).to be(false)
@@ -421,7 +420,7 @@ describe Dnsimple::Client, ".certificates" do
421
420
  expect(result.common_name).to eq("www.bingo.pizza")
422
421
  expect(result.alternate_names).to eq([])
423
422
  expect(result.years).to eq(1)
424
- expect(result.csr).to be(nil)
423
+ expect(result.csr).to be_nil
425
424
  expect(result.state).to eq("requesting")
426
425
  expect(result.authority_identifier).to eq("letsencrypt")
427
426
  expect(result.auto_renew).to be(false)
@@ -73,8 +73,8 @@ describe Dnsimple::Client, ".contacts" do
73
73
  let(:account_id) { 1010 }
74
74
 
75
75
  it "delegates to client.paginate" do
76
- expect(subject).to receive(:paginate).with(:contacts, account_id, foo: "bar")
77
- subject.all_contacts(account_id, foo: "bar")
76
+ expect(subject).to receive(:paginate).with(:contacts, account_id, { foo: "bar" })
77
+ subject.all_contacts(account_id, { foo: "bar" })
78
78
  end
79
79
 
80
80
  it "supports sorting" do
@@ -116,8 +116,8 @@ describe Dnsimple::Client, ".domains" do
116
116
  result = response.data
117
117
  expect(result).to be_a(Dnsimple::Struct::Collaborator)
118
118
  expect(result.id).to be_a(Integer)
119
- expect(result.user_id).to be(nil)
120
- expect(result.accepted_at).to be(nil)
119
+ expect(result.user_id).to be_nil
120
+ expect(result.accepted_at).to be_nil
121
121
  expect(result.user_email).to eq(attributes.fetch(:email))
122
122
  expect(result.invitation).to be(true)
123
123
  end
@@ -86,8 +86,8 @@ describe Dnsimple::Client, ".domains" do
86
86
  let(:domain_id) { "example.com" }
87
87
 
88
88
  it "delegates to client.paginate" do
89
- expect(subject).to receive(:paginate).with(:delegation_signer_records, account_id, domain_id, foo: "bar")
90
- subject.all_delegation_signer_records(account_id, domain_id, foo: "bar")
89
+ expect(subject).to receive(:paginate).with(:delegation_signer_records, account_id, domain_id, { foo: "bar" })
90
+ subject.all_delegation_signer_records(account_id, domain_id, { foo: "bar" })
91
91
  end
92
92
 
93
93
  it "supports sorting" do
@@ -86,8 +86,8 @@ describe Dnsimple::Client, ".domains" do
86
86
  let(:domain_id) { "example.com" }
87
87
 
88
88
  it "delegates to client.paginate" do
89
- expect(subject).to receive(:paginate).with(:email_forwards, account_id, domain_id, foo: "bar")
90
- subject.all_email_forwards(account_id, domain_id, foo: "bar")
89
+ expect(subject).to receive(:paginate).with(:email_forwards, account_id, domain_id, { foo: "bar" })
90
+ subject.all_email_forwards(account_id, domain_id, { foo: "bar" })
91
91
  end
92
92
 
93
93
  it "supports sorting" do
@@ -79,8 +79,8 @@ describe Dnsimple::Client, ".domains" do
79
79
  let(:account_id) { 1010 }
80
80
 
81
81
  it "delegates to client.paginate" do
82
- expect(subject).to receive(:paginate).with(:domains, account_id, foo: "bar")
83
- subject.all_domains(account_id, foo: "bar")
82
+ expect(subject).to receive(:paginate).with(:domains, account_id, { foo: "bar" })
83
+ subject.all_domains(account_id, { foo: "bar" })
84
84
  end
85
85
 
86
86
  it "supports sorting" do
@@ -34,54 +34,6 @@ describe Dnsimple::Client, ".registrar" do
34
34
  end
35
35
  end
36
36
 
37
- describe "#domain_premium_price" do
38
- let(:account_id) { 1010 }
39
-
40
- context "when premium price" do
41
- before do
42
- stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price[?action]*})
43
- .to_return(read_http_fixture("getDomainPremiumPrice/success.http"))
44
- end
45
-
46
- it "builds the correct request" do
47
- subject.domain_premium_price(account_id, domain_name = "ruby.codes")
48
-
49
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price")
50
- .with(headers: { "Accept" => "application/json" })
51
- end
52
-
53
- it "returns the premium price" do
54
- response = subject.domain_premium_price(account_id, "ruby.codes")
55
- expect(response).to be_a(Dnsimple::Response)
56
-
57
- result = response.data
58
- expect(result).to be_a(Dnsimple::Struct::DomainPremiumPrice)
59
- expect(result.premium_price).to eq("109.00")
60
- expect(result.action).to eq("registration")
61
- end
62
-
63
- it "builds the correct request when action is passed" do
64
- subject.domain_premium_price(account_id, domain_name = "ruby.codes", action: "registration")
65
-
66
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price?action=registration")
67
- .with(headers: { "Accept" => "application/json" })
68
- end
69
- end
70
-
71
- context "when not premium price" do
72
- before do
73
- stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price$})
74
- .to_return(read_http_fixture("getDomainPremiumPrice/failure.http"))
75
- end
76
-
77
- it "raises error" do
78
- expect {
79
- subject.domain_premium_price(account_id, "example.com")
80
- }.to raise_error(Dnsimple::RequestError, "`example.com` is not a premium domain for registration")
81
- end
82
- end
83
- end
84
-
85
37
  describe "#get_domain_prices" do
86
38
  let(:account_id) { 1010 }
87
39
 
@@ -317,7 +269,7 @@ describe Dnsimple::Client, ".registrar" do
317
269
  expect(result.state).to eq("transferring")
318
270
  expect(result.auto_renew).to be(false)
319
271
  expect(result.whois_privacy).to be(false)
320
- expect(result.status_description).to eq(nil)
272
+ expect(result.status_description).to be_nil
321
273
  expect(result.created_at).to eq("2020-06-05T18:08:00Z")
322
274
  expect(result.updated_at).to eq("2020-06-05T18:08:04Z")
323
275
  end
@@ -61,7 +61,7 @@ describe Dnsimple::Client, ".services" do
61
61
  end
62
62
 
63
63
  it "delegates to client.paginate" do
64
- expect(subject).to receive(:paginate).with(:services, foo: "bar")
64
+ expect(subject).to receive(:paginate).with(:services, { foo: "bar" })
65
65
  subject.all_services(foo: "bar")
66
66
  end
67
67
 
@@ -65,7 +65,7 @@ describe Dnsimple::Client, ".templates" do
65
65
  let(:template_id) { "alpha" }
66
66
 
67
67
  it "delegates to client.paginate" do
68
- expect(subject).to receive(:paginate).with(:records, account_id, template_id, option: "value")
68
+ expect(subject).to receive(:paginate).with(:records, account_id, template_id, { option: "value" })
69
69
  subject.all_records(account_id, template_id, option: "value")
70
70
  end
71
71
 
@@ -64,8 +64,8 @@ describe Dnsimple::Client, ".templates" do
64
64
  let(:account_id) { 1010 }
65
65
 
66
66
  it "delegates to client.paginate" do
67
- expect(subject).to receive(:paginate).with(:templates, account_id, foo: "bar")
68
- subject.all_templates(account_id, foo: "bar")
67
+ expect(subject).to receive(:paginate).with(:templates, account_id, { foo: "bar" })
68
+ subject.all_templates(account_id, { foo: "bar" })
69
69
  end
70
70
 
71
71
  it "supports sorting" do
@@ -68,7 +68,7 @@ describe Dnsimple::Client, ".tlds" do
68
68
  end
69
69
 
70
70
  it "delegates to client.paginate" do
71
- expect(subject).to receive(:paginate).with(:list_tlds, foo: "bar")
71
+ expect(subject).to receive(:paginate).with(:list_tlds, { foo: "bar" })
72
72
  subject.all_tlds(foo: "bar")
73
73
  end
74
74
 
@@ -93,8 +93,8 @@ describe Dnsimple::Client, ".zones" do
93
93
  let(:zone_id) { "example.com" }
94
94
 
95
95
  it "delegates to client.paginate" do
96
- expect(subject).to receive(:paginate).with(:list_zone_records, account_id, zone_id, foo: "bar")
97
- subject.all_zone_records(account_id, zone_id, foo: "bar")
96
+ expect(subject).to receive(:paginate).with(:list_zone_records, account_id, zone_id, { foo: "bar" })
97
+ subject.all_zone_records(account_id, zone_id, { foo: "bar" })
98
98
  end
99
99
 
100
100
  it "supports sorting" do
@@ -179,7 +179,7 @@ describe Dnsimple::Client, ".zones" do
179
179
  expect(result).to be_a(Dnsimple::Struct::ZoneRecord)
180
180
  expect(result.id).to eq(record_id)
181
181
  expect(result.zone_id).to eq("example.com")
182
- expect(result.parent_id).to eq(nil)
182
+ expect(result.parent_id).to be_nil
183
183
  expect(result.type).to eq("MX")
184
184
  expect(result.name).to eq("")
185
185
  expect(result.content).to eq("mxa.example.com")
@@ -79,8 +79,8 @@ describe Dnsimple::Client, ".zones" do
79
79
  let(:account_id) { 1010 }
80
80
 
81
81
  it "delegates to client.paginate" do
82
- expect(subject).to receive(:paginate).with(:zones, account_id, foo: "bar")
83
- subject.all_zones(account_id, foo: "bar")
82
+ expect(subject).to receive(:paginate).with(:zones, account_id, { foo: "bar" })
83
+ subject.all_zones(account_id, { foo: "bar" })
84
84
  end
85
85
 
86
86
  it "supports sorting" do
@@ -49,36 +49,36 @@ describe Dnsimple::Client do
49
49
 
50
50
  describe "#get" do
51
51
  it "delegates to #request" do
52
- allow(subject).to receive(:execute).with(:get, "path", nil, foo: "bar").and_return(:returned)
53
- expect(subject.get("path", foo: "bar")).to eq(:returned)
52
+ allow(subject).to receive(:execute).with(:get, "path", nil, { foo: "bar" }).and_return(:returned)
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
- expect(subject.post("path", foo: "bar")).to eq(:returned)
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
- expect(subject.put("path", foo: "bar")).to eq(:returned)
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
- expect(subject.patch("path", foo: "bar")).to eq(:returned)
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
- expect(subject.delete("path", foo: "bar")).to eq(:returned)
81
+ expect(subject.delete("path", { foo: "bar" })).to eq(:returned)
82
82
  end
83
83
  end
84
84
 
@@ -128,12 +128,12 @@ describe Dnsimple::Client do
128
128
 
129
129
  allow(HTTParty).to receive(:get)
130
130
  .with(
131
- "#{subject.base_url}foo",
132
- format: :json,
133
- basic_auth: { username: "user", password: "pass" },
134
- headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
131
+ "#{subject.base_url}foo", {
132
+ format: :json,
133
+ basic_auth: { username: "user", password: "pass" },
134
+ headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT },
135
+ }
135
136
  )
136
- .and_return(instance_double('response', code: 200))
137
137
 
138
138
  subject.request(:get, 'foo')
139
139
  end
@@ -141,14 +141,14 @@ describe Dnsimple::Client do
141
141
  it "properly extracts processes options and encodes data" do
142
142
  allow(HTTParty).to receive(:put)
143
143
  .with(
144
- "#{subject.base_url}foo",
145
- format: :json,
146
- body: JSON.dump(something: "else"),
147
- query: { foo: "bar" },
148
- basic_auth: { username: "user", password: "pass" },
149
- headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT, "Custom" => "Header" }
144
+ "#{subject.base_url}foo", {
145
+ format: :json,
146
+ body: JSON.dump(something: "else"),
147
+ query: { foo: "bar" },
148
+ basic_auth: { username: "user", password: "pass" },
149
+ headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT, "Custom" => "Header" },
150
+ }
150
151
  )
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
@@ -156,13 +156,13 @@ describe Dnsimple::Client do
156
156
  it "handles non application/json content types" do
157
157
  allow(HTTParty).to receive(:post)
158
158
  .with(
159
- "#{subject.base_url}foo",
160
- format: :json,
161
- body: { something: "else" },
162
- basic_auth: { username: "user", password: "pass" },
163
- headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => Dnsimple::Default::USER_AGENT }
159
+ "#{subject.base_url}foo", {
160
+ format: :json,
161
+ body: { something: "else" },
162
+ basic_auth: { username: "user", password: "pass" },
163
+ headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => Dnsimple::Default::USER_AGENT },
164
+ }
164
165
  )
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
@@ -170,13 +170,13 @@ describe Dnsimple::Client do
170
170
  it "includes options for proxy support" do
171
171
  allow(HTTParty).to receive(:get)
172
172
  .with(
173
- "#{subject.base_url}test",
174
- format: :json,
175
- http_proxyaddr: "example-proxy.com",
176
- http_proxyport: "4321",
177
- headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT }
173
+ "#{subject.base_url}test", {
174
+ format: :json,
175
+ http_proxyaddr: "example-proxy.com",
176
+ http_proxyport: "4321",
177
+ headers: { 'Accept' => 'application/json', 'User-Agent' => Dnsimple::Default::USER_AGENT },
178
+ }
178
179
  )
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, {})
@@ -186,10 +186,9 @@ describe Dnsimple::Client do
186
186
  allow(HTTParty).to receive(:get)
187
187
  .with(
188
188
  "#{subject.base_url}test",
189
- format: :json,
190
- headers: hash_including("User-Agent" => "customAgent #{Dnsimple::Default::USER_AGENT}")
189
+ { format: :json,
190
+ headers: hash_including("User-Agent" => "customAgent #{Dnsimple::Default::USER_AGENT}"), }
191
191
  )
192
- .and_return(instance_double("response", code: 200))
193
192
 
194
193
  subject = described_class.new(user_agent: "customAgent")
195
194
  subject.request(:get, "test", nil)
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: 7.1.1
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DNSimple
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -98,6 +98,7 @@ files:
98
98
  - ".rubocop.yml"
99
99
  - ".rubocop_dnsimple.yml"
100
100
  - ".rubocop_todo.yml"
101
+ - ".yamllint.yml"
101
102
  - CHANGELOG.md
102
103
  - CONTRIBUTING.md
103
104
  - Gemfile
@@ -367,14 +368,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
368
  requirements:
368
369
  - - ">="
369
370
  - !ruby/object:Gem::Version
370
- version: '2.6'
371
+ version: '2.7'
371
372
  required_rubygems_version: !ruby/object:Gem::Requirement
372
373
  requirements:
373
374
  - - ">="
374
375
  - !ruby/object:Gem::Version
375
376
  version: '0'
376
377
  requirements: []
377
- rubygems_version: 3.3.3
378
+ rubygems_version: 3.3.7
378
379
  signing_key:
379
380
  specification_version: 4
380
381
  summary: The DNSimple API client for Ruby