splicer-dynect 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,21 +21,24 @@ module Splicer
21
21
  when :merge
22
22
  merge(zone)
23
23
  else
24
- raise Splicer::Errors::Error.new("invalid method: #{method}")
24
+ false
25
25
  end
26
26
 
27
27
  ensure
28
28
  client.logout
29
29
  end
30
30
 
31
+ def destroy(zone)
32
+ client.login
33
+ delete_zone(zone)
34
+ ensure
35
+ client.logout
36
+ end
37
+
31
38
  private
32
39
 
33
40
  def rewrite(zone)
34
- begin
35
- client.get "Zone/#{zone.name}"
36
- client.delete "Zone/#{zone.name}"
37
- rescue Splicer::Errors::RequestError => error
38
- end
41
+ delete_zone(zone)
39
42
 
40
43
  client.post "Zone/#{zone.name}", rname: "admin@#{zone.name}", ttl: zone.ttl
41
44
 
@@ -100,6 +103,14 @@ module Splicer
100
103
 
101
104
  private
102
105
 
106
+ def delete_zone(zone)
107
+ client.get "Zone/#{zone.name}"
108
+ client.delete "Zone/#{zone.name}"
109
+ true
110
+ rescue Splicer::Errors::RequestError => error
111
+ false
112
+ end
113
+
103
114
  def update_or_create_record(resource, record, zone, data={})
104
115
  begin
105
116
  client.put(resource_url(resource, record, zone), data)
@@ -113,7 +124,7 @@ module Splicer
113
124
  end
114
125
 
115
126
  def resource_url(resource, record, zone)
116
- if record.name.nil?
127
+ if record.name.nil? || record.name == zone.name
117
128
  "#{resource}/#{zone.name}/#{zone.name}"
118
129
  else
119
130
  "#{resource}/#{zone.name}/#{record.name}.#{zone.name}"
@@ -1,5 +1,5 @@
1
1
  module Splicer
2
2
  module Dynect
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -44,9 +44,7 @@ describe Splicer::Dynect::Provider do
44
44
 
45
45
  context 'when doing something undefined' do
46
46
  subject { provider.publish(zone, :something) }
47
- it 'should raise a Splicer::Errors::Error' do
48
- expect { subject }.to raise_error(Splicer::Errors::Error, /something/)
49
- end
47
+ it { should eq(false) }
50
48
  end
51
49
  end
52
50
  end
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.0.0
4
+ version: 1.0.1
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-08 00:00:00.000000000 Z
12
+ date: 2013-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: splicer
@@ -131,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  segments:
133
133
  - 0
134
- hash: 3802336838267731040
134
+ hash: -696349607672345343
135
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements:
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: 3802336838267731040
143
+ hash: -696349607672345343
144
144
  requirements: []
145
145
  rubyforge_project:
146
146
  rubygems_version: 1.8.25