dnsimple 3.0.0.pre.beta2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +13 -0
  3. data/.rubocop_dnsimple.yml +216 -0
  4. data/.rubocop_todo.yml +14 -0
  5. data/CHANGELOG.md +16 -1
  6. data/Gemfile +1 -0
  7. data/Rakefile +8 -3
  8. data/lib/dnsimple/client.rb +9 -12
  9. data/lib/dnsimple/client/clients.rb +36 -2
  10. data/lib/dnsimple/client/contacts.rb +6 -6
  11. data/lib/dnsimple/client/domains.rb +5 -5
  12. data/lib/dnsimple/client/identity.rb +2 -2
  13. data/lib/dnsimple/client/oauth.rb +2 -2
  14. data/lib/dnsimple/client/registrar.rb +1 -1
  15. data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -2
  16. data/lib/dnsimple/client/registrar_delegation.rb +49 -0
  17. data/lib/dnsimple/client/registrar_whois_privacy.rb +1 -1
  18. data/lib/dnsimple/client/services.rb +68 -0
  19. data/lib/dnsimple/client/templates.rb +139 -0
  20. data/lib/dnsimple/client/tlds.rb +3 -3
  21. data/lib/dnsimple/client/webhooks.rb +4 -4
  22. data/lib/dnsimple/client/zones.rb +2 -2
  23. data/lib/dnsimple/client/zones_records.rb +1 -1
  24. data/lib/dnsimple/default.rb +2 -2
  25. data/lib/dnsimple/error.rb +14 -1
  26. data/lib/dnsimple/struct.rb +3 -1
  27. data/lib/dnsimple/struct/contact.rb +2 -2
  28. data/lib/dnsimple/struct/extended_attribute.rb +5 -1
  29. data/lib/dnsimple/struct/service.rb +64 -0
  30. data/lib/dnsimple/struct/template.rb +22 -0
  31. data/lib/dnsimple/struct/tld.rb +1 -1
  32. data/lib/dnsimple/version.rb +1 -1
  33. data/spec/dnsimple/client/client_service_spec.rb +6 -6
  34. data/spec/dnsimple/client/contacts_spec.rb +30 -30
  35. data/spec/dnsimple/client/domains_email_forwards_spec.rb +25 -25
  36. data/spec/dnsimple/client/domains_spec.rb +27 -27
  37. data/spec/dnsimple/client/identity_spec.rb +8 -8
  38. data/spec/dnsimple/client/oauth_spec.rb +9 -9
  39. data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +13 -13
  40. data/spec/dnsimple/client/registrar_delegation_spec.rb +55 -0
  41. data/spec/dnsimple/client/registrar_spec.rb +29 -29
  42. data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +16 -16
  43. data/spec/dnsimple/client/services_spec.rb +78 -0
  44. data/spec/dnsimple/client/templates_spec.rb +163 -0
  45. data/spec/dnsimple/client/tlds_spec.rb +22 -23
  46. data/spec/dnsimple/client/webhooks_spec.rb +22 -22
  47. data/spec/dnsimple/client/zones_records_spec.rb +40 -40
  48. data/spec/dnsimple/client/zones_spec.rb +12 -12
  49. data/spec/dnsimple/client_spec.rb +52 -44
  50. data/spec/dnsimple/extra_spec.rb +3 -3
  51. data/spec/fixtures.http/changeDomainDelegation/success.http +17 -0
  52. data/spec/fixtures.http/createTemplate/created.http +17 -0
  53. data/spec/fixtures.http/deleteTemplate/success.http +13 -0
  54. data/spec/fixtures.http/getDomainDelegation/success-empty.http +17 -0
  55. data/spec/fixtures.http/getDomainDelegation/success.http +17 -0
  56. data/spec/fixtures.http/getService/success.http +17 -0
  57. data/spec/fixtures.http/getTemplate/success.http +17 -0
  58. data/spec/fixtures.http/listServices/success.http +17 -0
  59. data/spec/fixtures.http/listTemplates/success.http +17 -0
  60. data/spec/fixtures.http/method-not-allowed.http +11 -0
  61. data/spec/fixtures.http/updateTemplate/success.http +17 -0
  62. metadata +41 -5
@@ -23,8 +23,8 @@ module Dnsimple
23
23
 
24
24
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Zone.new(r) })
25
25
  end
26
- alias :list :zones
27
- alias :list_zones :zones
26
+ alias list zones
27
+ alias list_zones zones
28
28
 
29
29
  # Lists ALL the zones in the account.
30
30
  #
@@ -24,7 +24,7 @@ module Dnsimple
24
24
 
25
25
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Record.new(r) })
26
26
  end
27
- alias :list_records :records
27
+ alias list_records records
28
28
 
29
29
  # Lists ALL the zone records in the account.
30
30
  #
@@ -7,7 +7,7 @@ module Dnsimple
7
7
  BASE_URL = "https://api.dnsimple.com/".freeze
8
8
 
9
9
  # Default User Agent header
10
- USER_AGENT = "dnsimple-ruby/#{VERSION}".freeze
10
+ USER_AGENT = "dnsimple-ruby/#{VERSION}".freeze
11
11
 
12
12
  class << self
13
13
 
@@ -28,7 +28,7 @@ module Dnsimple
28
28
  # Configuration options
29
29
  # @return [Hash]
30
30
  def options
31
- Hash[keys.map { |key| [key, send(key)]}]
31
+ Hash[keys.map { |key| [key, send(key)] }]
32
32
  end
33
33
 
34
34
  # Default API endpoint from ENV or {BASE_URL}
@@ -9,8 +9,21 @@ module Dnsimple
9
9
 
10
10
  def initialize(http_response)
11
11
  @http_response = http_response
12
- super(http_response.code.to_s)
12
+ super(message_from(http_response))
13
13
  end
14
+
15
+ private
16
+
17
+ def message_from(http_response)
18
+ content_type = http_response.headers["Content-Type"]
19
+ if content_type && content_type.start_with?("application/json")
20
+ http_response.parsed_response["message"]
21
+ else
22
+ net_http_response = http_response.response
23
+ "#{net_http_response.code} #{net_http_response.message}"
24
+ end
25
+ end
26
+
14
27
  end
15
28
 
16
29
  class NotFoundError < RequestError
@@ -5,7 +5,7 @@ module Dnsimple
5
5
  def initialize(attributes = {})
6
6
  attributes.each do |key, value|
7
7
  m = "#{key}=".to_sym
8
- self.send(m, value) if self.respond_to?(m)
8
+ send(m, value) if respond_to?(m)
9
9
  end
10
10
  end
11
11
  end
@@ -21,6 +21,8 @@ require_relative 'struct/email_forward'
21
21
  require_relative 'struct/extended_attribute'
22
22
  require_relative 'struct/oauth_token'
23
23
  require_relative 'struct/record'
24
+ require_relative 'struct/service'
25
+ require_relative 'struct/template'
24
26
  require_relative 'struct/tld'
25
27
  require_relative 'struct/user'
26
28
  require_relative 'struct/whois_privacy'
@@ -56,8 +56,8 @@ module Dnsimple
56
56
  # @return [String] When the contact was last updated in DNSimple.
57
57
  attr_accessor :updated_at
58
58
 
59
- alias :email_address :email
60
- alias :email_address= :email=
59
+ alias email_address email
60
+ alias email_address= email=
61
61
  end
62
62
 
63
63
  end
@@ -23,7 +23,11 @@ module Dnsimple
23
23
  # Boolean indicating if the extended attribute is required
24
24
  attr_accessor :required
25
25
 
26
- def options
26
+ # @return [Array<Options>] The array of options with possible values for the extended attribute
27
+ attr_accessor :options
28
+
29
+ def initialize(*)
30
+ super
27
31
  @options ||= []
28
32
  end
29
33
 
@@ -0,0 +1,64 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class Service < Base
5
+
6
+ class Setting < Base
7
+ # @return [String] The setting name.
8
+ attr_accessor :name
9
+
10
+ # @return [String] The setting label.
11
+ attr_accessor :label
12
+
13
+ # @return [String] A suffix to be appended to the setting value.
14
+ attr_accessor :append
15
+
16
+ # @return [String] The setting description.
17
+ attr_accessor :description
18
+
19
+ # @return [String] An example of the setting value.
20
+ attr_accessor :example
21
+
22
+ # @return [Boolean] Whether the setting requires a password.
23
+ attr_accessor :password
24
+ end
25
+
26
+ # @return [Fixnum] The service ID in DNSimple.
27
+ attr_accessor :id
28
+
29
+ # @return [String] The service name.
30
+ attr_accessor :name
31
+
32
+ # @return [String] A short name for the service.
33
+ attr_accessor :short_name
34
+
35
+ # @return [String] The service description.
36
+ attr_accessor :description
37
+
38
+ # @return [String] The service setup description.
39
+ attr_accessor :setup_description
40
+
41
+ # @return [Boolean] Whether the service requires extra setup.
42
+ attr_accessor :requires_setup
43
+
44
+ # @return [String] The default subdomain where the service will be applied.
45
+ attr_accessor :default_subdomain
46
+
47
+ # @return [Array<Settings>] The array of settings to setup this service, if setup is required.
48
+ attr_accessor :settings
49
+
50
+ def initialize(*)
51
+ super
52
+ @settings ||= []
53
+ end
54
+
55
+ def settings=(settings)
56
+ @settings = settings.map do |setting|
57
+ Setting.new(setting)
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,22 @@
1
+ module Dnsimple
2
+ module Struct
3
+
4
+ class Template < Base
5
+ # @return [Fixnum] The template ID in DNSimple.
6
+ attr_accessor :id
7
+
8
+ # @return [Fixnum] The associated account ID.
9
+ attr_accessor :account_id
10
+
11
+ # @return [String] The template name.
12
+ attr_accessor :name
13
+
14
+ # @return [String] The short name for the template.
15
+ attr_accessor :short_name
16
+
17
+ # @return [String] The template description.
18
+ attr_accessor :description
19
+ end
20
+
21
+ end
22
+ end
@@ -7,7 +7,7 @@ module Dnsimple
7
7
 
8
8
  # @return [Fixnum] The TLD type.
9
9
  attr_accessor :tld_type
10
-
10
+
11
11
  # @return [Boolean] True if Whois Privacy Protection is available.
12
12
  attr_accessor :whois_privacy
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = "3.0.0-beta2"
2
+ VERSION = "3.0.0".freeze
3
3
  end
@@ -19,12 +19,12 @@ describe Dnsimple::Client::ClientService do
19
19
  let(:account_id) { 1010 }
20
20
 
21
21
  before do
22
- stub_request(:get, %r[/v2/#{account_id}/list\?page=1&per_page=100])
23
- .to_return(read_http_fixture("pages-1of3.http"))
24
- stub_request(:get, %r[/v2/#{account_id}/list\?page=2&per_page=100])
25
- .to_return(read_http_fixture("pages-2of3.http"))
26
- stub_request(:get, %r[/v2/#{account_id}/list\?page=3&per_page=100])
27
- .to_return(read_http_fixture("pages-3of3.http"))
22
+ stub_request(:get, %r{/v2/#{account_id}/list\?page=1&per_page=100}).
23
+ to_return(read_http_fixture("pages-1of3.http"))
24
+ stub_request(:get, %r{/v2/#{account_id}/list\?page=2&per_page=100}).
25
+ to_return(read_http_fixture("pages-2of3.http"))
26
+ stub_request(:get, %r{/v2/#{account_id}/list\?page=3&per_page=100}).
27
+ to_return(read_http_fixture("pages-3of3.http"))
28
28
  end
29
29
 
30
30
  it "loops all the pages" do
@@ -9,15 +9,15 @@ describe Dnsimple::Client, ".contacts" do
9
9
  let(:account_id) { 1010 }
10
10
 
11
11
  before do
12
- stub_request(:get, %r[/v2/#{account_id}/contacts])
13
- .to_return(read_http_fixture("listContacts/success.http"))
12
+ stub_request(:get, %r{/v2/#{account_id}/contacts}).
13
+ to_return(read_http_fixture("listContacts/success.http"))
14
14
  end
15
15
 
16
16
  it "builds the correct request" do
17
17
  subject.contacts(account_id)
18
18
 
19
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/contacts")
20
- .with(headers: { 'Accept' => 'application/json' })
19
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/contacts").
20
+ with(headers: { 'Accept' => 'application/json' })
21
21
  end
22
22
 
23
23
  it "supports pagination" do
@@ -60,8 +60,8 @@ describe Dnsimple::Client, ".contacts" do
60
60
  let(:account_id) { 1010 }
61
61
 
62
62
  it "delegates to client.paginate" do
63
- expect(subject).to receive(:paginate).with(:contacts, account_id, { foo: "bar" })
64
- subject.all_contacts(account_id, { foo: "bar" })
63
+ expect(subject).to receive(:paginate).with(:contacts, account_id, foo: "bar")
64
+ subject.all_contacts(account_id, foo: "bar")
65
65
  end
66
66
  end
67
67
 
@@ -69,8 +69,8 @@ describe Dnsimple::Client, ".contacts" do
69
69
  let(:account_id) { 1010 }
70
70
 
71
71
  before do
72
- stub_request(:post, %r[/v2/#{account_id}/contacts$])
73
- .to_return(read_http_fixture("createContact/created.http"))
72
+ stub_request(:post, %r{/v2/#{account_id}/contacts$}).
73
+ to_return(read_http_fixture("createContact/created.http"))
74
74
  end
75
75
 
76
76
  let(:attributes) { { first_name: "Simone", last_name: "Carletti", address1: "Italian Street", city: "Rome", state_province: "RM", postal_code: "00171", country: "IT", email_address: "example@example.com", phone: "+393391234567" } }
@@ -78,9 +78,9 @@ describe Dnsimple::Client, ".contacts" do
78
78
  it "builds the correct request" do
79
79
  subject.create_contact(account_id, attributes)
80
80
 
81
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/contacts")
82
- .with(body: attributes)
83
- .with(headers: { 'Accept' => 'application/json' })
81
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/contacts").
82
+ with(body: attributes).
83
+ with(headers: { 'Accept' => 'application/json' })
84
84
  end
85
85
 
86
86
  it "returns the contact" do
@@ -97,15 +97,15 @@ describe Dnsimple::Client, ".contacts" do
97
97
  let(:account_id) { 1010 }
98
98
 
99
99
  before do
100
- stub_request(:get, %r[/v2/#{account_id}/contacts/.+$])
101
- .to_return(read_http_fixture("getContact/success.http"))
100
+ stub_request(:get, %r{/v2/#{account_id}/contacts/.+$}).
101
+ to_return(read_http_fixture("getContact/success.http"))
102
102
  end
103
103
 
104
104
  it "builds the correct request" do
105
105
  subject.contact(account_id, contact = 1)
106
106
 
107
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{contact}")
108
- .with(headers: { 'Accept' => 'application/json' })
107
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{contact}").
108
+ with(headers: { 'Accept' => 'application/json' })
109
109
  end
110
110
 
111
111
  it "returns the contact" do
@@ -122,8 +122,8 @@ describe Dnsimple::Client, ".contacts" do
122
122
 
123
123
  context "when the contact does not exist" do
124
124
  it "raises NotFoundError" do
125
- stub_request(:get, %r[/v2])
126
- .to_return(read_http_fixture("notfound-contact.http"))
125
+ stub_request(:get, %r{/v2}).
126
+ to_return(read_http_fixture("notfound-contact.http"))
127
127
 
128
128
  expect {
129
129
  subject.contact(account_id, 0)
@@ -136,8 +136,8 @@ describe Dnsimple::Client, ".contacts" do
136
136
  let(:account_id) { 1010 }
137
137
 
138
138
  before do
139
- stub_request(:patch, %r[/v2/#{account_id}/contacts/.+$])
140
- .to_return(read_http_fixture("updateContact/success.http"))
139
+ stub_request(:patch, %r{/v2/#{account_id}/contacts/.+$}).
140
+ to_return(read_http_fixture("updateContact/success.http"))
141
141
  end
142
142
 
143
143
  let(:attributes) { { first_name: "Updated" } }
@@ -145,9 +145,9 @@ describe Dnsimple::Client, ".contacts" do
145
145
  it "builds the correct request" do
146
146
  subject.update_contact(account_id, contact_id = 1, attributes)
147
147
 
148
- expect(WebMock).to have_requested(:patch, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{contact_id}")
149
- .with(body: attributes)
150
- .with(headers: { 'Accept' => 'application/json' })
148
+ expect(WebMock).to have_requested(:patch, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{contact_id}").
149
+ with(body: attributes).
150
+ with(headers: { 'Accept' => 'application/json' })
151
151
  end
152
152
 
153
153
  it "returns the contact" do
@@ -161,8 +161,8 @@ describe Dnsimple::Client, ".contacts" do
161
161
 
162
162
  context "when the contact does not exist" do
163
163
  it "raises NotFoundError" do
164
- stub_request(:patch, %r[/v2])
165
- .to_return(read_http_fixture("notfound-contact.http"))
164
+ stub_request(:patch, %r{/v2}).
165
+ to_return(read_http_fixture("notfound-contact.http"))
166
166
 
167
167
  expect {
168
168
  subject.update_contact(account_id, 0, {})
@@ -175,15 +175,15 @@ describe Dnsimple::Client, ".contacts" do
175
175
  let(:account_id) { 1010 }
176
176
 
177
177
  before do
178
- stub_request(:delete, %r[/v2/#{account_id}/contacts/.+$])
179
- .to_return(read_http_fixture("deleteContact/success.http"))
178
+ stub_request(:delete, %r{/v2/#{account_id}/contacts/.+$}).
179
+ to_return(read_http_fixture("deleteContact/success.http"))
180
180
  end
181
181
 
182
182
  it "builds the correct request" do
183
183
  subject.delete_contact(account_id, domain = "example.com")
184
184
 
185
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{domain}")
186
- .with(headers: { 'Accept' => 'application/json' })
185
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/contacts/#{domain}").
186
+ with(headers: { 'Accept' => 'application/json' })
187
187
  end
188
188
 
189
189
  it "returns nothing" do
@@ -196,8 +196,8 @@ describe Dnsimple::Client, ".contacts" do
196
196
 
197
197
  context "when the contact does not exist" do
198
198
  it "raises NotFoundError" do
199
- stub_request(:delete, %r[/v2])
200
- .to_return(read_http_fixture("notfound-contact.http"))
199
+ stub_request(:delete, %r{/v2}).
200
+ to_return(read_http_fixture("notfound-contact.http"))
201
201
 
202
202
  expect {
203
203
  subject.delete_contact(account_id, 0)
@@ -10,15 +10,15 @@ describe Dnsimple::Client, ".domains" do
10
10
  let(:domain_id) { "example.com" }
11
11
 
12
12
  before do
13
- stub_request(:get, %r[/v2/#{account_id}/domains/#{domain_id}/email_forwards])
14
- .to_return(read_http_fixture("listEmailForwards/success.http"))
13
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards}).
14
+ to_return(read_http_fixture("listEmailForwards/success.http"))
15
15
  end
16
16
 
17
17
  it "builds the correct request" do
18
18
  subject.email_forwards(account_id, domain_id)
19
19
 
20
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
21
- .with(headers: { 'Accept' => 'application/json' })
20
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards").
21
+ with(headers: { 'Accept' => 'application/json' })
22
22
  end
23
23
 
24
24
  it "supports pagination" do
@@ -58,8 +58,8 @@ describe Dnsimple::Client, ".domains" do
58
58
 
59
59
  context "when the domain does not exist" do
60
60
  it "raises NotFoundError" do
61
- stub_request(:get, %r[/v2])
62
- .to_return(read_http_fixture("notfound-domain.http"))
61
+ stub_request(:get, %r{/v2}).
62
+ to_return(read_http_fixture("notfound-domain.http"))
63
63
 
64
64
  expect {
65
65
  subject.email_forwards(account_id, domain_id)
@@ -73,8 +73,8 @@ describe Dnsimple::Client, ".domains" do
73
73
  let(:domain_id) { "example.com" }
74
74
 
75
75
  it "delegates to client.paginate" do
76
- expect(subject).to receive(:paginate).with(:email_forwards, account_id, domain_id, { foo: "bar" })
77
- subject.all_email_forwards(account_id, domain_id, { foo: "bar" })
76
+ expect(subject).to receive(:paginate).with(:email_forwards, account_id, domain_id, foo: "bar")
77
+ subject.all_email_forwards(account_id, domain_id, foo: "bar")
78
78
  end
79
79
  end
80
80
 
@@ -83,8 +83,8 @@ describe Dnsimple::Client, ".domains" do
83
83
  let(:domain_id) { "example.com" }
84
84
 
85
85
  before do
86
- stub_request(:post, %r[/v2/#{account_id}/domains/#{domain_id}/email_forwards$])
87
- .to_return(read_http_fixture("createEmailForward/created.http"))
86
+ stub_request(:post, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards$}).
87
+ to_return(read_http_fixture("createEmailForward/created.http"))
88
88
  end
89
89
 
90
90
  let(:attributes) { { from: "jim", to: "jim@another.com" } }
@@ -92,9 +92,9 @@ describe Dnsimple::Client, ".domains" do
92
92
  it "builds the correct request" do
93
93
  subject.create_email_forward(account_id, domain_id, attributes)
94
94
 
95
- expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards")
96
- .with(body: attributes)
97
- .with(headers: { 'Accept' => 'application/json' })
95
+ expect(WebMock).to have_requested(:post, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards").
96
+ with(body: attributes).
97
+ with(headers: { 'Accept' => 'application/json' })
98
98
  end
99
99
 
100
100
  it "returns the email forward" do
@@ -113,15 +113,15 @@ describe Dnsimple::Client, ".domains" do
113
113
  let(:email_forward_id) { 17706 }
114
114
 
115
115
  before do
116
- stub_request(:get, %r[/v2/#{account_id}/domains/#{domain_id}/email_forwards.+$])
117
- .to_return(read_http_fixture("getEmailForward/success.http"))
116
+ stub_request(:get, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards.+$}).
117
+ to_return(read_http_fixture("getEmailForward/success.http"))
118
118
  end
119
119
 
120
120
  it "builds the correct request" do
121
121
  subject.email_forward(account_id, domain_id, email_forward_id)
122
122
 
123
- expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
124
- .with(headers: { 'Accept' => 'application/json' })
123
+ expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}").
124
+ with(headers: { 'Accept' => 'application/json' })
125
125
  end
126
126
 
127
127
  it "returns the email forward" do
@@ -140,8 +140,8 @@ describe Dnsimple::Client, ".domains" do
140
140
 
141
141
  context "when the email forward does not exist" do
142
142
  it "raises NotFoundError" do
143
- stub_request(:get, %r[/v2])
144
- .to_return(read_http_fixture("notfound-emailforward.http"))
143
+ stub_request(:get, %r{/v2}).
144
+ to_return(read_http_fixture("notfound-emailforward.http"))
145
145
 
146
146
  expect {
147
147
  subject.email_forward(account_id, domain_id, email_forward_id)
@@ -156,15 +156,15 @@ describe Dnsimple::Client, ".domains" do
156
156
  let(:email_forward_id) { 1 }
157
157
 
158
158
  before do
159
- stub_request(:delete, %r[/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}$])
160
- .to_return(read_http_fixture("deleteEmailForward/success.http"))
159
+ stub_request(:delete, %r{/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}$}).
160
+ to_return(read_http_fixture("deleteEmailForward/success.http"))
161
161
  end
162
162
 
163
163
  it "builds the correct request" do
164
164
  subject.delete_email_forward(account_id, domain_id, email_forward_id)
165
165
 
166
- expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}")
167
- .with(headers: { 'Accept' => 'application/json' })
166
+ expect(WebMock).to have_requested(:delete, "https://api.dnsimple.test/v2/#{account_id}/domains/#{domain_id}/email_forwards/#{email_forward_id}").
167
+ with(headers: { 'Accept' => 'application/json' })
168
168
  end
169
169
 
170
170
  it "returns nothing" do
@@ -177,8 +177,8 @@ describe Dnsimple::Client, ".domains" do
177
177
 
178
178
  context "when the email forward does not exist" do
179
179
  it "raises NotFoundError" do
180
- stub_request(:delete, %r[/v2])
181
- .to_return(read_http_fixture("notfound-emailforward.http"))
180
+ stub_request(:delete, %r{/v2}).
181
+ to_return(read_http_fixture("notfound-emailforward.http"))
182
182
 
183
183
  expect {
184
184
  subject.delete_email_forward(account_id, domain_id, email_forward_id)