shanesveller-webbynode-api 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +2 -1
- data/VERSION +1 -1
- data/lib/webbynode-api/dns.rb +21 -0
- data/test/data/delete-record.xml +4 -0
- data/test/dns_test.rb +13 -0
- data/webbynode-api.gemspec +2 -1
- metadata +2 -1
data/README.markdown
CHANGED
@@ -14,9 +14,10 @@ is currently based on the API guide version 2.
|
|
14
14
|
* List of all individual records in a given DNS zone
|
15
15
|
* Creation/deletion of DNS zones
|
16
16
|
* Activation/deactivation of DNS zones
|
17
|
+
* DNS record creation and deletion
|
17
18
|
|
18
19
|
##Planned Features
|
19
|
-
* DNS record
|
20
|
+
* DNS record editing
|
20
21
|
* Whatever else WebbyNode gives us in the API :)
|
21
22
|
|
22
23
|
##Usage and Examples
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/webbynode-api/dns.rb
CHANGED
@@ -185,6 +185,27 @@ class WebbyNode
|
|
185
185
|
end
|
186
186
|
return auth_post("/api/xml/dns/#{@id}/records/new", :query => options)["hash"]["record"]
|
187
187
|
end
|
188
|
+
|
189
|
+
# Deletes an existing DNS record by ID
|
190
|
+
#
|
191
|
+
# @since 0.2.1
|
192
|
+
# @option options [String] :email E-mail address used for API access
|
193
|
+
# @option options [String] :token API token used for API access
|
194
|
+
# @option options [Integer] :id WebbyNode's internally-used ID that idenftifies the record
|
195
|
+
# @return [Boolean] Returns true upon succesful deletion of the zone.
|
196
|
+
# @raise [ArgumentError] Raises ArgumentError if :token, :email, or :id are
|
197
|
+
# missing from the options parameter.
|
198
|
+
# @example Delete a DNS record with ID of 100
|
199
|
+
# WebbyNode::DNS::Record.delete({
|
200
|
+
# :email => email, :token => token,
|
201
|
+
# :id => 100
|
202
|
+
# })
|
203
|
+
# # => true
|
204
|
+
def self.delete(options = {})
|
205
|
+
raise ArgumentError, ":email and :token are required arguments for API access" unless options[:email] && options[:token]
|
206
|
+
raise ArgumentError, ":id is a required argument" unless options[:id]
|
207
|
+
return auth_post("/api/xml/records/#{options[:id]}/delete", :query => options)["hash"]["success"]
|
208
|
+
end
|
188
209
|
end
|
189
210
|
end
|
190
211
|
end
|
data/test/dns_test.rb
CHANGED
@@ -180,4 +180,17 @@ class WebbyNodeDNSTest < Test::Unit::TestCase
|
|
180
180
|
end
|
181
181
|
context "fetching a DNS record" do
|
182
182
|
end
|
183
|
+
context "deleting a DNS record" do
|
184
|
+
setup do
|
185
|
+
@email = "example@email.com"
|
186
|
+
@token = "123456"
|
187
|
+
@id = 171
|
188
|
+
data_path = File.join(File.dirname(__FILE__), "data")
|
189
|
+
FakeWeb.clean_registry
|
190
|
+
FakeWeb.register_uri(:post, /^https:\/\/manager\.webbynode\.com\/api\/xml\/records\/\d+\/delete\?.+/i, :body => File.read("#{data_path}/delete-record.xml"))
|
191
|
+
end
|
192
|
+
should "return a boolean true for succesful deletion" do
|
193
|
+
WebbyNode::DNS::Record.delete(:email => @email, :token => @token, :id => @id)
|
194
|
+
end
|
195
|
+
end
|
183
196
|
end
|
data/webbynode-api.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{webbynode-api}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Shane Sveller"]
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"test/data/bad-auth.xml",
|
32
32
|
"test/data/client.xml",
|
33
33
|
"test/data/deactivate-zone.xml",
|
34
|
+
"test/data/delete-record.xml",
|
34
35
|
"test/data/delete-zone.xml",
|
35
36
|
"test/data/dns-1.xml",
|
36
37
|
"test/data/dns-records.xml",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shanesveller-webbynode-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Sveller
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- test/data/bad-auth.xml
|
59
59
|
- test/data/client.xml
|
60
60
|
- test/data/deactivate-zone.xml
|
61
|
+
- test/data/delete-record.xml
|
61
62
|
- test/data/delete-zone.xml
|
62
63
|
- test/data/dns-1.xml
|
63
64
|
- test/data/dns-records.xml
|