splicer-dynect 1.2.4 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,6 +23,19 @@ Splicer.configure do |config|
23
23
  end
24
24
  ```
25
25
 
26
+ ## Testing
27
+
28
+ In order for the tests to work, your api credentials will need to be put into
29
+ `spec/keys.yml` with the following format:
30
+
31
+ ```yaml
32
+ CUSTOMER: 'customername'
33
+ USERNAME: 'username'
34
+ PASSWORD: 'password'
35
+ ```
36
+
37
+ This file is on the `.gitignore` list and **should not** be pushed to the repo.
38
+ If you do not provide your keys, the acceptance tests will be skipped.
26
39
 
27
40
  ## Contributing
28
41
 
@@ -15,10 +15,6 @@ module Splicer
15
15
  def provider
16
16
  Provider.new(self)
17
17
  end
18
-
19
- def client
20
- Client.new(customer, username, password)
21
- end
22
18
  end
23
19
 
24
20
  end
@@ -2,12 +2,11 @@ module Splicer
2
2
  module Dynect
3
3
 
4
4
  # @author Matthew A. Johnston <warmwaffles@gmail.com>
5
- class Provider < Splicer::Provider
5
+ class Provider
6
6
  attr_reader :client
7
7
 
8
8
  def initialize(config)
9
- @config = config
10
- @client = config.client
9
+ @client = Client.new(config.customer, config.username, config.password)
11
10
  end
12
11
 
13
12
  def create_zone(zone)
@@ -39,12 +38,6 @@ module Splicer
39
38
  client.logout
40
39
  end
41
40
 
42
- def rewrite_zone(zone)
43
- Splicer.logger.debug "[SPLICER][DYNECT] #rewrite_zone zone=#{zone.inspect}"
44
- delete_zone(zone)
45
- create_zone(zone)
46
- end
47
-
48
41
  def delete_zone(zone)
49
42
  Splicer.logger.debug "[SPLICER][DYNECT] #delete_zone zone=#{zone.inspect}"
50
43
  client.login
@@ -60,10 +53,9 @@ module Splicer
60
53
 
61
54
  def delete_record_in_zone(record, zone)
62
55
  Splicer.logger.debug "[SPLICER][DYNECT] #delete_record_in_zone record=#{record.inspect} zone=#{zone.inspect}"
56
+ return false unless can_delete?(record)
63
57
  client.login
64
58
  id = find_record_id(record, zone)
65
- return false unless id
66
-
67
59
  url = record_resource_url(record, zone).concat("/#{id}")
68
60
  client.delete(url)
69
61
  publish_zone(zone)
@@ -73,6 +65,7 @@ module Splicer
73
65
 
74
66
  def update_record_in_zone(record, zone)
75
67
  Splicer.logger.debug "[SPLICER][DYNECT] #update_record_in_zone record=#{record.inspect} zone=#{zone.inspect}"
68
+ return false unless can_update?(record)
76
69
  client.login
77
70
  update_record(record, zone)
78
71
  publish_zone(zone)
@@ -91,6 +84,13 @@ module Splicer
91
84
 
92
85
  private
93
86
 
87
+ # TODO: Currently MX Record deleting/updating is not supported
88
+ def can_update?(record)
89
+ !record.is_a?(Splicer::Records::TXTRecord) && !record.is_a?(Splicer::Records::MXRecord)
90
+ end
91
+
92
+ alias_method :can_delete?, :can_update?
93
+
94
94
  def get_zone(zone)
95
95
  client.get "Zone/#{zone.name}"
96
96
  end
@@ -102,7 +102,7 @@ module Splicer
102
102
  def find_record_id(record, zone)
103
103
  resources = client.get(record_resource_url(record, zone))
104
104
  if resources['data'].empty?
105
- return false
105
+ raise Splicer::Errors::RequestError.new('record not found')
106
106
  else
107
107
  resources['data'].first.split('/').last
108
108
  end
@@ -1,5 +1,5 @@
1
1
  module Splicer
2
2
  module Dynect
3
- VERSION = "1.2.4"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
data/spec/.gitignore ADDED
@@ -0,0 +1 @@
1
+ keys.yml
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Creating a CNAME record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::CNAMERecord.new('www', domain) }
12
+
13
+ context 'when the zone exists' do
14
+ before do
15
+ provider.create_zone(zone)
16
+ client.login
17
+ begin
18
+ client.get "Zone/#{zone.name}"
19
+ break
20
+ rescue
21
+ sleep(1)
22
+ retry
23
+ end while true
24
+ client.logout
25
+ end
26
+
27
+ after do
28
+ provider.delete_zone(zone)
29
+ client.login
30
+ begin
31
+ client.get "Zone/#{zone.name}"
32
+ sleep(1)
33
+ rescue
34
+ break
35
+ end while true
36
+ client.logout
37
+ end
38
+
39
+ context 'when the zone has no other records' do
40
+ it 'should be successful' do
41
+ provider.create_record_in_zone(record, zone)
42
+
43
+ client.login
44
+ expect {
45
+ client.get "CNAMERecord/#{domain}/www.#{domain}"
46
+ }.to_not raise_error(Splicer::Errors::RequestError)
47
+ client.logout
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when the zone does not exist' do
53
+ let(:zone) { Splicer::Zone.new(domain) }
54
+
55
+ it 'should be successful' do
56
+ expect {
57
+ provider.create_record_in_zone(record, zone)
58
+ }.to raise_error(Splicer::Errors::RequestError)
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Creating a TXT record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::TXTRecord.new(nil, 'v=spf1 a mx include:_spf.google.com ~all') }
12
+
13
+ context 'when the zone exists' do
14
+ before do
15
+ provider.create_zone(zone)
16
+ client.login
17
+ begin
18
+ client.get "Zone/#{zone.name}"
19
+ break
20
+ rescue
21
+ sleep(1)
22
+ retry
23
+ end while true
24
+ client.logout
25
+ end
26
+
27
+ after do
28
+ provider.delete_zone(zone)
29
+ client.login
30
+ begin
31
+ client.get "Zone/#{zone.name}"
32
+ sleep(1)
33
+ rescue
34
+ break
35
+ end while true
36
+ client.logout
37
+ end
38
+
39
+ context 'when the zone has no other records' do
40
+ it 'should be successful' do
41
+ provider.create_record_in_zone(record, zone)
42
+
43
+ client.login
44
+ expect {
45
+ client.get "TXTRecord/#{domain}/#{domain}"
46
+ }.to_not raise_error(Splicer::Errors::RequestError)
47
+ client.logout
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when the zone does not exist' do
53
+ let(:zone) { Splicer::Zone.new(domain) }
54
+
55
+ it 'should be successful' do
56
+ expect {
57
+ provider.create_record_in_zone(record, zone)
58
+ }.to raise_error(Splicer::Errors::RequestError)
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,39 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Creating a zone', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+
12
+ # cleanup
13
+ after do
14
+ begin
15
+ provider.delete_zone(zone)
16
+ rescue Splicer::Errors::RequestError => error
17
+ end
18
+ end
19
+
20
+ context 'when the zone exists' do
21
+ before { provider.create_zone(zone) }
22
+
23
+ it 'should not be successful' do
24
+ expect { provider.create_zone(zone) }.to raise_error(Splicer::Errors::RequestError)
25
+ end
26
+ end
27
+
28
+ context 'when the zone does not exist' do
29
+ it 'should be successful' do
30
+ expect { provider.create_zone(zone) }.to_not raise_error(Splicer::Errors::RequestError)
31
+ client.login
32
+ expect {
33
+ client.get "Zone/#{domain}"
34
+ }.to_not raise_error(Splicer::Errors::RequestError)
35
+ client.logout
36
+ end
37
+ end
38
+
39
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+ require 'spec_helper'
3
+
4
+ describe 'Creating an A record', acceptance: true do
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::ARecord.new(nil, '127.0.0.1') }
12
+
13
+ context 'when the zone exists' do
14
+ before do
15
+ provider.create_zone(zone)
16
+ client.login
17
+ begin
18
+ client.get "Zone/#{zone.name}"
19
+ break
20
+ rescue
21
+ sleep(1)
22
+ retry
23
+ end while true
24
+ client.logout
25
+ end
26
+
27
+ after do
28
+ provider.delete_zone(zone)
29
+ client.login
30
+ begin
31
+ client.get "Zone/#{zone.name}"
32
+ sleep(1)
33
+ rescue
34
+ break
35
+ end while true
36
+ client.logout
37
+ end
38
+
39
+ context 'when the zone has no other records' do
40
+ it 'should be successful' do
41
+ provider.create_record_in_zone(record, zone)
42
+
43
+ client.login
44
+ expect {
45
+ client.get "ARecord/#{domain}/#{domain}"
46
+ }.to_not raise_error(Splicer::Errors::RequestError)
47
+ client.logout
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when the zone does not exist' do
53
+ let(:zone) { Splicer::Zone.new(domain) }
54
+
55
+ it 'should be successful' do
56
+ expect {
57
+ provider.create_record_in_zone(record, zone)
58
+ }.to raise_error(Splicer::Errors::RequestError)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Creating an AAAA record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::AAAARecord.new(nil, '2001:0db8:3c4d:0015:0000:0000:abcd:ef12') }
12
+
13
+ context 'when the zone exists' do
14
+ before do
15
+ provider.create_zone(zone)
16
+ client.login
17
+ begin
18
+ client.get "Zone/#{zone.name}"
19
+ break
20
+ rescue
21
+ sleep(1)
22
+ retry
23
+ end while true
24
+ client.logout
25
+ end
26
+
27
+ after do
28
+ provider.delete_zone(zone)
29
+ client.login
30
+ begin
31
+ client.get "Zone/#{zone.name}"
32
+ sleep(1)
33
+ rescue
34
+ break
35
+ end while true
36
+ client.logout
37
+ end
38
+
39
+ context 'when the zone has no other records' do
40
+ it 'should be successful' do
41
+ provider.create_record_in_zone(record, zone)
42
+
43
+ client.login
44
+ expect {
45
+ client.get "AAAARecord/#{domain}/#{domain}"
46
+ }.to_not raise_error(Splicer::Errors::RequestError)
47
+ client.logout
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when the zone does not exist' do
53
+ let(:zone) { Splicer::Zone.new(domain) }
54
+
55
+ it 'should be successful' do
56
+ expect {
57
+ provider.create_record_in_zone(record, zone)
58
+ }.to raise_error(Splicer::Errors::RequestError)
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Creating an MX record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::MXRecord.new(nil, 'server.example.com', 10) }
12
+
13
+ context 'when the zone exists' do
14
+ before do
15
+ provider.create_zone(zone)
16
+ client.login
17
+ begin
18
+ client.get "Zone/#{zone.name}"
19
+ break
20
+ rescue
21
+ sleep(1)
22
+ retry
23
+ end while true
24
+ client.logout
25
+ end
26
+
27
+ after do
28
+ provider.delete_zone(zone)
29
+ client.login
30
+ begin
31
+ client.get "Zone/#{zone.name}"
32
+ sleep(1)
33
+ rescue
34
+ break
35
+ end while true
36
+ client.logout
37
+ end
38
+
39
+ context 'when the zone has no other records' do
40
+ it 'should be successful' do
41
+ provider.create_record_in_zone(record, zone)
42
+
43
+ client.login
44
+ expect {
45
+ client.get "MXRecord/#{domain}/#{domain}"
46
+ }.to_not raise_error(Splicer::Errors::RequestError)
47
+ client.logout
48
+ end
49
+ end
50
+ end
51
+
52
+ context 'when the zone does not exist' do
53
+ let(:zone) { Splicer::Zone.new(domain) }
54
+
55
+ it 'should be successful' do
56
+ expect {
57
+ provider.create_record_in_zone(record, zone)
58
+ }.to raise_error(Splicer::Errors::RequestError)
59
+ end
60
+ end
61
+
62
+ end
@@ -0,0 +1,96 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Deleting a CNAME record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::CNAMERecord.new('www', domain) }
12
+
13
+ context 'when the zone exists' do
14
+ context 'and the record exists' do
15
+ before do
16
+ zone.add_record(record)
17
+ zone.add_record(Splicer::Records::CNAMERecord.new('blog', domain))
18
+ provider.create_zone(zone)
19
+ client.login
20
+ begin
21
+ client.get "Zone/#{zone.name}"
22
+ break
23
+ rescue
24
+ sleep(1)
25
+ retry
26
+ end while true
27
+ client.logout
28
+ end
29
+
30
+ after do
31
+ provider.delete_zone(zone)
32
+ client.login
33
+ begin
34
+ client.get "Zone/#{zone.name}"
35
+ sleep(1)
36
+ rescue
37
+ break
38
+ end while true
39
+ client.logout
40
+ end
41
+
42
+ it 'should be successful' do
43
+ expect {
44
+ provider.delete_record_in_zone(record, zone)
45
+ }.to_not raise_error(Splicer::Errors::RequestError)
46
+
47
+ client.login
48
+ expect {
49
+ client.get "CNAMERecord/#{domain}/blog.#{domain}"
50
+ }.to_not raise_error(Splicer::Errors::RequestError)
51
+ client.logout
52
+ end
53
+ end
54
+
55
+ context 'and the record does not exist' do
56
+ before do
57
+ provider.create_zone(zone)
58
+ client.login
59
+ begin
60
+ client.get "Zone/#{zone.name}"
61
+ break
62
+ rescue
63
+ sleep(1)
64
+ retry
65
+ end while true
66
+ client.logout
67
+ end
68
+
69
+ after do
70
+ provider.delete_zone(zone)
71
+ client.login
72
+ begin
73
+ client.get "Zone/#{zone.name}"
74
+ sleep(1)
75
+ rescue
76
+ break
77
+ end while true
78
+ client.logout
79
+ end
80
+
81
+ it 'should not be successful' do
82
+ expect {
83
+ provider.delete_record_in_zone(record, zone)
84
+ }.to raise_error(Splicer::Errors::RequestError)
85
+ end
86
+ end
87
+ end
88
+
89
+ context 'when the zone does not exist' do
90
+ it 'should not be successful' do
91
+ expect {
92
+ provider.delete_record_in_zone(record, zone)
93
+ }.to raise_error(Splicer::Errors::RequestError)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Deleting a zone', :acceptance => true do
4
+
5
+ context 'when the zone exists' do
6
+ it 'should be successful' do
7
+ pending
8
+ end
9
+ end
10
+
11
+ context 'when the zone does not exist' do
12
+ it 'should not be successful' do
13
+ pending
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,96 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Deleting an A record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::ARecord.new(nil, '127.0.0.1') }
12
+
13
+ context 'when the zone exists' do
14
+ context 'and the record exists' do
15
+ before do
16
+ zone.add_record(record)
17
+ zone.add_record(Splicer::Records::ARecord.new('blog', '127.1.1.1'))
18
+ provider.create_zone(zone)
19
+ client.login
20
+ begin
21
+ client.get "Zone/#{zone.name}"
22
+ break
23
+ rescue
24
+ sleep(1)
25
+ retry
26
+ end while true
27
+ client.logout
28
+ end
29
+
30
+ after do
31
+ provider.delete_zone(zone)
32
+ client.login
33
+ begin
34
+ client.get "Zone/#{zone.name}"
35
+ sleep(1)
36
+ rescue
37
+ break
38
+ end while true
39
+ client.logout
40
+ end
41
+
42
+ it 'should be successful' do
43
+ expect {
44
+ provider.delete_record_in_zone(record, zone)
45
+ }.to_not raise_error(Splicer::Errors::RequestError)
46
+
47
+ client.login
48
+ expect {
49
+ client.get "ARecord/#{domain}/blog.#{domain}"
50
+ }.to_not raise_error(Splicer::Errors::RequestError)
51
+ client.logout
52
+ end
53
+ end
54
+
55
+ context 'and the record does not exist' do
56
+ before do
57
+ provider.create_zone(zone)
58
+ client.login
59
+ begin
60
+ client.get "Zone/#{zone.name}"
61
+ break
62
+ rescue
63
+ sleep(1)
64
+ retry
65
+ end while true
66
+ client.logout
67
+ end
68
+
69
+ after do
70
+ provider.delete_zone(zone)
71
+ client.login
72
+ begin
73
+ client.get "Zone/#{zone.name}"
74
+ sleep(1)
75
+ rescue
76
+ break
77
+ end while true
78
+ client.logout
79
+ end
80
+
81
+ it 'should not be successful' do
82
+ expect {
83
+ provider.delete_record_in_zone(record, zone)
84
+ }.to raise_error(Splicer::Errors::RequestError)
85
+ end
86
+ end
87
+ end
88
+
89
+ context 'when the zone does not exist' do
90
+ it 'should not be successful' do
91
+ expect {
92
+ provider.delete_record_in_zone(record, zone)
93
+ }.to raise_error(Splicer::Errors::RequestError)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,96 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Deleting an AAAA record', :acceptance => true do
4
+
5
+ let(:domain) { "#{$keys['CUSTOMER']}-rspec.com" }
6
+ let(:config) { Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']) }
7
+ let(:provider) { config.provider }
8
+ let(:client) { provider.client }
9
+
10
+ let(:zone) { Splicer::Zone.new(domain) }
11
+ let(:record) { Splicer::Records::AAAARecord.new(nil, '2001:0db8:3c4d:0015:0000:0000:abcd:ef12') }
12
+
13
+ context 'when the zone exists' do
14
+ context 'and the record exists' do
15
+ before do
16
+ zone.add_record(record)
17
+ zone.add_record(Splicer::Records::AAAARecord.new('blog', '2001:0db8:3c4d:0015:0000:0000:abcd:ef11'))
18
+ provider.create_zone(zone)
19
+ client.login
20
+ begin
21
+ client.get "Zone/#{zone.name}"
22
+ break
23
+ rescue
24
+ sleep(1)
25
+ retry
26
+ end while true
27
+ client.logout
28
+ end
29
+
30
+ after do
31
+ provider.delete_zone(zone)
32
+ client.login
33
+ begin
34
+ client.get "Zone/#{zone.name}"
35
+ sleep(1)
36
+ rescue
37
+ break
38
+ end while true
39
+ client.logout
40
+ end
41
+
42
+ it 'should be successful' do
43
+ expect {
44
+ provider.delete_record_in_zone(record, zone)
45
+ }.to_not raise_error(Splicer::Errors::RequestError)
46
+
47
+ client.login
48
+ expect {
49
+ client.get "AAAARecord/#{domain}/blog.#{domain}"
50
+ }.to_not raise_error(Splicer::Errors::RequestError)
51
+ client.logout
52
+ end
53
+ end
54
+
55
+ context 'and the record does not exist' do
56
+ before do
57
+ provider.create_zone(zone)
58
+ client.login
59
+ begin
60
+ client.get "Zone/#{zone.name}"
61
+ break
62
+ rescue
63
+ sleep(1)
64
+ retry
65
+ end while true
66
+ client.logout
67
+ end
68
+
69
+ after do
70
+ provider.delete_zone(zone)
71
+ client.login
72
+ begin
73
+ client.get "Zone/#{zone.name}"
74
+ sleep(1)
75
+ rescue
76
+ break
77
+ end while true
78
+ client.logout
79
+ end
80
+
81
+ it 'should not be successful' do
82
+ expect {
83
+ provider.delete_record_in_zone(record, zone)
84
+ }.to raise_error(Splicer::Errors::RequestError)
85
+ end
86
+ end
87
+ end
88
+
89
+ context 'when the zone does not exist' do
90
+ it 'should not be successful' do
91
+ expect {
92
+ provider.delete_record_in_zone(record, zone)
93
+ }.to raise_error(Splicer::Errors::RequestError)
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Updating a CNAME record', :acceptance => true do
4
+
5
+ context 'when the zone exists' do
6
+ context 'and the record exists' do
7
+ it 'should be successful' do
8
+ pending
9
+ end
10
+ it 'should not modify existing records' do
11
+ pending
12
+ end
13
+ end
14
+
15
+ context 'and the record does not exist' do
16
+ it 'should not be successful' do
17
+ pending
18
+ end
19
+ end
20
+ end
21
+
22
+ context 'when the zone does not exist' do
23
+ it 'should not be successful' do
24
+ pending
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Updating a zone' do
4
+
5
+ context 'when the zone exists' do
6
+ it 'should be successful' do
7
+ pending
8
+ end
9
+ it 'should not modify existing records' do
10
+ pending
11
+ end
12
+ end
13
+
14
+ context 'when the zone does not exist' do
15
+ it 'should not be successful' do
16
+ pending
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Updating an A record', :acceptance => true do
4
+
5
+ context 'when the zone exists' do
6
+ context 'and the record exists' do
7
+ it 'should be successful' do
8
+ pending
9
+ end
10
+ it 'should not modify existing records' do
11
+ pending
12
+ end
13
+ end
14
+
15
+ context 'and the record does not exist' do
16
+ it 'should not be successful' do
17
+ pending
18
+ end
19
+ end
20
+ end
21
+
22
+ context 'when the zone does not exist' do
23
+ it 'should not be successful' do
24
+ pending
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Updating an AAAA record', :acceptance => true do
4
+
5
+ context 'when the zone exists' do
6
+ context 'and the record exists' do
7
+ it 'should be successful' do
8
+ pending
9
+ end
10
+ it 'should not modify existing records' do
11
+ pending
12
+ end
13
+ end
14
+
15
+ context 'and the record does not exist' do
16
+ it 'should not be successful' do
17
+ pending
18
+ end
19
+ end
20
+ end
21
+
22
+ context 'when the zone does not exist' do
23
+ it 'should not be successful' do
24
+ pending
25
+ end
26
+ end
27
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,27 @@
1
1
  require 'rspec'
2
2
  require 'splicer'
3
3
  require 'splicer/dynect'
4
+ require 'logger'
5
+
6
+ # Load up the key configs
7
+ begin
8
+ key_path = File.expand_path("spec/keys.yml")
9
+ $keys = YAML::load(File.open(key_path))
10
+ rescue Errno::ENOENT => error
11
+ $keys = nil
12
+ puts "keys.yml is not present"
13
+ end
14
+
15
+ Splicer.configure do |config|
16
+ if $keys
17
+ config.register(Splicer::Dynect::Config.new($keys['CUSTOMER'], $keys['USERNAME'], $keys['PASSWORD']))
18
+ end
19
+ # config.logger = Logger.new(STDOUT)
20
+ end
4
21
 
5
22
  RSpec.configure do |config|
6
23
  config.mock_with :rspec
24
+ unless $keys
25
+ config.filter_run_excluding :acceptance => true
26
+ end
7
27
  end
@@ -14,8 +14,4 @@ describe Splicer::Dynect::Config do
14
14
  it { should be_a(Splicer::Dynect::Provider) }
15
15
  end
16
16
 
17
- describe '#client' do
18
- subject { config.client }
19
- it { should be_a(Splicer::Dynect::Client) }
20
- end
21
17
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency('splicer', '~> 1.2')
21
+ spec.add_dependency('splicer', '~> 2.0')
22
22
  spec.add_dependency('rest-client')
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: splicer-dynect
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-21 00:00:00.000000000 Z
12
+ date: 2013-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: splicer
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '1.2'
21
+ version: '2.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '1.2'
29
+ version: '2.0'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rest-client
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,21 @@ files:
111
111
  - lib/splicer/dynect/config.rb
112
112
  - lib/splicer/dynect/provider.rb
113
113
  - lib/splicer/dynect/version.rb
114
+ - spec/.gitignore
115
+ - spec/acceptance/creating/creating_a_cname_record_spec.rb
116
+ - spec/acceptance/creating/creating_a_txt_record_spec.rb
117
+ - spec/acceptance/creating/creating_a_zone_spec.rb
118
+ - spec/acceptance/creating/creating_an_a_record_spec.rb
119
+ - spec/acceptance/creating/creating_an_aaaa_record_spec.rb
120
+ - spec/acceptance/creating/creating_an_mx_record_spec.rb
121
+ - spec/acceptance/deleting/deleting_a_cname_record_spec.rb
122
+ - spec/acceptance/deleting/deleting_a_zone_spec.rb
123
+ - spec/acceptance/deleting/deleting_an_a_record_spec.rb
124
+ - spec/acceptance/deleting/deleting_an_aaaa_record_spec.rb
125
+ - spec/acceptance/updating/updating_a_cname_record_spec.rb
126
+ - spec/acceptance/updating/updating_a_zone_spec.rb
127
+ - spec/acceptance/updating/updating_an_a_record_spec.rb
128
+ - spec/acceptance/updating/updating_an_aaaa_record_spec.rb
114
129
  - spec/spec_helper.rb
115
130
  - spec/splicer/dynect/client_spec.rb
116
131
  - spec/splicer/dynect/config_spec.rb
@@ -131,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
146
  version: '0'
132
147
  segments:
133
148
  - 0
134
- hash: -487710610434230197
149
+ hash: -2628931118663995847
135
150
  required_rubygems_version: !ruby/object:Gem::Requirement
136
151
  none: false
137
152
  requirements:
@@ -140,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
155
  version: '0'
141
156
  segments:
142
157
  - 0
143
- hash: -487710610434230197
158
+ hash: -2628931118663995847
144
159
  requirements: []
145
160
  rubyforge_project:
146
161
  rubygems_version: 1.8.25
@@ -148,6 +163,21 @@ signing_key:
148
163
  specification_version: 3
149
164
  summary: The splicer adapter for interacting Dynect
150
165
  test_files:
166
+ - spec/.gitignore
167
+ - spec/acceptance/creating/creating_a_cname_record_spec.rb
168
+ - spec/acceptance/creating/creating_a_txt_record_spec.rb
169
+ - spec/acceptance/creating/creating_a_zone_spec.rb
170
+ - spec/acceptance/creating/creating_an_a_record_spec.rb
171
+ - spec/acceptance/creating/creating_an_aaaa_record_spec.rb
172
+ - spec/acceptance/creating/creating_an_mx_record_spec.rb
173
+ - spec/acceptance/deleting/deleting_a_cname_record_spec.rb
174
+ - spec/acceptance/deleting/deleting_a_zone_spec.rb
175
+ - spec/acceptance/deleting/deleting_an_a_record_spec.rb
176
+ - spec/acceptance/deleting/deleting_an_aaaa_record_spec.rb
177
+ - spec/acceptance/updating/updating_a_cname_record_spec.rb
178
+ - spec/acceptance/updating/updating_a_zone_spec.rb
179
+ - spec/acceptance/updating/updating_an_a_record_spec.rb
180
+ - spec/acceptance/updating/updating_an_aaaa_record_spec.rb
151
181
  - spec/spec_helper.rb
152
182
  - spec/splicer/dynect/client_spec.rb
153
183
  - spec/splicer/dynect/config_spec.rb