shanesveller-webbynode-api 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -0
- data/VERSION +1 -1
- data/lib/webbynode-api/data.rb +10 -2
- data/test/webbynode-api_test.rb +12 -0
- data/webbynode-api.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -9,6 +9,7 @@ is currently based on the API guide version 1.
|
|
9
9
|
== Currently Supported API functionality
|
10
10
|
* Client information such as account status, contact/address info, credit
|
11
11
|
* Webby information (status) and simple actions (start, shutdown, reboot)
|
12
|
+
* List all webbies
|
12
13
|
* DNS zone information such as domain name, TTL, and status
|
13
14
|
|
14
15
|
== In Development
|
@@ -31,10 +32,14 @@ is currently based on the API guide version 1.
|
|
31
32
|
email = "example@email.com"
|
32
33
|
api_key = "1234567890abcdef"
|
33
34
|
hostname = "webby1"
|
35
|
+
# Get a single Webby's info
|
34
36
|
@webby = WebbyNode::Webby.new(email, api_key, hostname)
|
35
37
|
@webby.status
|
36
38
|
@webby.shutdown
|
37
39
|
@webby.status
|
40
|
+
# Get a list of all Webbies
|
41
|
+
@webbies = WebbyNode::Webby.new(email, api_key)
|
42
|
+
puts @webbies.list
|
38
43
|
|
39
44
|
=== DNS
|
40
45
|
require 'webbynode-api'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/webbynode-api/data.rb
CHANGED
@@ -12,9 +12,15 @@ class WebbyNode
|
|
12
12
|
class Webby < WebbyNode::APIObject
|
13
13
|
attr_accessor :hostname
|
14
14
|
|
15
|
-
|
15
|
+
# Optionally takes a hostname as the third argument to fetch just that Webby.
|
16
|
+
# Leaving this nil set @data to an array of all the account's webbies
|
17
|
+
def initialize(email, api_key, hostname = nil)
|
16
18
|
super(email, api_key)
|
17
|
-
|
19
|
+
if hostname
|
20
|
+
@hostname = hostname
|
21
|
+
else
|
22
|
+
@data = auth_get("/api/xml/webbies")["hash"]["webbies"]
|
23
|
+
end
|
18
24
|
end
|
19
25
|
|
20
26
|
def method_missing(method)
|
@@ -22,6 +28,8 @@ class WebbyNode
|
|
22
28
|
return auth_get("/api/xml/webby/#{@hostname}/status")["hash"]["status"]
|
23
29
|
elsif %w(start shutdown reboot).include? method.to_s
|
24
30
|
return auth_get("/api/xml/webby/#{@hostname}/#{method.to_s}")["hash"]["job_id"]
|
31
|
+
elsif method.to_s == "list"
|
32
|
+
return @data
|
25
33
|
else
|
26
34
|
raise "No such action possible on a Webby."
|
27
35
|
end
|
data/test/webbynode-api_test.rb
CHANGED
@@ -51,7 +51,9 @@ class WebbynodeApiTest < Test::Unit::TestCase
|
|
51
51
|
FakeWeb.register_uri(:get, /https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/start\?.+/i, :body => File.read("#{data_path}/webby-start.xml"))
|
52
52
|
FakeWeb.register_uri(:get, /https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/shutdown\?.+/i, :body => File.read("#{data_path}/webby-shutdown.xml"))
|
53
53
|
FakeWeb.register_uri(:get, /https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/reboot\?.+/i, :body => File.read("#{data_path}/webby-reboot.xml"))
|
54
|
+
FakeWeb.register_uri(:get, /https:\/\/manager\.webbynode\.com\/api\/xml\/webbies\?.+/i, :body => File.read("#{data_path}/webbies.xml"))
|
54
55
|
@webby = WebbyNode::Webby.new(email, api_key, hostname)
|
56
|
+
@webbies = WebbyNode::Webby.new(email, api_key)
|
55
57
|
end
|
56
58
|
should "return a job ID when starting, shutting down, or rebooting" do
|
57
59
|
@webby.start.should == 2562
|
@@ -69,6 +71,16 @@ class WebbynodeApiTest < Test::Unit::TestCase
|
|
69
71
|
FakeWeb.register_uri(:get, /https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/status\?.+/i, :body => File.read("#{data_path}/webby-status-reboot.xml"))
|
70
72
|
@webby.status.should == "Rebooting"
|
71
73
|
end
|
74
|
+
should "return a array of webbies" do
|
75
|
+
@webbies.list.is_a?(Array).should be(true)
|
76
|
+
webby = @webbies.list.first
|
77
|
+
webby["status"].should == "on"
|
78
|
+
webby["ip"].should == "222.111.222.111"
|
79
|
+
webby["node"].should == "location-a01"
|
80
|
+
webby["plan"].should == "Webby_384"
|
81
|
+
webby["name"].should == "webby1"
|
82
|
+
webby["notes"].should be(nil)
|
83
|
+
end
|
72
84
|
end
|
73
85
|
|
74
86
|
context "fetching DNS data from API without id" do
|
data/webbynode-api.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{webbynode-api}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.4"
|
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"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-11}
|
10
10
|
s.email = %q{shanesveller@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
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.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Sveller
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|