dnsimple 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_dnsimple.yml +128 -74
  3. data/.travis.yml +2 -2
  4. data/CHANGELOG.md +9 -0
  5. data/LICENSE.txt +1 -1
  6. data/README.md +1 -1
  7. data/dnsimple.gemspec +2 -2
  8. data/lib/dnsimple/client/certificates.rb +24 -0
  9. data/lib/dnsimple/client/registrar.rb +4 -4
  10. data/lib/dnsimple/version.rb +1 -1
  11. data/spec/dnsimple/client/accounts_spec.rb +4 -4
  12. data/spec/dnsimple/client/certificates_spec.rb +43 -22
  13. data/spec/dnsimple/client/client_service_spec.rb +6 -6
  14. data/spec/dnsimple/client/collaborators_spec.rb +20 -20
  15. data/spec/dnsimple/client/contacts_spec.rb +30 -30
  16. data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +25 -25
  17. data/spec/dnsimple/client/domains_dnssec_spec.rb +18 -18
  18. data/spec/dnsimple/client/domains_email_forwards_spec.rb +25 -25
  19. data/spec/dnsimple/client/domains_pushes_spec.rb +22 -22
  20. data/spec/dnsimple/client/domains_spec.rb +27 -27
  21. data/spec/dnsimple/client/identity_spec.rb +8 -8
  22. data/spec/dnsimple/client/oauth_spec.rb +8 -8
  23. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +12 -12
  24. data/spec/dnsimple/client/registrar_delegation_spec.rb +18 -18
  25. data/spec/dnsimple/client/registrar_spec.rb +37 -37
  26. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +16 -16
  27. data/spec/dnsimple/client/services_domains_spec.rb +13 -13
  28. data/spec/dnsimple/client/services_spec.rb +10 -10
  29. data/spec/dnsimple/client/templates_domains_spec.rb +4 -4
  30. data/spec/dnsimple/client/templates_records_spec.rb +25 -25
  31. data/spec/dnsimple/client/templates_spec.rb +26 -26
  32. data/spec/dnsimple/client/tlds_spec.rb +16 -16
  33. data/spec/dnsimple/client/vanity_name_servers_spec.rb +8 -8
  34. data/spec/dnsimple/client/webhooks_spec.rb +21 -21
  35. data/spec/dnsimple/client/zones_records_spec.rb +40 -40
  36. data/spec/dnsimple/client/zones_spec.rb +18 -18
  37. data/spec/dnsimple/client_spec.rb +25 -25
  38. metadata +3 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af0c0df379377bed93734974abb9af0f682cd75e
4
- data.tar.gz: 250b4394bf6b35d7ea80276ee6b92cc6d90b2d50
3
+ metadata.gz: ebcde22a916ca2575f93426b277d8fb2000da824
4
+ data.tar.gz: d26271208dcf497b132004385a800ff229432287
5
5
  SHA512:
6
- metadata.gz: 075b9ffc70204575a94aec17e36f2bf11c1ba57384162abcbcb6d3daafb3a14a09e429d7a5ee6d87ce5e3800a6bdb72c37fff33c10891b7c335012a8989aa9fd
7
- data.tar.gz: 489c8662934bdb41307a69ca9c972d8534125b707cb51bbe35e13d8b29dc3159062a970400a4dafbf3ea456bd0d07f6709777fd383054eb318f68a58855da13a
6
+ metadata.gz: 68991131ad17ff8d9a7bf14ddf3fed6a2f298668074e39945537478eff76bad1f921db9e90c8b34aa311fda12e19f8267fb208bb7605001f965bb9f65bd73c1e
7
+ data.tar.gz: 2993c7d50cd5a8eaf44a0d15276dc7b0ce6e1374f20be04f62ccac9bd650a7b43d7acfaf8ee7102ac66dc2b91be8baee72a2a297211b2b13039aae3e5ab6b267
@@ -1,8 +1,15 @@
1
+ # Defaults https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+
1
3
  AllCops:
2
4
  Exclude:
3
5
  # Exclude .gemspec files because they are generally auto-generated
4
6
  - '*.gemspec'
5
7
 
8
+ # In most cases, Gems are sorted alphabetically.
9
+ # However, in some few cases the order is relevant due to dependencies.
10
+ Bundler/OrderedGems:
11
+ Enabled: false
12
+
6
13
  # Generally, the keyword style uses a lot of space. This is particularly true when
7
14
  # you use case/if statements, in combination with a long-name variable.
8
15
  #
@@ -16,6 +23,10 @@ AllCops:
16
23
  Lint/EndAlignment:
17
24
  EnforcedStyleAlignWith: variable
18
25
 
26
+ # [codesmell]
27
+ Lint/HandleExceptions:
28
+ Enabled: false
29
+
19
30
  # [codesmell]
20
31
  Metrics/AbcSize:
21
32
  Enabled: false
@@ -93,54 +104,16 @@ Style/BlockDelimiters:
93
104
  IgnoredMethods:
94
105
  - expect
95
106
 
96
- # I'd rather use context_dependent, even if I'm not even sure we should enforce a style.
107
+ # I'm not sure we should enforce a style,
108
+ # but if we do, context_dependent offers a good compromise on readability.
97
109
  Style/BracesAroundHashParameters:
110
+ Enabled: false
98
111
  EnforcedStyle: context_dependent
99
112
 
100
- # For the same reason of EndAlignment, aligning with the case may have a bad impact
101
- # on a case after a very long variable.
102
- #
103
- # invoice_error_message = case error
104
- # when 1 == 1
105
- # do_something
106
- # else
107
- # do_else
108
- # end
109
- #
110
- Style/CaseIndentation:
111
- EnforcedStyle: end
112
-
113
- # I was a big fan of leading, but trailing seems to be more commonly adopted.
114
- # At least at the time being.
115
- Style/DotPosition:
116
- EnforcedStyle: trailing
117
-
118
113
  # Warn on empty else.
119
114
  Style/EmptyElse:
120
115
  EnforcedStyle: empty
121
116
 
122
- # Double empty lines are useful to separate conceptually different methods
123
- # in the same class or module.
124
- Style/EmptyLines:
125
- Enabled: false
126
-
127
- Style/EmptyLinesAroundBlockBody:
128
- Exclude:
129
- # RSpec is all made of blocks. Disable this config in RSpec
130
- # to be consistent with EmptyLinesAroundClassBody and EmptyLinesAroundModuleBody
131
- - 'spec/**/*_spec.rb'
132
- - 'test/**/*_test.rb'
133
-
134
- # In most cases, a space is nice. Sometimes, it's not.
135
- # Just be consistent with the rest of the surrounding code.
136
- Style/EmptyLinesAroundClassBody:
137
- Enabled: false
138
-
139
- # In most cases, a space is nice. Sometimes, it's not.
140
- # Just be consistent with the rest of the surrounding code.
141
- Style/EmptyLinesAroundModuleBody:
142
- Enabled: false
143
-
144
117
  # There is no specific preference for empty methods.
145
118
  # One-line methods are not exceptionally nice in Ruby. Just ignore this cop for now.
146
119
  Style/EmptyMethod:
@@ -152,10 +125,6 @@ Style/EmptyMethod:
152
125
  Style/FormatString:
153
126
  Enabled: false
154
127
 
155
- # Multi-line differs from standard indentation, they are indented twice.
156
- Style/FirstParameterIndentation:
157
- IndentationWidth: 4
158
-
159
128
  # We don't support frozen strings.
160
129
  # This is an experimental feature and we don't know if it will be shipped with
161
130
  # Ruby 3.0 or not.
@@ -174,16 +143,6 @@ Style/HashSyntax:
174
143
  Style/IfUnlessModifier:
175
144
  Enabled: false
176
145
 
177
- # Array indentation should be considered like MultilineMethodCallIndentation indentation
178
- # and use 4 spaces instead of 2.
179
- Style/IndentArray:
180
- IndentationWidth: 4
181
-
182
- # Hash indentation should be considered like MultilineMethodCallIndentation indentation
183
- # and use 4 spaces instead of 2.
184
- Style/IndentHash:
185
- IndentationWidth: 4
186
-
187
146
  # [codesmell]
188
147
  # It's not always that bad.
189
148
  Style/IfInsideElse:
@@ -199,16 +158,6 @@ Style/MultilineBlockChain:
199
158
  # RSpec uses multi-line blocks for certain features
200
159
  - 'spec/**/*_spec.rb'
201
160
 
202
- # Multi-line differs from standard indentation, they are indented twice.
203
- Style/MultilineMethodCallIndentation:
204
- EnforcedStyle: indented
205
- IndentationWidth: 4
206
-
207
- # Multi-line differs from standard indentation, they are indented twice.
208
- Style/MultilineOperationIndentation:
209
- EnforcedStyle: indented
210
- IndentationWidth: 4
211
-
212
161
  # unless is not always cool.
213
162
  Style/NegatedIf:
214
163
  Enabled: false
@@ -221,6 +170,18 @@ Style/NumericLiterals:
221
170
  - 'spec/**/*_spec.rb'
222
171
  - 'test/**/*_test.rb'
223
172
 
173
+ # For years, %w() has been the de-facto standard. A lot of libraries are using ().
174
+ # Switching to [] would be a nightmare.
175
+ Style/PercentLiteralDelimiters:
176
+ Enabled: false
177
+
178
+ # We use it from time to time, as it's not always possible (or maintainable)
179
+ # to use simple ? methods.
180
+ # Moreover, it's actually more efficient to not-use predicates:
181
+ # https://github.com/bbatsov/rubocop/issues/3633
182
+ Style/PredicateName:
183
+ Enabled: false
184
+
224
185
  # Do we care?
225
186
  Style/RegexpLiteral:
226
187
  Enabled: false
@@ -230,15 +191,8 @@ Style/RegexpLiteral:
230
191
  Style/RescueModifier:
231
192
  Enabled: false
232
193
 
233
- # Sorry, but using trailing spaces helps readability.
234
- #
235
- # %w( foo bar )
236
- #
237
- # looks better to me than
238
- #
239
- # %w( foo bar )
240
- #
241
- Style/SpaceInsidePercentLiteralDelimiters:
194
+ # This is quite annoying, especially in cases where we don't control it (e.g. schema.rb).
195
+ Style/SymbolArray:
242
196
  Enabled: false
243
197
 
244
198
  # We don't have a preference.
@@ -252,6 +206,11 @@ Style/StringLiterals:
252
206
  Enabled: false
253
207
  EnforcedStyle: double_quotes
254
208
 
209
+ # As before.
210
+ Style/StringLiteralsInInterpolation:
211
+ Enabled: false
212
+ EnforcedStyle: double_quotes
213
+
255
214
  # It's nice to be consistent. The trailing comma also allows easy reordering,
256
215
  # and doesn't cause a diff in Git when you add a line to the bottom.
257
216
  Style/TrailingCommaInLiteral:
@@ -270,3 +229,98 @@ Style/TrivialAccessors:
270
229
  Style/WordArray:
271
230
  EnforcedStyle: percent
272
231
  MinSize: 3
232
+
233
+ # Forces the order of comparison arguments.
234
+ #
235
+ # According to this cop, the following statement is bad:
236
+ #
237
+ # "https" == uri.scheme
238
+ #
239
+ # Whereas the following is considered good:
240
+ #
241
+ # uri.scheme == "https"
242
+ Style/YodaCondition:
243
+ Enabled: false
244
+
245
+ # For the same reason of EndAlignment, aligning with the case may have a bad impact
246
+ # on a case after a very long variable.
247
+ #
248
+ # invoice_error_message = case error
249
+ # when 1 == 1
250
+ # do_something
251
+ # else
252
+ # do_else
253
+ # end
254
+ #
255
+ Layout/CaseIndentation:
256
+ EnforcedStyle: end
257
+
258
+ # I was a big fan of leading, but trailing seems to be more commonly adopted.
259
+ # At least at the time being.
260
+ Layout/DotPosition:
261
+ EnforcedStyle: leading
262
+
263
+ # Double empty lines are useful to separate conceptually different methods
264
+ # in the same class or module.
265
+ Layout/EmptyLines:
266
+ Enabled: false
267
+
268
+ Layout/EmptyLinesAroundBlockBody:
269
+ Exclude:
270
+ # RSpec is all made of blocks. Disable this config in RSpec
271
+ # to be consistent with EmptyLinesAroundClassBody and EmptyLinesAroundModuleBody
272
+ - 'spec/**/*_spec.rb'
273
+ - 'test/**/*_test.rb'
274
+
275
+ # In most cases, a space is nice. Sometimes, it's not.
276
+ # Just be consistent with the rest of the surrounding code.
277
+ Layout/EmptyLinesAroundClassBody:
278
+ Enabled: false
279
+
280
+ # We're ok with it. We use it quite often for method-level rescue statements.
281
+ Layout/EmptyLinesAroundExceptionHandlingKeywords:
282
+ Enabled: false
283
+
284
+ # In most cases, a space is nice. Sometimes, it's not.
285
+ # Just be consistent with the rest of the surrounding code.
286
+ Layout/EmptyLinesAroundModuleBody:
287
+ Enabled: false
288
+
289
+ # This is quite buggy, as it doesn't recognize double lines.
290
+ Layout/EmptyLineBetweenDefs:
291
+ Enabled: false
292
+
293
+ # Multi-line differs from standard indentation, they are indented twice.
294
+ Layout/FirstParameterIndentation:
295
+ IndentationWidth: 4
296
+
297
+ # Array indentation should be considered like MultilineMethodCallIndentation indentation
298
+ # and use 4 spaces instead of 2.
299
+ Layout/IndentArray:
300
+ IndentationWidth: 4
301
+
302
+ # Hash indentation should be considered like MultilineMethodCallIndentation indentation
303
+ # and use 4 spaces instead of 2.
304
+ Layout/IndentHash:
305
+ IndentationWidth: 4
306
+
307
+ # Multi-line differs from standard indentation, they are indented twice.
308
+ Layout/MultilineMethodCallIndentation:
309
+ EnforcedStyle: indented
310
+ IndentationWidth: 4
311
+
312
+ # Multi-line differs from standard indentation, they are indented twice.
313
+ Layout/MultilineOperationIndentation:
314
+ EnforcedStyle: indented
315
+ IndentationWidth: 4
316
+
317
+ # Sorry, but using trailing spaces helps readability.
318
+ #
319
+ # %w( foo bar )
320
+ #
321
+ # looks better to me than
322
+ #
323
+ # %w( foo bar )
324
+ #
325
+ Layout/SpaceInsidePercentLiteralDelimiters:
326
+ Enabled: false
@@ -4,8 +4,8 @@ rvm:
4
4
  - 2.0
5
5
  - 2.1
6
6
  - 2.2
7
- - 2.3.3
8
- - 2.4.0
7
+ - 2.3.4
8
+ - 2.4.1
9
9
  env: COVERALL=1
10
10
 
11
11
  before_install:
@@ -2,10 +2,19 @@
2
2
 
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
+
6
+ #### 4.3.0
7
+
8
+ - NEW: Added `certificates.all_certificates` (dnsimple/dnsimple-ruby#155)
9
+
10
+ - CHANGED: Updated registrar URLs (dnsimple/dnsimple-ruby#153)
11
+
12
+
5
13
  #### 4.2.0
6
14
 
7
15
  - NEW: Added DNSSEC support support (dnsimple/dnsimple-ruby#152)
8
16
 
17
+
9
18
  #### 4.1.0
10
19
 
11
20
  - NEW: Added domain premium price support (dnsimple/dnsimple-ruby#143)
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2010-2016 Aetrion LLC
3
+ Copyright (c) 2010-2017 Aetrion LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -88,4 +88,4 @@ The value you provide will be appended to the default `User-Agent` the client us
88
88
 
89
89
  ## License
90
90
 
91
- Copyright (c) 2010-2016 Aetrion LLC. This is Free Software distributed under the MIT license.
91
+ Copyright (c) 2010-2017 Aetrion LLC. This is Free Software distributed under the MIT license.
@@ -5,8 +5,8 @@ require 'dnsimple/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'dnsimple'
7
7
  s.version = Dnsimple::VERSION
8
- s.authors = ['Anthony Eden', 'Simone Carletti', 'Javier Acero', 'Joseph Caudle', 'Luca Guidi']
9
- s.email = ['anthony.eden@dnsimple.com', 'simone.carletti@dnsimple.com', 'javier.acero@dnsimple.com', 'joseph.caudle@dnsimple.com', 'luca.guidi@dnsimple.com']
8
+ s.authors = ['Anthony Eden', 'Simone Carletti', 'Javier Acero', 'Luca Guidi']
9
+ s.email = ['anthony.eden@dnsimple.com', 'simone.carletti@dnsimple.com', 'javier.acero@dnsimple.com', 'luca.guidi@dnsimple.com']
10
10
  s.homepage = 'https://github.com/dnsimple/dnsimple-ruby'
11
11
  s.summary = 'The DNSimple API client for Ruby'
12
12
  s.description = 'The DNSimple API client for Ruby.'
@@ -30,6 +30,30 @@ module Dnsimple
30
30
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Certificate.new(r) })
31
31
  end
32
32
 
33
+ # Lists ALL the certificates for the domain.
34
+ #
35
+ # This method is similar to {#certificates}, but instead of returning the results of a specific page
36
+ # it iterates all the pages and returns the entire collection.
37
+ #
38
+ # Please use this method carefully, as fetching the entire collection will increase the number of requests
39
+ # you send to the API server and you may eventually risk to hit the throttle limit.
40
+ #
41
+ # @see https://developer.dnsimple.com/v2/domains/certificates/#list
42
+ # @see #certificates
43
+ #
44
+ # @param [Integer] account_id the account ID
45
+ # @param [#to_s] domain_name The domain ID or domain name
46
+ # @param [Hash] options the filtering and sorting option
47
+ # @option options [Integer] :page current page (pagination)
48
+ # @option options [Integer] :per_page number of entries to return (pagination)
49
+ # @option options [String] :sort sorting policy
50
+ # @return [Dnsimple::CollectionResponse<Dnsimple::Struct::Certificate>]
51
+ #
52
+ # @raise [Dnsimple::RequestError]
53
+ def all_certificates(account_id, domain_name, options = {})
54
+ paginate(:certificates, account_id, domain_name, options)
55
+ end
56
+
33
57
  # Gets a certificate associated to the domain.
34
58
  #
35
59
  # @see https://developer.dnsimple.com/v2/domains/certificates/#get
@@ -65,7 +65,7 @@ module Dnsimple
65
65
  # @raise [RequestError] When the request fails.
66
66
  def register_domain(account_id, domain_name, attributes, options = {})
67
67
  Extra.validate_mandatory_attributes(attributes, [:registrant_id])
68
- endpoint = Client.versioned("/%s/registrar/domains/%s/registration" % [account_id, domain_name])
68
+ endpoint = Client.versioned("/%s/registrar/domains/%s/registrations" % [account_id, domain_name])
69
69
  response = client.post(endpoint, attributes, options)
70
70
 
71
71
  Dnsimple::Response.new(response, Struct::DomainRegistration.new(response["data"]))
@@ -86,7 +86,7 @@ module Dnsimple
86
86
  #
87
87
  # @raise [RequestError] When the request fails.
88
88
  def renew_domain(account_id, domain_name, attributes = nil, options = {})
89
- endpoint = Client.versioned("/%s/registrar/domains/%s/renewal" % [account_id, domain_name])
89
+ endpoint = Client.versioned("/%s/registrar/domains/%s/renewals" % [account_id, domain_name])
90
90
  response = client.post(endpoint, attributes, options)
91
91
 
92
92
  Dnsimple::Response.new(response, Struct::DomainRenewal.new(response["data"]))
@@ -108,7 +108,7 @@ module Dnsimple
108
108
  # @raise [RequestError] When the request fails.
109
109
  def transfer_domain(account_id, domain_name, attributes, options = {})
110
110
  Extra.validate_mandatory_attributes(attributes, [:registrant_id])
111
- endpoint = Client.versioned("/%s/registrar/domains/%s/transfer" % [account_id, domain_name])
111
+ endpoint = Client.versioned("/%s/registrar/domains/%s/transfers" % [account_id, domain_name])
112
112
  response = client.post(endpoint, attributes, options)
113
113
 
114
114
  Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
@@ -128,7 +128,7 @@ module Dnsimple
128
128
  #
129
129
  # @raise [RequestError] When the request fails.
130
130
  def transfer_domain_out(account_id, domain_name, options = {})
131
- endpoint = Client.versioned("/%s/registrar/domains/%s/transfer_out" % [account_id, domain_name])
131
+ endpoint = Client.versioned("/%s/registrar/domains/%s/authorize_transfer_out" % [account_id, domain_name])
132
132
  response = client.post(endpoint, nil, options)
133
133
 
134
134
  Dnsimple::Response.new(response, nil)
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = "4.2.0".freeze
2
+ VERSION = "4.3.0".freeze
3
3
  end
@@ -7,15 +7,15 @@ describe Dnsimple::Client, ".accounts" do
7
7
 
8
8
  describe "#accounts" do
9
9
  before do
10
- stub_request(:get, %r{/v2/accounts$}).
11
- to_return(read_http_fixture("listAccounts/success-user.http"))
10
+ stub_request(:get, %r{/v2/accounts$})
11
+ .to_return(read_http_fixture("listAccounts/success-user.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
15
  subject.accounts
16
16
 
17
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/accounts").
18
- with(headers: { 'Accept' => 'application/json' })
17
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/accounts")
18
+ .with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns the accounts" do
@@ -9,15 +9,15 @@ describe Dnsimple::Client, ".certificates" do
9
9
  let(:domain_id) { "example.com" }
10
10
 
11
11
  before do
12
- stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates}).
13
- to_return(read_http_fixture("listCertificates/success.http"))
12
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates})
13
+ .to_return(read_http_fixture("listCertificates/success.http"))
14
14
  end
15
15
 
16
16
  it "builds the correct request" do
17
17
  subject.certificates(account_id, domain_id)
18
18
 
19
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates").
20
- with(headers: { 'Accept' => 'application/json' })
19
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates")
20
+ .with(headers: { 'Accept' => 'application/json' })
21
21
  end
22
22
 
23
23
  it "supports pagination" do
@@ -56,21 +56,42 @@ describe Dnsimple::Client, ".certificates" do
56
56
  end
57
57
  end
58
58
 
59
+ describe "#all_certificates" do
60
+ before do
61
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates})
62
+ .to_return(read_http_fixture("listCertificates/success.http"))
63
+ end
64
+
65
+ let(:account_id) { 1010 }
66
+ let(:domain_id) { "example.com" }
67
+
68
+ it "delegates to client.paginate" do
69
+ expect(subject).to receive(:paginate).with(:certificates, account_id, domain_id, foo: "bar")
70
+ subject.all_certificates(account_id, domain_id, foo: "bar")
71
+ end
72
+
73
+ it "supports sorting" do
74
+ subject.all_certificates(account_id, domain_id, sort: "id:asc,expires_on:desc")
75
+
76
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates?page=1&per_page=100&sort=id:asc,expires_on:desc")
77
+ end
78
+ end
79
+
59
80
  describe "#certificate" do
60
81
  let(:account_id) { 1010 }
61
82
  let(:domain_id) { "weppos.net" }
62
83
  let(:certificate_id) { 1 }
63
84
 
64
85
  before do
65
- stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}}).
66
- to_return(read_http_fixture("getCertificate/success.http"))
86
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}})
87
+ .to_return(read_http_fixture("getCertificate/success.http"))
67
88
  end
68
89
 
69
90
  it "builds the correct request" do
70
91
  subject.certificate(account_id, domain_id, certificate_id)
71
92
 
72
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}").
73
- with(headers: { 'Accept' => 'application/json' })
93
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}")
94
+ .with(headers: { 'Accept' => 'application/json' })
74
95
  end
75
96
 
76
97
  it "supports extra request options" do
@@ -99,8 +120,8 @@ describe Dnsimple::Client, ".certificates" do
99
120
 
100
121
  context "when the certificate does not exist" do
101
122
  it "raises NotFoundError" do
102
- stub_request(:get, %r{/v2}).
103
- to_return(read_http_fixture("notfound-certificate.http"))
123
+ stub_request(:get, %r{/v2})
124
+ .to_return(read_http_fixture("notfound-certificate.http"))
104
125
 
105
126
  expect {
106
127
  subject.certificate(account_id, domain_id, certificate_id)
@@ -115,15 +136,15 @@ describe Dnsimple::Client, ".certificates" do
115
136
  let(:certificate_id) { 1 }
116
137
 
117
138
  before do
118
- stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/download}).
119
- to_return(read_http_fixture("downloadCertificate/success.http"))
139
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/download})
140
+ .to_return(read_http_fixture("downloadCertificate/success.http"))
120
141
  end
121
142
 
122
143
  it "builds the correct request" do
123
144
  subject.download_certificate(account_id, domain_id, certificate_id)
124
145
 
125
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/download").
126
- with(headers: { 'Accept' => 'application/json' })
146
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/download")
147
+ .with(headers: { 'Accept' => 'application/json' })
127
148
  end
128
149
 
129
150
  it "supports extra request options" do
@@ -146,8 +167,8 @@ describe Dnsimple::Client, ".certificates" do
146
167
 
147
168
  context "when the certificate does not exist" do
148
169
  it "raises NotFoundError" do
149
- stub_request(:get, %r{/v2}).
150
- to_return(read_http_fixture("notfound-certificate.http"))
170
+ stub_request(:get, %r{/v2})
171
+ .to_return(read_http_fixture("notfound-certificate.http"))
151
172
 
152
173
  expect {
153
174
  subject.download_certificate(account_id, domain_id, certificate_id)
@@ -162,15 +183,15 @@ describe Dnsimple::Client, ".certificates" do
162
183
  let(:certificate_id) { 1 }
163
184
 
164
185
  before do
165
- stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/private_key}).
166
- to_return(read_http_fixture("getCertificatePrivateKey/success.http"))
186
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/private_key})
187
+ .to_return(read_http_fixture("getCertificatePrivateKey/success.http"))
167
188
  end
168
189
 
169
190
  it "builds the correct request" do
170
191
  subject.certificate_private_key(account_id, domain_id, certificate_id)
171
192
 
172
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/private_key").
173
- with(headers: { 'Accept' => 'application/json' })
193
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/certificates/#{certificate_id}/private_key")
194
+ .with(headers: { 'Accept' => 'application/json' })
174
195
  end
175
196
 
176
197
  it "supports extra request options" do
@@ -193,8 +214,8 @@ describe Dnsimple::Client, ".certificates" do
193
214
 
194
215
  context "when the certificate does not exist" do
195
216
  it "raises NotFoundError" do
196
- stub_request(:get, %r{/v2}).
197
- to_return(read_http_fixture("notfound-certificate.http"))
217
+ stub_request(:get, %r{/v2})
218
+ .to_return(read_http_fixture("notfound-certificate.http"))
198
219
 
199
220
  expect {
200
221
  subject.certificate_private_key(account_id, domain_id, certificate_id)