dnsimple 2.0.0.alpha4 → 2.0.0.alpha5

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +22 -2
  3. data/UPGRADING.markdown +102 -0
  4. data/lib/dnsimple/client.rb +37 -16
  5. data/lib/dnsimple/client/certificates.rb +9 -7
  6. data/lib/dnsimple/client/contacts.rb +7 -5
  7. data/lib/dnsimple/client/domains.rb +6 -4
  8. data/lib/dnsimple/client/domains_forwards.rb +6 -6
  9. data/lib/dnsimple/client/domains_records.rb +7 -7
  10. data/lib/dnsimple/client/domains_sharing.rb +4 -4
  11. data/lib/dnsimple/client/domains_zones.rb +1 -1
  12. data/lib/dnsimple/client/name_servers.rb +5 -3
  13. data/lib/dnsimple/client/registrar.rb +20 -7
  14. data/lib/dnsimple/client/services.rb +5 -3
  15. data/lib/dnsimple/client/services_domains.rb +4 -4
  16. data/lib/dnsimple/client/templates.rb +8 -6
  17. data/lib/dnsimple/client/templates_records.rb +7 -7
  18. data/lib/dnsimple/error.rb +1 -1
  19. data/lib/dnsimple/version.rb +1 -1
  20. data/spec/dnsimple/client/certificates_spec.rb +20 -20
  21. data/spec/dnsimple/client/contacts_spec.rb +24 -24
  22. data/spec/dnsimple/client/domains_autorenewals_spec.rb +4 -4
  23. data/spec/dnsimple/client/domains_forwards_spec.rb +17 -17
  24. data/spec/dnsimple/client/domains_privacy_spec.rb +4 -4
  25. data/spec/dnsimple/client/domains_records_spec.rb +20 -20
  26. data/spec/dnsimple/client/domains_sharing_spec.rb +12 -12
  27. data/spec/dnsimple/client/domains_spec.rb +14 -14
  28. data/spec/dnsimple/client/domains_zones_spec.rb +2 -2
  29. data/spec/dnsimple/client/name_servers_spec.rb +13 -13
  30. data/spec/dnsimple/client/registrar_spec.rb +48 -6
  31. data/spec/dnsimple/client/services_spec.rb +11 -11
  32. data/spec/dnsimple/client/templates_records_spec.rb +17 -17
  33. data/spec/dnsimple/client/templates_spec.rb +17 -17
  34. data/spec/dnsimple/client_spec.rb +23 -19
  35. data/spec/files/certificates/{show → get}/success.http +0 -0
  36. data/spec/files/certificates/{index → list}/success.http +0 -0
  37. data/spec/files/contacts/{show → get}/success.http +1 -1
  38. data/spec/files/contacts/{index → list}/success.http +1 -1
  39. data/spec/files/domains/{show → get}/success.http +0 -0
  40. data/spec/files/domains/{index → list}/success.http +0 -0
  41. data/spec/files/domains_records/{show → get}/success.http +0 -0
  42. data/spec/files/domains_records/{index → list}/success.http +0 -0
  43. data/spec/files/services/{show → get}/success.http +0 -0
  44. data/spec/files/services/{index → list}/success.http +0 -0
  45. data/spec/files/subscriptions/{show → get}/success.http +0 -0
  46. data/spec/files/templates/{show → get}/success.http +0 -0
  47. data/spec/files/templates/{index → list}/success.http +0 -0
  48. data/spec/files/templates_records/{show → get}/success.http +0 -0
  49. data/spec/files/templates_records/{index → list}/success.http +0 -0
  50. metadata +33 -32
@@ -26,13 +26,13 @@ describe Dnsimple::Client, ".domains / autorenewals" do
26
26
  end
27
27
 
28
28
  context "when the domain does not exist" do
29
- it "raises RecordNotFound" do
29
+ it "raises NotFoundError" do
30
30
  stub_request(:post, %r[/v1]).
31
31
  to_return(read_fixture("domains_autorenewal/notfound-domain.http"))
32
32
 
33
33
  expect {
34
34
  subject.enable_auto_renewal("example.com")
35
- }.to raise_error(Dnsimple::RecordNotFound)
35
+ }.to raise_error(Dnsimple::NotFoundError)
36
36
  end
37
37
  end
38
38
  end
@@ -58,13 +58,13 @@ describe Dnsimple::Client, ".domains / autorenewals" do
58
58
  end
59
59
 
60
60
  context "when the domain does not exist" do
61
- it "raises RecordNotFound" do
61
+ it "raises NotFoundError" do
62
62
  stub_request(:delete, %r[/v1]).
63
63
  to_return(read_fixture("domains_autorenewal/notfound-domain.http"))
64
64
 
65
65
  expect {
66
66
  subject.disable_auto_renewal("example.com")
67
- }.to raise_error(Dnsimple::RecordNotFound)
67
+ }.to raise_error(Dnsimple::NotFoundError)
68
68
  end
69
69
  end
70
70
  end
@@ -5,21 +5,21 @@ describe Dnsimple::Client, ".domains / forwards" do
5
5
  subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").domains }
6
6
 
7
7
 
8
- describe "#list_email_forwards" do
8
+ describe "#email_forwards" do
9
9
  before do
10
- stub_request(:get, %r[/v1/domains/.+/email_forwards]).
10
+ stub_request(:get, %r[/v1/domains/.+/email_forwards$]).
11
11
  to_return(read_fixture("domains_forwards/list/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
- subject.list_email_forwards("example.com")
15
+ subject.email_forwards("example.com")
16
16
 
17
17
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/email_forwards").
18
18
  with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns the records" do
22
- results = subject.list_email_forwards("example.com")
22
+ results = subject.email_forwards("example.com")
23
23
 
24
24
  expect(results).to be_a(Array)
25
25
  expect(results.size).to eq(2)
@@ -31,13 +31,13 @@ describe Dnsimple::Client, ".domains / forwards" do
31
31
  end
32
32
 
33
33
  context "when the domain does not exist" do
34
- it "raises RecordNotFound" do
34
+ it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
36
  to_return(read_fixture("domains_forwards/notfound-domain.http"))
37
37
 
38
38
  expect {
39
- subject.list_email_forwards("example.com")
40
- }.to raise_error(Dnsimple::RecordNotFound)
39
+ subject.email_forwards("example.com")
40
+ }.to raise_error(Dnsimple::NotFoundError)
41
41
  end
42
42
  end
43
43
  end
@@ -64,32 +64,32 @@ describe Dnsimple::Client, ".domains / forwards" do
64
64
  end
65
65
 
66
66
  context "when the domain does not exist" do
67
- it "raises RecordNotFound" do
67
+ it "raises NotFoundError" do
68
68
  stub_request(:post, %r[/v1]).
69
69
  to_return(read_fixture("domains_forwards/notfound-domain.http"))
70
70
 
71
71
  expect {
72
72
  subject.create_email_forward("example.com", { from: "", to: "" })
73
- }.to raise_error(Dnsimple::RecordNotFound)
73
+ }.to raise_error(Dnsimple::NotFoundError)
74
74
  end
75
75
  end
76
76
  end
77
77
 
78
- describe "#find_email_forward" do
78
+ describe "#email_forward" do
79
79
  before do
80
80
  stub_request(:get, %r[/v1/domains/.+/email_forwards/.+$]).
81
81
  to_return(read_fixture("domains_forwards/get/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
85
- subject.find_email_forward("example.com", 2)
85
+ subject.email_forward("example.com", 2)
86
86
 
87
87
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/email_forwards/2").
88
88
  with(headers: { 'Accept' => 'application/json' })
89
89
  end
90
90
 
91
91
  it "returns the record" do
92
- result = subject.find_email_forward("example.com", 2)
92
+ result = subject.email_forward("example.com", 2)
93
93
 
94
94
  expect(result).to be_a(Dnsimple::Struct::EmailForward)
95
95
  expect(result.id).to eq(1)
@@ -101,13 +101,13 @@ describe Dnsimple::Client, ".domains / forwards" do
101
101
  end
102
102
 
103
103
  context "when forward does not exist" do
104
- it "raises RecordNotFound" do
104
+ it "raises NotFoundError" do
105
105
  stub_request(:get, %r[/v1]).
106
106
  to_return(read_fixture("domains_forwards/notfound.http"))
107
107
 
108
108
  expect {
109
- subject.find_email_forward("example.com", 2)
110
- }.to raise_error(Dnsimple::RecordNotFound)
109
+ subject.email_forward("example.com", 2)
110
+ }.to raise_error(Dnsimple::NotFoundError)
111
111
  end
112
112
  end
113
113
  end
@@ -132,13 +132,13 @@ describe Dnsimple::Client, ".domains / forwards" do
132
132
  end
133
133
 
134
134
  context "when the forward does not exist" do
135
- it "raises RecordNotFound" do
135
+ it "raises NotFoundError" do
136
136
  stub_request(:delete, %r[/v1]).
137
137
  to_return(read_fixture("domains_forwards/notfound.http"))
138
138
 
139
139
  expect {
140
140
  subject.delete_email_forward("example.com", 2)
141
- }.to raise_error(Dnsimple::RecordNotFound)
141
+ }.to raise_error(Dnsimple::NotFoundError)
142
142
  end
143
143
  end
144
144
  end
@@ -26,13 +26,13 @@ describe Dnsimple::Client, ".domains / privacy" do
26
26
  end
27
27
 
28
28
  context "when the domain does not exist" do
29
- it "raises RecordNotFound" do
29
+ it "raises NotFoundError" do
30
30
  stub_request(:post, %r[/v1]).
31
31
  to_return(read_fixture("domains_privacy/notfound-domain.http"))
32
32
 
33
33
  expect {
34
34
  subject.enable_whois_privacy("example.com")
35
- }.to raise_error(Dnsimple::RecordNotFound)
35
+ }.to raise_error(Dnsimple::NotFoundError)
36
36
  end
37
37
  end
38
38
  end
@@ -58,13 +58,13 @@ describe Dnsimple::Client, ".domains / privacy" do
58
58
  end
59
59
 
60
60
  context "when the domain does not exist" do
61
- it "raises RecordNotFound" do
61
+ it "raises NotFoundError" do
62
62
  stub_request(:delete, %r[/v1]).
63
63
  to_return(read_fixture("domains_privacy/notfound-domain.http"))
64
64
 
65
65
  expect {
66
66
  subject.disable_whois_privacy("example.com")
67
- }.to raise_error(Dnsimple::RecordNotFound)
67
+ }.to raise_error(Dnsimple::NotFoundError)
68
68
  end
69
69
  end
70
70
  end
@@ -5,21 +5,21 @@ describe Dnsimple::Client, ".domains / records" do
5
5
  subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").domains }
6
6
 
7
7
 
8
- describe "#list_records" do
8
+ describe "#records" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains/.+/records$]).
11
- to_return(read_fixture("domains_records/index/success.http"))
11
+ to_return(read_fixture("domains_records/list/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
- subject.list_records("example.com")
15
+ subject.records("example.com")
16
16
 
17
17
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/records").
18
18
  with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns the records" do
22
- results = subject.list_records("example.com")
22
+ results = subject.records("example.com")
23
23
 
24
24
  expect(results).to be_a(Array)
25
25
  expect(results.size).to eq(7)
@@ -31,13 +31,13 @@ describe Dnsimple::Client, ".domains / records" do
31
31
  end
32
32
 
33
33
  context "when something does not exist" do
34
- it "raises RecordNotFound" do
34
+ it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
36
  to_return(read_fixture("domains_records/notfound.http"))
37
37
 
38
38
  expect {
39
- subject.list_records("example.com")
40
- }.to raise_error(Dnsimple::RecordNotFound)
39
+ subject.records("example.com")
40
+ }.to raise_error(Dnsimple::NotFoundError)
41
41
  end
42
42
  end
43
43
  end
@@ -64,32 +64,32 @@ describe Dnsimple::Client, ".domains / records" do
64
64
  end
65
65
 
66
66
  context "when something does not exist" do
67
- it "raises RecordNotFound" do
67
+ it "raises NotFoundError" do
68
68
  stub_request(:post, %r[/v1]).
69
69
  to_return(read_fixture("domains/notfound.http"))
70
70
 
71
71
  expect {
72
72
  subject.create_record("example.com", { name: "", record_type: "", content: "" })
73
- }.to raise_error(Dnsimple::RecordNotFound)
73
+ }.to raise_error(Dnsimple::NotFoundError)
74
74
  end
75
75
  end
76
76
  end
77
77
 
78
- describe "#find_record" do
78
+ describe "#record" do
79
79
  before do
80
80
  stub_request(:get, %r[/v1/domains/.+/records/.+$]).
81
- to_return(read_fixture("domains_records/show/success.http"))
81
+ to_return(read_fixture("domains_records/get/success.http"))
82
82
  end
83
83
 
84
84
  it "builds the correct request" do
85
- subject.find_record("example.com", 2)
85
+ subject.record("example.com", 2)
86
86
 
87
87
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/records/2").
88
88
  with(headers: { 'Accept' => 'application/json' })
89
89
  end
90
90
 
91
91
  it "returns the record" do
92
- result = subject.find_record("example.com", 2)
92
+ result = subject.record("example.com", 2)
93
93
 
94
94
  expect(result).to be_a(Dnsimple::Struct::Record)
95
95
  expect(result.id).to eq(1495)
@@ -104,13 +104,13 @@ describe Dnsimple::Client, ".domains / records" do
104
104
  end
105
105
 
106
106
  context "when something does not exist" do
107
- it "raises RecordNotFound" do
107
+ it "raises NotFoundError" do
108
108
  stub_request(:get, %r[/v1]).
109
109
  to_return(read_fixture("domains_records/notfound.http"))
110
110
 
111
111
  expect {
112
- subject.find_record("example.com", 2)
113
- }.to raise_error(Dnsimple::RecordNotFound)
112
+ subject.record("example.com", 2)
113
+ }.to raise_error(Dnsimple::NotFoundError)
114
114
  end
115
115
  end
116
116
  end
@@ -137,13 +137,13 @@ describe Dnsimple::Client, ".domains / records" do
137
137
  end
138
138
 
139
139
  context "when something does not exist" do
140
- it "raises RecordNotFound" do
140
+ it "raises NotFoundError" do
141
141
  stub_request(:put, %r[/v1]).
142
142
  to_return(read_fixture("domains_records/notfound.http"))
143
143
 
144
144
  expect {
145
145
  subject.update_record("example.com", 2, {})
146
- }.to raise_error(Dnsimple::RecordNotFound)
146
+ }.to raise_error(Dnsimple::NotFoundError)
147
147
  end
148
148
  end
149
149
  end
@@ -177,13 +177,13 @@ describe Dnsimple::Client, ".domains / records" do
177
177
  end
178
178
 
179
179
  context "when something does not exist" do
180
- it "raises RecordNotFound" do
180
+ it "raises NotFoundError" do
181
181
  stub_request(:delete, %r[/v1]).
182
182
  to_return(read_fixture("domains_records/notfound.http"))
183
183
 
184
184
  expect {
185
185
  subject.delete_record("example.com", 2)
186
- }.to raise_error(Dnsimple::RecordNotFound)
186
+ }.to raise_error(Dnsimple::NotFoundError)
187
187
  end
188
188
  end
189
189
  end
@@ -5,21 +5,21 @@ describe Dnsimple::Client, ".domains / sharing" do
5
5
  subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").domains }
6
6
 
7
7
 
8
- describe "#list_memberships" do
8
+ describe "#memberships" do
9
9
  before do
10
- stub_request(:get, %r[/v1/domains/.+/memberships]).
10
+ stub_request(:get, %r[/v1/domains/.+/memberships$]).
11
11
  to_return(read_fixture("domains_sharing/list/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
- subject.list_memberships("example.com")
15
+ subject.memberships("example.com")
16
16
 
17
17
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/memberships").
18
18
  with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns the records" do
22
- results = subject.list_memberships("example.com")
22
+ results = subject.memberships("example.com")
23
23
 
24
24
  expect(results).to be_a(Array)
25
25
  expect(results.size).to eq(2)
@@ -31,20 +31,20 @@ describe Dnsimple::Client, ".domains / sharing" do
31
31
  end
32
32
 
33
33
  context "when the domain does not exist" do
34
- it "raises RecordNotFound" do
34
+ it "raises NotFoundError" do
35
35
  stub_request(:get, %r[/v1]).
36
36
  to_return(read_fixture("domains_sharing/notfound-domain.http"))
37
37
 
38
38
  expect {
39
- subject.list_memberships("example.com")
40
- }.to raise_error(Dnsimple::RecordNotFound)
39
+ subject.memberships("example.com")
40
+ }.to raise_error(Dnsimple::NotFoundError)
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
45
  describe "#create_membership" do
46
46
  before do
47
- stub_request(:post, %r[/v1/domains/.+/memberships]).
47
+ stub_request(:post, %r[/v1/domains/.+/memberships$]).
48
48
  to_return(read_fixture("domains_sharing/create/success.http"))
49
49
  end
50
50
 
@@ -64,13 +64,13 @@ describe Dnsimple::Client, ".domains / sharing" do
64
64
  end
65
65
 
66
66
  context "when the domain does not exist" do
67
- it "raises RecordNotFound" do
67
+ it "raises NotFoundError" do
68
68
  stub_request(:post, %r[/v1]).
69
69
  to_return(read_fixture("domains_forwards/notfound-domain.http"))
70
70
 
71
71
  expect {
72
72
  subject.create_membership("example.com", "someone@example.com")
73
- }.to raise_error(Dnsimple::RecordNotFound)
73
+ }.to raise_error(Dnsimple::NotFoundError)
74
74
  end
75
75
  end
76
76
  end
@@ -95,13 +95,13 @@ describe Dnsimple::Client, ".domains / sharing" do
95
95
  end
96
96
 
97
97
  context "when the membership does not exist" do
98
- it "raises RecordNotFound" do
98
+ it "raises NotFoundError" do
99
99
  stub_request(:delete, %r[/v1]).
100
100
  to_return(read_fixture("domains_sharing/notfound.http"))
101
101
 
102
102
  expect {
103
103
  subject.delete_membership("example.com", 2)
104
- }.to raise_error(Dnsimple::RecordNotFound)
104
+ }.to raise_error(Dnsimple::NotFoundError)
105
105
  end
106
106
  end
107
107
  end
@@ -5,21 +5,21 @@ describe Dnsimple::Client, ".domains" do
5
5
  subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").domains }
6
6
 
7
7
 
8
- describe "#list" do
8
+ describe "#domains" do
9
9
  before do
10
10
  stub_request(:get, %r[/v1/domains$]).
11
- to_return(read_fixture("domains/index/success.http"))
11
+ to_return(read_fixture("domains/list/success.http"))
12
12
  end
13
13
 
14
14
  it "builds the correct request" do
15
- subject.list
15
+ subject.domains
16
16
 
17
17
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains").
18
18
  with(headers: { 'Accept' => 'application/json' })
19
19
  end
20
20
 
21
21
  it "returns the domains" do
22
- results = subject.list
22
+ results = subject.domains
23
23
 
24
24
  expect(results).to be_a(Array)
25
25
  expect(results.size).to eq(2)
@@ -33,7 +33,7 @@ describe Dnsimple::Client, ".domains" do
33
33
 
34
34
  describe "#create" do
35
35
  before do
36
- stub_request(:post, %r[/v1/domains]).
36
+ stub_request(:post, %r[/v1/domains$]).
37
37
  to_return(read_fixture("domains/create/created.http"))
38
38
  end
39
39
 
@@ -55,21 +55,21 @@ describe Dnsimple::Client, ".domains" do
55
55
  end
56
56
  end
57
57
 
58
- describe "#find" do
58
+ describe "#domain" do
59
59
  before do
60
60
  stub_request(:get, %r[/v1/domains/.+$]).
61
- to_return(read_fixture("domains/show/success.http"))
61
+ to_return(read_fixture("domains/get/success.http"))
62
62
  end
63
63
 
64
64
  it "builds the correct request" do
65
- subject.find("example.com")
65
+ subject.domain("example.com")
66
66
 
67
67
  expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com").
68
68
  with(headers: { 'Accept' => 'application/json' })
69
69
  end
70
70
 
71
71
  it "returns the domain" do
72
- result = subject.find("example.com")
72
+ result = subject.domain("example.com")
73
73
 
74
74
  expect(result).to be_a(Dnsimple::Struct::Domain)
75
75
  expect(result.id).to eq(1)
@@ -85,13 +85,13 @@ describe Dnsimple::Client, ".domains" do
85
85
  end
86
86
 
87
87
  context "when something does not exist" do
88
- it "raises RecordNotFound" do
88
+ it "raises NotFoundError" do
89
89
  stub_request(:get, %r[/v1]).
90
90
  to_return(read_fixture("domains/notfound.http"))
91
91
 
92
92
  expect {
93
- subject.find("example.com")
94
- }.to raise_error(Dnsimple::RecordNotFound)
93
+ subject.domain("example.com")
94
+ }.to raise_error(Dnsimple::NotFoundError)
95
95
  end
96
96
  end
97
97
  end
@@ -125,13 +125,13 @@ describe Dnsimple::Client, ".domains" do
125
125
  end
126
126
 
127
127
  context "when something does not exist" do
128
- it "raises RecordNotFound" do
128
+ it "raises NotFoundError" do
129
129
  stub_request(:delete, %r[/v1]).
130
130
  to_return(read_fixture("domains/notfound.http"))
131
131
 
132
132
  expect {
133
133
  subject.delete("example.com")
134
- }.to raise_error(Dnsimple::RecordNotFound)
134
+ }.to raise_error(Dnsimple::NotFoundError)
135
135
  end
136
136
  end
137
137
  end