shanesveller-webbynode-api 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -6,71 +6,41 @@ design document for the API itself are available
6
6
  [here](http://howto.webbynode.com/topic.php?id=25). Functionality
7
7
  is currently based on the API guide version 2.
8
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
9
  ##Currently Supported API functionality
19
10
  * Client information such as account status, contact/address info, credit
20
11
  * Webby information (status) and simple actions (start, shutdown, reboot)
21
12
  * List all webbies
22
13
  * DNS zone information such as domain name, TTL, and status
14
+ * List of all individual records in a given DNS zone
23
15
  * Creation/deletion of DNS zones
24
-
25
- ##In Development
26
- * DNS record information such as type, data, name, id, and TTL
16
+ * Activation/deactivation of DNS zones
27
17
 
28
18
  ##Planned Features
29
- * DNS zone/record creation, editing and deletion
19
+ * DNS record creation, editing and deletion
30
20
  * Whatever else WebbyNode gives us in the API :)
31
21
 
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
22
+ ##Usage and Examples
23
+ ###Command-Line Utility
24
+ This gem now includes a basic commandline utility named `webby`.
25
+ You can pass your email and token as commandline options, or place them
26
+ in a YAML file in `~/.webbynode.yml`, like so:
27
+ email: example@email.com
28
+ token: 123456abcdef
29
+ You can then use the commandline utility like so
30
+ webby -a webby status webby1
31
+ webby -a webby restart webby1
32
+ If you do not create the YAML file, the above lines might look like:
33
+ webby -email example@email.com -token 123456abcdef -a webby status webby1
34
+ webby -email example@email.com -token 123456abcdef -a webby restart webby1
35
+ ###Gem Usage
36
+ **Please visit the
37
+ [YARD documentation](http://rdoc.info/projects/shanesveller/webbynode-api)
38
+ hosted at [rdoc.info](http://rdoc.info) for usage, documentation and examples.**
64
39
 
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
40
+ Alternately, the YARD docs can be generated and viewed locally if you have the
41
+ `yard` gem installed.
42
+ rake yardoc
43
+ open doc/index.html
74
44
 
75
45
  ##Copyright
76
46
 
data/Rakefile CHANGED
@@ -9,6 +9,8 @@ begin
9
9
  gem.email = "shanesveller@gmail.com"
10
10
  gem.homepage = "http://github.com/shanesveller/webbynode-api"
11
11
  gem.authors = ["Shane Sveller"]
12
+ gem.add_dependency('httparty', '>= 0.4.3')
13
+ gem.add_dependency('optiflag', '>= 0.6.5')
12
14
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
15
  end
14
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
data/bin/webby ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ gem 'optiflag'
5
+ require 'optiflag'
6
+ require 'lib/webbynode-api'
7
+
8
+ module WebbyNodeTool extend OptiFlagSet
9
+ optional_flag "email"
10
+ optional_flag "token"
11
+ flag "act" do
12
+ alternate_forms "action","A","a"
13
+ description "API action to be taken, in the form of <type> <action> <target>"
14
+ arity 3
15
+ end
16
+ optional_flag "verbose" do
17
+ no_args
18
+ alternate_forms "V","v"
19
+ end
20
+
21
+ and_process!
22
+ end
23
+
24
+ VERBOSE = ARGV.flags.verbose?
25
+
26
+ if !ARGV.flags.email? || !ARGV.flags.token
27
+ yaml_config = File.join(ENV['HOME'],'.webbynode.yml')
28
+ if File.exist?(yaml_config)
29
+ puts "Loading API credentials from #{yaml_config}..." if VERBOSE
30
+ CONFIG = YAML.load_file yaml_config
31
+ EMAIL = CONFIG["email"]
32
+ TOKEN = CONFIG["token"]
33
+ else
34
+ puts "Email or token parameter missing and no config file exists at ~/.webbynode.yml"
35
+ end
36
+ else
37
+ EMAIL = ARGV.flags.email
38
+ TOKEN = ARGV.flags.token
39
+ end
40
+
41
+ type = ARGV.flags.act[0]
42
+ action = ARGV.flags.act[1]
43
+ target = ARGV.flags.act[2]
44
+ case type
45
+ when "webby" then
46
+ case action
47
+ when "status"
48
+ puts "Webby Status: #{target}: " + WebbyNode::Webby.new(:email => EMAIL, :token => TOKEN, :hostname => target).status
49
+ when "restart", "start"
50
+ puts "#{action.capitalize}ing Webby: #{target}..."
51
+ puts "Job ID: " + WebbyNode::Webby.new(:email => EMAIL, :token => TOKEN, :hostname => target).send(action).to_s
52
+ when "shutdown"
53
+ puts "Shutting Down Webby: #{target}..."
54
+ puts "Job ID: " + WebbyNode::Webby.new(:email => EMAIL, :token => TOKEN, :hostname => target).send(action).to_s
55
+ else
56
+ puts "Not a valid action for webby #{target}."
57
+ end
58
+ else
59
+ puts "Valid options for type:"
60
+ %w(webby).each {|type| puts type.capitalize }
61
+ end
@@ -5,6 +5,13 @@ class WebbyNode
5
5
  # @since 0.0.1
6
6
  # @version 0.1.0
7
7
  class Client < WebbyNode::APIObject
8
+ # Fills the @data variable with a hash of information about the client.
9
+ #
10
+ # @option options [String] :email E-mail address used for API access
11
+ # @option options [String] :token API token used for API access
12
+ # @example Get amount of credit left on an account
13
+ # @client = WebbyNode::Client.new(:email => email, :token)
14
+ # pp @client.credit # => 1.5
8
15
  def initialize(options = {})
9
16
  super(options)
10
17
  @data = auth_get("/api/xml/client")["hash"]["client"]
@@ -42,8 +49,6 @@ class WebbyNode
42
49
  return auth_get("/api/xml/webby/#{@hostname}/status")["hash"]["status"]
43
50
  elsif %w(start shutdown reboot).include? method.to_s
44
51
  return auth_get("/api/xml/webby/#{@hostname}/#{method.to_s}")["hash"]["job_id"]
45
- elsif method.to_s == "list"
46
- return @data
47
52
  else
48
53
  raise ArgumentError, "No such action possible on a Webby."
49
54
  end
@@ -66,8 +66,19 @@ class WebbyNode
66
66
  # @return [Hash] Hash of the new zone's information
67
67
  # @raise [ArgumentError] Raises ArgumentError if :token, :email, :domain,
68
68
  # or :ttl are missing from the options parameter.
69
+ # @example Create a zone with the domain example.com and TTL of 86400
70
+ # WebbyNode::DNS::Zone.create_zone({
71
+ # :email => email, :token => token,
72
+ # :domain => "example.com.", :ttl => 86400
73
+ # })
74
+ # @example Create an *inactive* zone with the domain example.com and TTL of 86400
75
+ # WebbyNode::DNS::Zone.create_zone({
76
+ # :email => email, :token => token,
77
+ # :domain => "example.com.", :ttl => 86400,
78
+ # :status => "Inactive"
79
+ # })
69
80
  def self.create_zone(options = {})
70
- raise ArgumentError, "API access information via :email and :token are required arguments" unless options[:email] && options[:token]
81
+ raise ArgumentError, ":email and :token are required arguments for API access" unless options[:email] && options[:token]
71
82
  raise ArgumentError, ":domain and :ttl are required arguments" unless options[:domain] && options[:ttl]
72
83
  if options[:status]
73
84
  raise ArgumentError, ":status must be 'Active' or 'Inactive'" unless %w(Active Inactive).include? options[:status]
@@ -89,9 +100,15 @@ class WebbyNode
89
100
  # @option options [Integer] :id WebbyNode's internally-used ID that idenftifies the zone
90
101
  # @return [Boolean] Returns true upon succesful deletion of the zone.
91
102
  # @raise [ArgumentError] Raises ArgumentError if :token, :email, or :id are
92
- # missing from the options parameter.
103
+ # missing from the options parameter.
104
+ # @example Delete a zone with ID of 100
105
+ # WebbyNode::DNS::Zone.delete_zone({
106
+ # :email => email, :token => token,
107
+ # :id => 100
108
+ # })
109
+ # # => true
93
110
  def self.delete_zone(options = {})
94
- raise ArgumentError, "API access information via :email and :token are required arguments" unless options[:email] && options[:token]
111
+ raise ArgumentError, ":email and :token are required arguments for API access" unless options[:email] && options[:token]
95
112
  raise ArgumentError, ":id is a required argument" unless options[:id]
96
113
  return auth_post("/api/xml/dns/#{options[:id]}/delete", :query => options)["hash"]["success"]
97
114
  end
@@ -119,6 +136,13 @@ class WebbyNode
119
136
  # @since 0.1.1
120
137
  # @version 0.1.0
121
138
  class RecordList < WebbyNode::APIObject
139
+ # Fills the @data variable with an Array of Hashes containing individual
140
+ # DNS records in a zone.
141
+ #
142
+ # @option options [String] :email E-mail address used for API access
143
+ # @option options [String] :token API token used for API access
144
+ # @option options [Integer] :id ID used internally by WebbyNode to identify the zone
145
+ # @raise [ArgumentError] Raises ArgumentError if :email, :token, or :id are absent from options
122
146
  def initialize(options = {})
123
147
  raise ArgumentError, ":id is a required argument" unless options[:id]
124
148
  super(options)
@@ -126,5 +150,41 @@ class WebbyNode
126
150
  @data = auth_get("/api/xml/dns/#{@id}/records")["hash"]["records"]
127
151
  end
128
152
  end
153
+
154
+ # Represents a single DNS record
155
+ #
156
+ # @author Shane Sveller
157
+ # @since 0.1.3
158
+ # @version 0.1.0
159
+ class Record < WebbyNode::APIObject
160
+ def initialize(options = {})
161
+ raise ArgumentError, ":id is a required argument" unless options[:id]
162
+ super(options)
163
+ @id = options[:id]
164
+ @data = auth_get("/api/xml/records/#{@id}")["hash"]["record"]
165
+ end
166
+
167
+ # Creates a new DNS record
168
+ #
169
+ # @option options [String] :email E-mail address used for API access
170
+ # @option options [String] :token API token used for API access
171
+ # @option options [String] :type DNS record type i.e. A, CNAME or MX
172
+ # @option options [String] :data DNS record data, typically an IP address
173
+ def self.create(options = {})
174
+ raise ArgumentError, ":email and :token are required arguments for API access" unless options[:email] && options[:token]
175
+ raise ArgumentError, ":data and :type are required arguments" unless options[:data] && options[:type]
176
+ valid_types = %w(A CNAME MX)
177
+ raise ArgumentError, "#{options[:type]} is not a valid value for :type" unless valid_types.include?(options[:type])
178
+ @id = options[:id]
179
+ options.delete(:id)
180
+ for key in options.keys
181
+ if %w(type name data aux ttl).include? key.to_s
182
+ options["record[#{key.to_s}]"] = options[key]
183
+ options.delete(key)
184
+ end
185
+ end
186
+ return auth_post("/api/xml/dns/#{@id}/records/new", :query => options)["hash"]["record"]
187
+ end
188
+ end
129
189
  end
130
190
  end
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <hash>
3
+ <record>
4
+ <type>A</type>
5
+ <ttl type="integer">86400</ttl>
6
+ <aux type="integer">0</aux>
7
+ <data>111.222.111.222</data>
8
+ <name></name>
9
+ <id type="integer">181</id>
10
+ </record>
11
+ </hash>
data/test/dns_test.rb CHANGED
@@ -53,8 +53,9 @@ class WebbyNodeDNSTest < Test::Unit::TestCase
53
53
  FakeWeb.register_uri(:post, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/new\?.+/i, :body => File.read("#{data_path}/new-zone.xml"))
54
54
  end
55
55
  should "raise ArgumentError if API information isn't present" do
56
- assert_raise(ArgumentError,"API access information via :email and :token are required arguments"){ WebbyNode::DNS::Zone.create_zone(:token => @token, :domain => @domain, :ttl => @ttl) }
57
- assert_raise(ArgumentError,"API access information via :email and :token are required arguments"){ WebbyNode::DNS::Zone.create_zone(:email => @email, :domain => @domain, :ttl => @ttl) }
56
+ assert_raise(ArgumentError,":email and :token are required arguments for API access"){ WebbyNode::DNS::Zone.create_zone(:token => @token, :domain => @domain, :ttl => @ttl) }
57
+ assert_raise(ArgumentError,":email and :token are required arguments for API access"){ WebbyNode::DNS::Zone.create_zone(:email => @email, :domain => @domain, :ttl => @ttl) }
58
+ assert_raise(ArgumentError,":email and :token are required arguments for API access"){ WebbyNode::DNS::Zone.create_zone(:domain => @domain, :ttl => @ttl) }
58
59
  end
59
60
  should "raise ArgumentError if :domain or :ttl aren't included in method call" do
60
61
  assert_raise(ArgumentError, ":domain and :ttl are required arguments"){ WebbyNode::DNS::Zone.create_zone(:email => @email, :token => @token, :ttl => @ttl) }
@@ -140,4 +141,43 @@ class WebbyNodeDNSTest < Test::Unit::TestCase
140
141
  record["type"].should == "A"
141
142
  end
142
143
  end
144
+ context "creating a DNS record" do
145
+ setup do
146
+ @email = "example@email.com"
147
+ @token = "123456"
148
+ @id = 1
149
+ data_path = File.join(File.dirname(__FILE__), "data")
150
+ FakeWeb.clean_registry
151
+ FakeWeb.register_uri(:post, /^https:\/\/manager\.webbynode\.com\/api\/xml\/dns\/\d+\/records\/new\?.+/i, :body => File.read("#{data_path}/new-record.xml"))
152
+ end
153
+ should "raise ArgumentError if :id argument is absent" do
154
+ assert_raise(ArgumentError, ":id is a required argument"){ WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => nil)}
155
+ assert_nothing_raised { WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => "A", :data => "111.222.111.222")}
156
+ end
157
+ should "raise ArgumentError if :type or :data are absent" do
158
+ assert_raise(ArgumentError, ":data and :type are required arguments"){ WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :data => "111.222.111.222") }
159
+ assert_raise(ArgumentError, ":data and :type are required arguments"){ WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => "A") }
160
+ assert_nothing_raised { WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => "A", :data => "111.222.111.222")}
161
+ end
162
+ should "accept only valid record types" do
163
+ for record_type in %w(A CNAME MX) do
164
+ assert_nothing_raised { WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => record_type, :data => "111.222.111.222")}
165
+ end
166
+ for bad_type in %w(SPF RDNS spam type blah)
167
+ assert_raise(ArgumentError, "#{bad_type} is not a valid value for :type"){ WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => bad_type, :data => "111.222.111.222")}
168
+ end
169
+ end
170
+ should "return a Hash of the new record's data" do
171
+ @new_record = WebbyNode::DNS::Record.create(:email => @email, :token => @token, :id => @id, :type => "A", :data => "111.222.111.222")
172
+ @new_record.is_a?(Hash).should be(true)
173
+ @new_record["type"].should == "A"
174
+ @new_record["data"].should == "111.222.111.222"
175
+ for key in %w(type ttl aux data name id)
176
+ @new_record.keys.include?(key).should be(true)
177
+ end
178
+ @new_record
179
+ end
180
+ end
181
+ context "fetching a DNS record" do
182
+ end
143
183
  end
data/test/webby_test.rb CHANGED
@@ -29,6 +29,9 @@ class WebbyNodeWebbyTest < Test::Unit::TestCase
29
29
  FakeWeb.register_uri(:get, /^https:\/\/manager\.webbynode\.com\/api\/xml\/webby\/\w+\/status\?.+/i, :body => File.read("#{data_path}/webby-status-reboot.xml"))
30
30
  @webby.status.should == "Rebooting"
31
31
  end
32
+ should "raise ArgumentError if a bad method is called" do
33
+ assert_raise(ArgumentError, "No such action possible on a Webby."){ @webby.restart }
34
+ end
32
35
  end
33
36
  context "fetching webbies data from API" do
34
37
  setup do
@@ -2,25 +2,26 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{webbynode-api}
5
- s.version = "0.1.2"
5
+ s.version = "0.2.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
9
  s.date = %q{2009-07-13}
10
+ s.default_executable = %q{webby}
10
11
  s.email = %q{shanesveller@gmail.com}
12
+ s.executables = ["webby"]
11
13
  s.extra_rdoc_files = [
12
14
  "LICENSE",
13
- "README.markdown",
14
- "README.rdoc"
15
+ "README.markdown"
15
16
  ]
16
17
  s.files = [
17
18
  ".document",
18
19
  ".gitignore",
19
20
  "LICENSE",
20
21
  "README.markdown",
21
- "README.rdoc",
22
22
  "Rakefile",
23
23
  "VERSION",
24
+ "bin/webby",
24
25
  "lib/webbynode-api.rb",
25
26
  "lib/webbynode-api/data.rb",
26
27
  "lib/webbynode-api/dns.rb",
@@ -34,6 +35,7 @@ Gem::Specification.new do |s|
34
35
  "test/data/dns-1.xml",
35
36
  "test/data/dns-records.xml",
36
37
  "test/data/dns.xml",
38
+ "test/data/new-record.xml",
37
39
  "test/data/new-zone.xml",
38
40
  "test/data/webbies.xml",
39
41
  "test/data/webby-reboot.xml",
@@ -67,8 +69,14 @@ Gem::Specification.new do |s|
67
69
  s.specification_version = 2
68
70
 
69
71
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
72
+ s.add_runtime_dependency(%q<httparty>, [">= 0.4.3"])
73
+ s.add_runtime_dependency(%q<optiflag>, [">= 0.6.5"])
70
74
  else
75
+ s.add_dependency(%q<httparty>, [">= 0.4.3"])
76
+ s.add_dependency(%q<optiflag>, [">= 0.6.5"])
71
77
  end
72
78
  else
79
+ s.add_dependency(%q<httparty>, [">= 0.4.3"])
80
+ s.add_dependency(%q<optiflag>, [">= 0.6.5"])
73
81
  end
74
82
  end
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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Sveller
@@ -10,27 +10,45 @@ bindir: bin
10
10
  cert_chain: []
11
11
 
12
12
  date: 2009-07-13 00:00:00 -07:00
13
- default_executable:
14
- dependencies: []
15
-
13
+ default_executable: webby
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httparty
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.4.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: optiflag
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.5
34
+ version:
16
35
  description:
17
36
  email: shanesveller@gmail.com
18
- executables: []
19
-
37
+ executables:
38
+ - webby
20
39
  extensions: []
21
40
 
22
41
  extra_rdoc_files:
23
42
  - LICENSE
24
43
  - README.markdown
25
- - README.rdoc
26
44
  files:
27
45
  - .document
28
46
  - .gitignore
29
47
  - LICENSE
30
48
  - README.markdown
31
- - README.rdoc
32
49
  - Rakefile
33
50
  - VERSION
51
+ - bin/webby
34
52
  - lib/webbynode-api.rb
35
53
  - lib/webbynode-api/data.rb
36
54
  - lib/webbynode-api/dns.rb
@@ -44,6 +62,7 @@ files:
44
62
  - test/data/dns-1.xml
45
63
  - test/data/dns-records.xml
46
64
  - test/data/dns.xml
65
+ - test/data/new-record.xml
47
66
  - test/data/new-zone.xml
48
67
  - test/data/webbies.xml
49
68
  - test/data/webby-reboot.xml
data/README.rdoc DELETED
@@ -1,78 +0,0 @@
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
-
73
- WebbyNode::DNS.delete_zone(:email => email, :token => api_key, :id => 171)
74
- # => true
75
-
76
- == Copyright
77
-
78
- Copyright (c) 2009 Shane Sveller. See LICENSE for details.