shanesveller-webbynode-api 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,3 +1,3 @@
1
- README.rdoc
1
+ README.markdown
2
2
  lib/**/*.rb
3
3
  LICENSE
data/README.markdown ADDED
@@ -0,0 +1,77 @@
1
+ #webbynode-api
2
+
3
+ This gem wraps the API available for the VPS hosting company
4
+ [WebbyNode](http://www.webbynode.com). Details and a preliminary
5
+ design document for the API itself are available
6
+ [here](http://howto.webbynode.com/topic.php?id=25). Functionality
7
+ is currently based on the API guide version 2.
8
+
9
+ ##Notice
10
+ **All previous methods/initializers used named/ordered arguments. New API
11
+ interactions are designed to use hashes of arguments instead. Older API
12
+ models will be converted to this new design pattern soon.**
13
+
14
+ **Also, any new/improved documentation will instead be visible in the
15
+ [YARD documentation](http://rdoc.info/projects/shanesveller/webbynode-api)
16
+ hosted at [rdoc.info](http://rdoc.info).**
17
+
18
+ ##Currently Supported API functionality
19
+ * Client information such as account status, contact/address info, credit
20
+ * Webby information (status) and simple actions (start, shutdown, reboot)
21
+ * List all webbies
22
+ * DNS zone information such as domain name, TTL, and status
23
+ * Creation/deletion of DNS zones
24
+
25
+ ##In Development
26
+ * DNS record information such as type, data, name, id, and TTL
27
+
28
+ ##Planned Features
29
+ * DNS zone/record creation, editing and deletion
30
+ * Whatever else WebbyNode gives us in the API :)
31
+
32
+ ##Example Usage
33
+ ###Account
34
+ require 'webbynode-api'
35
+ email = "example@email.com"
36
+ api_key = "1234567890abcdef"
37
+ @client = WebbyNode::Client.new(email, api_key)
38
+ puts @client.firstname
39
+
40
+ ###Webby
41
+ require 'webbynode-api'
42
+ email = "example@email.com"
43
+ api_key = "1234567890abcdef"
44
+ hostname = "webby1"
45
+ # Get a single Webby's info
46
+ @webby = WebbyNode::Webby.new(email, api_key, hostname)
47
+ @webby.status
48
+ @webby.shutdown
49
+ @webby.status
50
+ # Get a list of all Webbies
51
+ @webbies = WebbyNode::Webby.new(email, api_key)
52
+ puts @webbies.list
53
+
54
+ ###DNS
55
+ require 'webbynode-api'
56
+ email = "example@email.com"
57
+ api_key = "1234567890abcdef"
58
+ zone_id = 123
59
+ @dns = WebbyNode::DNS.new(email, api_key)
60
+ pp @dns.zones
61
+ @dns = WebbyNode::DNS.new(email, api_key, zone_id)
62
+ pp @dns.domain
63
+ pp @dns.records
64
+
65
+ ###DNS Zone Creation/Deletion
66
+ require 'webbynode-api'
67
+ email = "example@email.com"
68
+ api_key = "1234567890abcdef"
69
+ @new_zone = WebbyNode::DNS.new_zone(:email => email, :token => api_key, :domain => "mynewdomain.com.", :ttl => 86400)
70
+ pp @new_zone["id"]
71
+ # => 171
72
+ WebbyNode::DNS.delete_zone(:email => email, :token => api_key, :id => 171)
73
+ # => true
74
+
75
+ ##Copyright
76
+
77
+ Copyright (c) 2009 Shane Sveller. See LICENSE for details.
data/Rakefile CHANGED
@@ -56,5 +56,5 @@ end
56
56
 
57
57
  require 'yard'
58
58
  YARD::Rake::YardocTask.new do |t|
59
- t.files = ['lib/**/*.rb']
59
+ t.files = ['lib/**/*.rb', 'README.markdown']
60
60
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.1.0
@@ -3,43 +3,40 @@ class WebbyNode
3
3
  #
4
4
  # @author Shane Sveller
5
5
  # @since 0.0.1
6
+ # @version 0.1.0
6
7
  class Client < WebbyNode::APIObject
7
- def initialize(email, api_key)
8
- super(email, api_key)
8
+ def initialize(options = {})
9
+ super(options)
9
10
  @data = auth_get("/api/xml/client")["hash"]["client"]
10
11
  end
11
12
  end
12
13
 
13
14
  # Represents an individual webby with status, reboot/shutdown/start functionality
14
15
  # via +method_missing+
15
- #
16
+ #
16
17
  # @author Shane Sveller
17
18
  # @since 0.0.1
19
+ # @version 0.1.0
18
20
  class Webby < WebbyNode::APIObject
19
21
  attr_accessor :hostname
20
22
 
21
- # Fetches either an array of Webbies' data or an individual Webby's data.
23
+ # Fetches an individual Webby's data.
22
24
  #
23
- # @param [String] email E-mail address used for API access
24
- # @param [String] api_key API token used for API access
25
- # @param [optional, String] hostname Hostname used to look up an individual
25
+ # @option options [String] :email E-mail address used for API access
26
+ # @option options [String] :token API token used for API access
27
+ # @option options [String] :hostname Hostname used to look up an individual
26
28
  # Webby. When absent or nil, the newly instantiated object instead
27
29
  # represents an Array of Webbies.
28
30
  # @example Fetch data for a Webby named "webby1"
29
- # WebbyNode::Webby.new(email, api_key, "webby1")
30
- # @example Fetch an Array of Webbies
31
- # WebbyNode::Webby.new(email, api_key)
32
- def initialize(email, api_key, hostname = nil)
33
- super(email, api_key)
34
- if hostname
35
- @hostname = hostname
36
- else
37
- @data = auth_get("/api/xml/webbies")["hash"]["webbies"]
38
- end
31
+ # @webby = WebbyNode::Webby.new(:email => email, :token => token, "webby1")
32
+ def initialize(options = {})
33
+ raise ArgumentError, ":hostname is a required argument" unless options[:hostname]
34
+ super(options)
35
+ @hostname = options[:hostname]
39
36
  end
40
37
 
41
38
  # Provides status, start/shutdown/reboot functionality for an individual
42
- # Webby. Provides list functionality for an Array of Webbies.
39
+ # Webby.
43
40
  def method_missing(method)
44
41
  if method.to_s == "status"
45
42
  return auth_get("/api/xml/webby/#{@hostname}/status")["hash"]["status"]
@@ -53,10 +50,29 @@ class WebbyNode
53
50
  end
54
51
  end
55
52
 
53
+ # Represents a list of all Webbies on an account
54
+ #
55
+ # @author Shane Sveller
56
+ # @since 0.1.0
57
+ # @version 0.1.0
58
+ class WebbyList < WebbyNode::APIObject
59
+ # Fetches an array of Webbies' data.
60
+ #
61
+ # @option options [String] :email E-mail address used for API access
62
+ # @option options [String] :token API token used for API access
63
+ # @example Fetch an Array of Webbies
64
+ # WebbyNode::Webby.new(:email => email, :token => token)
65
+ def initialize(options = {})
66
+ super(options)
67
+ @data = auth_get("/api/xml/webbies")["hash"]["webbies"]
68
+ end
69
+ end
70
+
56
71
  # Represents the DNS zones present on the API account
57
72
  #
58
73
  # @author Shane Sveller
59
74
  # @since 0.0.2
75
+ # @version 0.1.0
60
76
  class DNS < WebbyNode::APIObject
61
77
  # Holds the ID used internally at WebbyNode that represents a given zone.
62
78
  attr_accessor :id
@@ -64,17 +80,16 @@ class WebbyNode
64
80
  # Fetches either a single zone or an Array of all zones based on the presence
65
81
  # of the id parameter.
66
82
  #
67
- # @param [String] email E-mail address used for API access
68
- # @param [String] api_key API token used for API access
69
- # @param [option, Integer] id ID that represents an individual zone
70
- def initialize(email, api_key, id = nil)
71
- super(email, api_key)
72
- if id
73
- @id = id
74
- @data = auth_get("/api/xml/dns/#{@id}")["hash"]["zone"]
75
- else
76
- @data = auth_get("/api/xml/dns")["hash"]
77
- end
83
+ # @option options [String] :email E-mail address used for API access
84
+ # @option options [String] :token API token used for API access
85
+ # @option options [Integer] :id ID that represents an individual zone
86
+ # @raise [ArgumentError] Raises ArgumentError if the :id option is missing
87
+ # from the optins parameter.
88
+ def initialize(options = {})
89
+ raise ArgumentError, ":id is a required argument" unless options[:id]
90
+ super(options)
91
+ @id = options[:id]
92
+ @data = auth_get("/api/xml/dns/#{@id}")["hash"]["zone"]
78
93
  end
79
94
 
80
95
  # @since 0.0.3
@@ -122,4 +137,20 @@ class WebbyNode
122
137
  return auth_post("/api/xml/dns/#{options[:id]}/delete", :query => options)["hash"]["success"]
123
138
  end
124
139
  end
140
+
141
+ # Represents an Array of all DNS zones present on the API account
142
+ #
143
+ # @author Shane Sveller
144
+ # @since 0.1.0
145
+ # @version 0.1.0
146
+ class DNSList < WebbyNode::APIObject
147
+ # Fetches an Array of all zones into @data.
148
+ #
149
+ # @option options [String] :email E-mail address used for API access
150
+ # @option options [String] :token API token used for API access
151
+ def initialize(options = {})
152
+ super(options)
153
+ @data = auth_get("/api/xml/dns")["hash"]["zones"]
154
+ end
155
+ end
125
156
  end
data/lib/webbynode-api.rb CHANGED
@@ -2,11 +2,11 @@ require 'rubygems'
2
2
  gem 'httparty'
3
3
  require 'httparty'
4
4
 
5
- # @author Shane Sveller
6
5
  class WebbyNode
7
6
 
8
7
  # @author Shane Sveller
9
8
  # @since 0.0.1
9
+ # @version 0.1.0
10
10
  class APIObject
11
11
  include HTTParty
12
12
  base_uri "https://manager.webbynode.com"
@@ -15,19 +15,20 @@ class WebbyNode
15
15
  # E-mail address used to access the WebbyNode API
16
16
  attr_accessor :email
17
17
  # API token used to access the WebbyNode API, visible at https://manager.webbynode.com/account
18
- attr_accessor :api_key
18
+ attr_accessor :token
19
19
  # Stores the results of the HTTParty API interactions
20
20
  attr_accessor :data
21
21
 
22
22
  # Creates a new API object secured by e-mail address and API token
23
23
  #
24
- # @param [String] email e-mail address with API access
25
- # @param [String] api_key API token that matches the included e-mail address
24
+ # @option options [String] :email e-mail address with API access
25
+ # @option options [String] :token API token that matches the included e-mail address
26
26
  # @example Instantiates a new API access object
27
- # WebbyNode::APIObject.new("example@email.com", "123456abcdef")
28
- def initialize(email, api_key)
29
- @email = email
30
- @api_key = api_key
27
+ # WebbyNode::APIObject.new(:email => "example@email.com", :token => "123456abcdef")
28
+ def initialize(options = {})
29
+ raise ArgumentError, ":email and :token are required arguments" unless options[:email] && options[:token]
30
+ @email = options[:email]
31
+ @token = options[:token]
31
32
  end
32
33
 
33
34
  # Uses HTTParty to submit a secure API request via email address and token
@@ -35,9 +36,9 @@ class WebbyNode
35
36
  # @param [Hash] options Hash of additional HTTParty parameters
36
37
  # @option options [Hash] :query query hash used to build the final URL
37
38
  def auth_get(url, options = {})
38
- raise ArgumentError, "API information is missing or incomplete" unless @email && @api_key
39
+ raise ArgumentError, "API information is missing or incomplete" unless @email && @token
39
40
  options[:query] ||= {}
40
- options[:query].merge!(:email => @email, :token => @api_key)
41
+ options[:query].merge!(:email => @email, :token => @token)
41
42
  results = self.class.get(url, options)
42
43
  raise ArgumentError, "Probable bad API information given" if results == {}
43
44
  return results
@@ -72,8 +73,8 @@ class WebbyNode
72
73
  #
73
74
  # @return [Object, nil] If the @data instance variable is set, and contains a hash
74
75
  # with a key matching the missing method, return the value from that hash key.
75
- # Said value may be typecast into a Ruby object if the XML is formatted properly.
76
- # Otherwise returns nil.
76
+ # Said value may be typecast into a Ruby object if the source XML is formatted
77
+ # properly. Otherwise returns nil.
77
78
  def method_missing(method)
78
79
  key = @data[method.to_s] if @data
79
80
  key
@@ -4,7 +4,7 @@ class WebbynodeApiTest < Test::Unit::TestCase
4
4
  context "with bad API token or email" do
5
5
  setup do
6
6
  @email ="example@email.com"
7
- @api_key = "123456"
7
+ @token = "123456"
8
8
  data_path = File.join(File.dirname(__FILE__), "data")
9
9
  FakeWeb.clean_registry
10
10
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/client\?\w+/i, :body => File.read("#{data_path}/bad-auth.xml"))
@@ -12,28 +12,28 @@ class WebbynodeApiTest < Test::Unit::TestCase
12
12
  end
13
13
  should "raise ArgumentError if no API data given" do
14
14
  # for auth_get
15
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(nil, nil) }
16
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(@email, nil) }
17
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(nil, @api_key) }
15
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(:email => nil, :token => nil) }
16
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(:email => @email, :token => nil) }
17
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::Client.new(:email => nil, :token => @token) }
18
18
  # for auth_post
19
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(nil, nil).auth_post("",{}) }
20
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(@email, nil).auth_post("",{}) }
21
- assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(nil, @api_key).auth_post("",{}) }
19
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(:email => nil, :token => nil).auth_post("",{}) }
20
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(:email => @email, :token => nil).auth_post("",{}) }
21
+ assert_raise(ArgumentError, "API information is missing or incomplete"){ WebbyNode::APIObject.new(:email => nil, :token => @token).auth_post("",{}) }
22
22
  end
23
23
  should "raise ArgumentError if bad API data given" do
24
- assert_raise(ArgumentError, "Probable bad API information given"){ WebbyNode::Client.new(@email, @api_key) }
24
+ assert_raise(ArgumentError, "Probable bad API information given"){ WebbyNode::Client.new(@email, @token) }
25
25
  # TODO: Need XML fixture file for this
26
- # assert_raise(ArgumentError, "Probable bad API information given"){ WebbyNode::APIObject.new(@email, @api_key).auth_post("",{}) }
26
+ # assert_raise(ArgumentError, "Probable bad API information given"){ WebbyNode::APIObject.new(@email, @token).auth_post("",{}) }
27
27
  end
28
28
  end
29
29
  context "fetching client data from API" do
30
30
  setup do
31
31
  email = "example@email.com"
32
- api_key = "123456"
32
+ token = "123456"
33
33
  data_path = File.join(File.dirname(__FILE__), "data")
34
34
  FakeWeb.clean_registry
35
35
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/client\?.+/i, :body => File.read("#{data_path}/client.xml"))
36
- @api = WebbyNode::Client.new(email, api_key)
36
+ @api = WebbyNode::Client.new(:email => email, :token => token)
37
37
  end
38
38
 
39
39
  should "use method missing to get values for present keys" do
@@ -68,17 +68,17 @@ class WebbynodeApiTest < Test::Unit::TestCase
68
68
  end
69
69
  end
70
70
 
71
- context "fetching webbies data from API with hostname" do
71
+ context "fetching webby data from API" do
72
72
  setup do
73
73
  email = "example@email.com"
74
- api_key = "123456"
74
+ token = "123456"
75
75
  hostname = "webby1"
76
76
  data_path = File.join(File.dirname(__FILE__), "data")
77
77
  FakeWeb.clean_registry
78
78
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/start\?.+/i, :body => File.read("#{data_path}/webby-start.xml"))
79
79
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/shutdown\?.+/i, :body => File.read("#{data_path}/webby-shutdown.xml"))
80
80
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/reboot\?.+/i, :body => File.read("#{data_path}/webby-reboot.xml"))
81
- @webby = WebbyNode::Webby.new(email, api_key, hostname)
81
+ @webby = WebbyNode::Webby.new(:email => email, :token => token, :hostname => hostname)
82
82
  end
83
83
  should "return a job ID when starting, shutting down, or rebooting" do
84
84
  @webby.start.should == 2562
@@ -97,18 +97,18 @@ class WebbynodeApiTest < Test::Unit::TestCase
97
97
  @webby.status.should == "Rebooting"
98
98
  end
99
99
  end
100
- context "fetching webbies data from API without hostname" do
100
+ context "fetching webbies data from API" do
101
101
  setup do
102
102
  email = "example@email.com"
103
- api_key = "123456"
103
+ token = "123456"
104
104
  data_path = File.join(File.dirname(__FILE__), "data")
105
105
  FakeWeb.clean_registry
106
106
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/webbies\?.+/i, :body => File.read("#{data_path}/webbies.xml"))
107
- @webbies = WebbyNode::Webby.new(email, api_key)
107
+ @webbies = WebbyNode::WebbyList.new(:email => email, :token => token)
108
108
  end
109
109
  should "return a array of webbies" do
110
- @webbies.list.is_a?(Array).should be(true)
111
- webby = @webbies.list.first
110
+ @webbies.data.is_a?(Array).should be(true)
111
+ webby = @webbies.data.first
112
112
  webby["status"].should == "on"
113
113
  webby["ip"].should == "222.111.222.111"
114
114
  webby["node"].should == "location-a01"
@@ -118,25 +118,25 @@ class WebbynodeApiTest < Test::Unit::TestCase
118
118
  end
119
119
  end
120
120
 
121
- context "fetching DNS data from API without id" do
121
+ context "fetching all DNS data from API" do
122
122
  setup do
123
123
  email = "example@email.com"
124
- api_key = "123456"
124
+ token = "123456"
125
125
  data_path = File.join(File.dirname(__FILE__), "data")
126
126
  FakeWeb.clean_registry
127
127
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\?.+/i, :body => File.read("#{data_path}/dns.xml"))
128
128
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/\d+\?.+/i, :body => File.read("#{data_path}/dns-1.xml"))
129
- @dns = WebbyNode::DNS.new(email, api_key)
129
+ @zones = WebbyNode::DNSList.new(:email => email, :token => token)
130
130
  end
131
131
  should "return an array of zones with domain, status, id, and TTL" do
132
- @dns.zones.is_a?(Array).should be(true)
133
- @dns.zones.size.should == 3
134
- zone = @dns.zones.first
132
+ @zones.data.is_a?(Array).should be(true)
133
+ @zones.data.size.should == 3
134
+ zone = @zones.data.first
135
135
  zone["id"].should == 1
136
136
  zone["status"].should == "Active"
137
137
  zone["domain"].should == "example.com."
138
138
  zone["ttl"].should == 86400
139
- zone = @dns.zones.last
139
+ zone = @zones.data.last
140
140
  zone["id"].should == 132
141
141
  zone["status"].should == "Inactive"
142
142
  zone["domain"].should == "inactive.com."
@@ -146,14 +146,14 @@ class WebbynodeApiTest < Test::Unit::TestCase
146
146
  context "fetching DNS data from API with id" do
147
147
  setup do
148
148
  email = "example@email.com"
149
- api_key = "123456"
149
+ token = "123456"
150
150
  id = 1
151
151
  data_path = File.join(File.dirname(__FILE__), "data")
152
152
  FakeWeb.clean_registry
153
153
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\?.+/i, :body => File.read("#{data_path}/dns.xml"))
154
154
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/\d+\?.+/i, :body => File.read("#{data_path}/dns-1.xml"))
155
155
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/\d+\/records\?.+/i, :body => File.read("#{data_path}/dns-records.xml"))
156
- @dns = WebbyNode::DNS.new(email, api_key, id)
156
+ @dns = WebbyNode::DNS.new(:email => email, :token => token, :id => id)
157
157
  end
158
158
  should "return domain name, status, id and TTL" do
159
159
  @dns.domain.should == "example.com."
@@ -175,7 +175,7 @@ class WebbynodeApiTest < Test::Unit::TestCase
175
175
  context "creating a new DNS zone" do
176
176
  setup do
177
177
  @email = "example@email.com"
178
- @api_key = "123456"
178
+ @token = "123456"
179
179
  @domain = "example.com."
180
180
  @ttl = 86400
181
181
  data_path = File.join(File.dirname(__FILE__), "data")
@@ -183,21 +183,21 @@ class WebbynodeApiTest < Test::Unit::TestCase
183
183
  FakeWeb.register_uri(:post, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/new\?.+/i, :body => File.read("#{data_path}/new-zone.xml"))
184
184
  end
185
185
  should "raise ArgumentError if API information isn't present" do
186
- assert_raise(ArgumentError,"API access information via :email and :token are required arguments"){ WebbyNode::DNS.new_zone(:token => @api_key, :domain => @domain, :ttl => @ttl) }
186
+ assert_raise(ArgumentError,"API access information via :email and :token are required arguments"){ WebbyNode::DNS.new_zone(:token => @token, :domain => @domain, :ttl => @ttl) }
187
187
  assert_raise(ArgumentError,"API access information via :email and :token are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :domain => @domain, :ttl => @ttl) }
188
188
  end
189
189
  should "raise ArgumentError if :domain or :ttl aren't included in method call" do
190
- assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :ttl => @ttl) }
191
- assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :domain => @domain) }
190
+ assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :ttl => @ttl) }
191
+ assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :domain => @domain) }
192
192
  end
193
193
  should "raise ArgumentError if :status is not a valid option" do
194
- assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :ttl => @ttl, :status => "Not active") }
195
- assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :domain => @domain, :ttl => @ttl, :status => "Active") }
196
- assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :domain => @domain, :ttl => @ttl, :status => "Inactive") }
197
- assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :domain => @domain, :ttl => @ttl, :status => nil) }
194
+ assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :ttl => @ttl, :status => "Not active") }
195
+ assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :domain => @domain, :ttl => @ttl, :status => "Active") }
196
+ assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :domain => @domain, :ttl => @ttl, :status => "Inactive") }
197
+ assert_nothing_raised(ArgumentError){ WebbyNode::DNS.new_zone(:email => @email, :token => @token, :domain => @domain, :ttl => @ttl, :status => nil) }
198
198
  end
199
199
  should "return a Hash containing the new zone's information" do
200
- @new_zone = WebbyNode::DNS.new_zone(:email => @email, :token => @api_key, :domain => @domain, :ttl => @ttl, :status => "Inactive")
200
+ @new_zone = WebbyNode::DNS.new_zone(:email => @email, :token => @token, :domain => @domain, :ttl => @ttl, :status => "Inactive")
201
201
  @new_zone["id"].should == 171
202
202
  @new_zone["domain"].should == "example.com."
203
203
  @new_zone["ttl"].should == 86400
@@ -206,14 +206,14 @@ class WebbynodeApiTest < Test::Unit::TestCase
206
206
  context "deleting a DNS zone" do
207
207
  setup do
208
208
  @email = "example@email.com"
209
- @api_key = "123456"
209
+ @token = "123456"
210
210
  @id = 171
211
211
  data_path = File.join(File.dirname(__FILE__), "data")
212
212
  FakeWeb.clean_registry
213
213
  FakeWeb.register_uri(:post, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/\d+\/delete\?.+/i, :body => File.read("#{data_path}/delete-zone.xml"))
214
214
  end
215
215
  should "return a boolean true for succesful deletion" do
216
- WebbyNode::DNS.delete_zone(:email => @email, :token => @api_key, :id => @id)
216
+ WebbyNode::DNS.delete_zone(:email => @email, :token => @token, :id => @id)
217
217
  end
218
218
  end
219
219
  end
@@ -2,20 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webbynode-api}
5
- s.version = "0.0.7"
5
+ s.version = "0.1.0"
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-12}
9
+ s.date = %q{2009-07-13}
10
10
  s.email = %q{shanesveller@gmail.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
13
+ "README.markdown",
13
14
  "README.rdoc"
14
15
  ]
15
16
  s.files = [
16
17
  ".document",
17
18
  ".gitignore",
18
19
  "LICENSE",
20
+ "README.markdown",
19
21
  "README.rdoc",
20
22
  "Rakefile",
21
23
  "VERSION",
@@ -40,10 +42,11 @@ Gem::Specification.new do |s|
40
42
  "test/webbynode-api_test.rb",
41
43
  "webbynode-api.gemspec"
42
44
  ]
45
+ s.has_rdoc = true
43
46
  s.homepage = %q{http://github.com/shanesveller/webbynode-api}
44
47
  s.rdoc_options = ["--charset=UTF-8"]
45
48
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.4}
49
+ s.rubygems_version = %q{1.3.1}
47
50
  s.summary = %q{wraps the WebbyNode API into nice Ruby objects}
48
51
  s.test_files = [
49
52
  "test/test_helper.rb",
@@ -52,7 +55,7 @@ Gem::Specification.new do |s|
52
55
 
53
56
  if s.respond_to? :specification_version then
54
57
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
55
- s.specification_version = 3
58
+ s.specification_version = 2
56
59
 
57
60
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
58
61
  else
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.7
4
+ version: 0.1.0
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 00:00:00 -07:00
12
+ date: 2009-07-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -21,11 +21,13 @@ extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
23
  - LICENSE
24
+ - README.markdown
24
25
  - README.rdoc
25
26
  files:
26
27
  - .document
27
28
  - .gitignore
28
29
  - LICENSE
30
+ - README.markdown
29
31
  - README.rdoc
30
32
  - Rakefile
31
33
  - VERSION
@@ -49,7 +51,7 @@ files:
49
51
  - test/test_helper.rb
50
52
  - test/webbynode-api_test.rb
51
53
  - webbynode-api.gemspec
52
- has_rdoc: false
54
+ has_rdoc: true
53
55
  homepage: http://github.com/shanesveller/webbynode-api
54
56
  post_install_message:
55
57
  rdoc_options:
@@ -73,7 +75,7 @@ requirements: []
73
75
  rubyforge_project:
74
76
  rubygems_version: 1.2.0
75
77
  signing_key:
76
- specification_version: 3
78
+ specification_version: 2
77
79
  summary: wraps the WebbyNode API into nice Ruby objects
78
80
  test_files:
79
81
  - test/test_helper.rb