sant0sk1-dreamy 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -11
- data/VERSION.yml +2 -2
- data/lib/dreamy.rb +1 -0
- data/lib/dreamy/announce_list.rb +19 -0
- data/lib/dreamy/base.rb +23 -5
- data/lib/dreamy/command.rb +3 -12
- data/lib/dreamy/commands/announce.rb +15 -1
- data/lib/dreamy/commands/dns.rb +22 -0
- data/lib/dreamy/commands/help.rb +13 -10
- data/lib/dreamy/dns.rb +2 -2
- data/lib/dreamy/domain.rb +6 -6
- data/lib/dreamy/subscriber.rb +2 -2
- data/lib/dreamy/user.rb +3 -3
- data/test/announce_test.rb +32 -0
- data/test/base_test.rb +67 -13
- data/test/dns_test.rb +2 -2
- data/test/domain_test.rb +7 -7
- data/test/subscriber_test.rb +2 -2
- data/test/user_test.rb +4 -4
- metadata +5 -2
data/README.md
CHANGED
@@ -46,6 +46,9 @@ Same goes with Users, DNS records and announcement list subscribers
|
|
46
46
|
# fetch an array of Dreamy::Dns objects
|
47
47
|
account.dns
|
48
48
|
|
49
|
+
# fetch an array of Dreamy::AnnounceList objects
|
50
|
+
account.announce_lists
|
51
|
+
|
49
52
|
# fetch an array of Dreamy::Subscribers to an announcement list
|
50
53
|
account.announce_list(listname,domain)
|
51
54
|
|
@@ -57,6 +60,14 @@ You can interact with announcement lists by adding and removing subscribers
|
|
57
60
|
# remove a subscriber from an announcement list
|
58
61
|
account.announce_remove(listname,domain,email)
|
59
62
|
|
63
|
+
You can interact with DNS by adding and removing records
|
64
|
+
|
65
|
+
# add a new A record for a subdomain of an hosted domain
|
66
|
+
account.dns_add(subdomain,"A","123.321.123.321")
|
67
|
+
|
68
|
+
# remove the A record just created
|
69
|
+
account.dns_remove(subdomain,"A","123.321.123.321")
|
70
|
+
|
60
71
|
More and more functions will be added as time allows. If there's something missing that you want in, please:
|
61
72
|
|
62
73
|
fork -> commit -> pull request
|
@@ -88,19 +99,22 @@ Run this from the command line to print the usage:
|
|
88
99
|
=== Commands
|
89
100
|
help # show this usage
|
90
101
|
|
91
|
-
domains:http
|
92
|
-
domains:mysql
|
93
|
-
domains:status
|
102
|
+
domains:http # list HTTP domain details
|
103
|
+
domains:mysql # list MySQL domains
|
104
|
+
domains:status # check availability of all domains (pingability)
|
94
105
|
|
95
|
-
dns
|
96
|
-
dns <name>
|
106
|
+
dns # list DNS records
|
107
|
+
dns <name> # list DNS records for <name>
|
108
|
+
dns:add <record> <type> <value> # add DNS record
|
109
|
+
dns:remove <record> <type> <value> # remove DNS record
|
97
110
|
|
98
|
-
announce
|
99
|
-
announce:
|
100
|
-
announce:
|
111
|
+
announce # list announce lists
|
112
|
+
announce:list <list> # list all subscribers to <name> list
|
113
|
+
announce:add <list> <email> # add subscriber with <email> to <list>
|
114
|
+
announce:remove <list> <email> # remove subscriber with <email> from <list>
|
101
115
|
|
102
|
-
users
|
103
|
-
users:pw
|
116
|
+
users # list user accounts: details
|
117
|
+
users:pw # list user accounts: usernames & passwords
|
104
118
|
|
105
119
|
|
106
120
|
That's it for now. New commands should be springing up as Dreamy and the DreamHost API mature!
|
@@ -108,7 +122,7 @@ That's it for now. New commands should be springing up as Dreamy and the DreamHo
|
|
108
122
|
TODO
|
109
123
|
====
|
110
124
|
|
111
|
-
*
|
125
|
+
* add PS commands (once DH creates test account)
|
112
126
|
* add real rdocs
|
113
127
|
|
114
128
|
[1]:http://github.com/sant0sk1/dreamy
|
data/VERSION.yml
CHANGED
data/lib/dreamy.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dreamy
|
2
|
+
class AnnounceList
|
3
|
+
include EasyClassMaker
|
4
|
+
|
5
|
+
attributes :account_id, :name, :domain, :short_name, :start_date, :max_bounces, :subscribers
|
6
|
+
|
7
|
+
def self.new_from_xml(xml)
|
8
|
+
l = new
|
9
|
+
l.account_id = (xml).at('account_id').innerHTML.to_i
|
10
|
+
l.short_name = (xml).at('listname').innerHTML
|
11
|
+
l.domain = (xml).at('domain').innerHTML
|
12
|
+
l.name = (xml).at('name').innerHTML
|
13
|
+
l.start_date = (xml).at('start_date').innerHTML
|
14
|
+
l.max_bounces = (xml).at('max_bounces').innerHTML.to_i
|
15
|
+
l.subscribers = (xml).at('num_subscribers').innerHTML.to_i
|
16
|
+
l
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/dreamy/base.rb
CHANGED
@@ -11,7 +11,7 @@ module Dreamy
|
|
11
11
|
# returns an array of domain objects
|
12
12
|
def domains
|
13
13
|
doc = request("domain-list_domains")
|
14
|
-
raise ApiError if (doc/:result).innerHTML == "error"
|
14
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
15
15
|
(doc/:data).inject([]) { |domains, domain| domains << Domain.new_from_xml(domain); domains }
|
16
16
|
end
|
17
17
|
|
@@ -22,21 +22,39 @@ module Dreamy
|
|
22
22
|
else
|
23
23
|
doc = request("user-list_users_no_pw")
|
24
24
|
end
|
25
|
-
raise ApiError if (doc/:result).innerHTML == "error"
|
25
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
26
26
|
(doc/:data).inject([]) { |users, user| users << User.new_from_xml(user); users }
|
27
27
|
end
|
28
28
|
|
29
29
|
# returns an array of dns objects
|
30
30
|
def dns
|
31
31
|
doc = request("dns-list_records")
|
32
|
-
raise ApiError if (doc/:result).innerHTML == "error"
|
32
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
33
33
|
(doc/:data).inject([]) { |records, dns| records << Dns.new_from_xml(dns); records }
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
|
+
def dns_add(record,type,value)
|
37
|
+
doc = request("dns-add_record", {"record" => record, "type" => type, "value" => value})
|
38
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
def dns_remove(record,type,value)
|
43
|
+
doc = request("dns-remove_record", {"record" => record, "type" => type, "value" => value})
|
44
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
48
|
+
def announce_lists
|
49
|
+
doc = request("announcement_list-list_lists")
|
50
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
51
|
+
(doc/:data).inject([]) { |lists, list| lists << AnnounceList.new_from_xml(list); lists }
|
52
|
+
end
|
53
|
+
|
36
54
|
# returns an array of subscriber objects
|
37
55
|
def announce_list(listname,domain)
|
38
56
|
doc = request("announcement_list-list_subscribers",{ "listname" => listname, "domain" => domain})
|
39
|
-
raise ApiError if (doc/:result).innerHTML == "error"
|
57
|
+
raise ApiError, (doc/:data).innerHTML if (doc/:result).innerHTML == "error"
|
40
58
|
(doc/:data).inject([]) { |subs, sub| subs << Subscriber.new_from_xml(sub); subs }
|
41
59
|
end
|
42
60
|
|
data/lib/dreamy/command.rb
CHANGED
@@ -3,23 +3,14 @@ require 'commands/base'
|
|
3
3
|
module Dreamy
|
4
4
|
module Command
|
5
5
|
class InvalidCommand < RuntimeError; end
|
6
|
-
class CommandFailed < RuntimeError; end
|
7
|
-
class Unauthorized < RuntimeError; end
|
8
6
|
|
9
7
|
class << self
|
10
|
-
def run(command, args
|
8
|
+
def run(command, args)
|
11
9
|
run_internal(command, args)
|
12
10
|
rescue InvalidCommand
|
13
11
|
error "Unknown command. Run 'dh help' for usage information."
|
14
|
-
rescue
|
15
|
-
|
16
|
-
STDERR.puts "Authentication failure"
|
17
|
-
run(command, args, retries+1)
|
18
|
-
else
|
19
|
-
error "Authentication failure"
|
20
|
-
end
|
21
|
-
rescue CommandFailed => e
|
22
|
-
error e.message
|
12
|
+
rescue ApiError => e
|
13
|
+
error "DreamHost returned this error: #{e}"
|
23
14
|
rescue Interrupt => e
|
24
15
|
error "\n[canceled]"
|
25
16
|
end
|
@@ -1,6 +1,20 @@
|
|
1
1
|
module Dreamy::Command
|
2
2
|
class Announce < Base
|
3
|
-
|
3
|
+
|
4
|
+
def index
|
5
|
+
lists = @account.announce_lists
|
6
|
+
|
7
|
+
if lists.empty?
|
8
|
+
display "No announcement lists on this account"
|
9
|
+
else
|
10
|
+
list_table = table do |t|
|
11
|
+
t.headings = 'Name', 'Short Name', 'Domain', 'Subscribers', 'Max Bounces', 'Start Date'
|
12
|
+
lists.each { |l| t << [l.name, l.short_name, l.domain, l.subscribers, l.max_bounces, l.start_date]}
|
13
|
+
end
|
14
|
+
display list_table
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
4
18
|
def list
|
5
19
|
if args.length >= 1
|
6
20
|
listname, domain = extract_values(args.shift)
|
data/lib/dreamy/commands/dns.rb
CHANGED
@@ -22,5 +22,27 @@ module Dreamy::Command
|
|
22
22
|
end
|
23
23
|
alias :index :list
|
24
24
|
|
25
|
+
def add
|
26
|
+
if args.length == 3
|
27
|
+
record, type, value = args[0], args[1], args[2]
|
28
|
+
@account.dns_add(record,type,value)
|
29
|
+
display "Successfully added #{type} record of #{value} to #{record}"
|
30
|
+
display "Please wait for DNS to propagate"
|
31
|
+
else
|
32
|
+
display "Usage: dh dns:add [new record] [type] [value]"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def remove
|
37
|
+
if args.length == 3
|
38
|
+
record, type, value = args[0], args[1], args[2]
|
39
|
+
@account.dns_remove(record,type,value)
|
40
|
+
display "Successfully removed #{type} record of #{value} to #{record}"
|
41
|
+
display "Please wait for DNS to propagate"
|
42
|
+
else
|
43
|
+
display "Usage: dh dns:remove [new record] [type] [value]"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
25
47
|
end
|
26
48
|
end
|
data/lib/dreamy/commands/help.rb
CHANGED
@@ -10,19 +10,22 @@ module Dreamy::Command
|
|
10
10
|
=== Commands
|
11
11
|
help # show this usage
|
12
12
|
|
13
|
-
domains:http
|
14
|
-
domains:mysql
|
15
|
-
domains:status
|
13
|
+
domains:http # list HTTP domain details
|
14
|
+
domains:mysql # list MySQL domains
|
15
|
+
domains:status # check availability of all domains (pingability)
|
16
16
|
|
17
|
-
dns
|
18
|
-
dns <name>
|
17
|
+
dns # list DNS records
|
18
|
+
dns <name> # list DNS records for <name>
|
19
|
+
dns:add <record> <type> <value> # add DNS record
|
20
|
+
dns:remove <record> <type> <value> # remove DNS record
|
19
21
|
|
20
|
-
announce
|
21
|
-
announce:
|
22
|
-
announce:
|
22
|
+
announce # list announce lists
|
23
|
+
announce:list <list> # list all subscribers to <name> list
|
24
|
+
announce:add <list> <email> # add subscriber with <email> to <list>
|
25
|
+
announce:remove <list> <email> # remove subscriber with <email> from <list>
|
23
26
|
|
24
|
-
users
|
25
|
-
users:pw
|
27
|
+
users # list user accounts: details
|
28
|
+
users:pw # list user accounts: usernames & passwords
|
26
29
|
|
27
30
|
EOTXT
|
28
31
|
end
|
data/lib/dreamy/dns.rb
CHANGED
@@ -6,9 +6,9 @@ module Dreamy
|
|
6
6
|
|
7
7
|
def self.new_from_xml(xml)
|
8
8
|
d = new
|
9
|
-
d.account_id = (xml).at('account_id').innerHTML
|
9
|
+
d.account_id = (xml).at('account_id').innerHTML.to_i
|
10
10
|
d.comment = (xml).at('comment').innerHTML
|
11
|
-
d.editable = (xml).at('editable').innerHTML
|
11
|
+
d.editable = (xml).at('editable').innerHTML.to_i
|
12
12
|
d.record = (xml).at('record').innerHTML
|
13
13
|
d.type = (xml).at('type').innerHTML
|
14
14
|
d.value = (xml).at('value').innerHTML
|
data/lib/dreamy/domain.rb
CHANGED
@@ -8,24 +8,24 @@ module Dreamy
|
|
8
8
|
def self.new_from_xml(xml)
|
9
9
|
d = new
|
10
10
|
|
11
|
-
d.account_id = (xml).at('account_id').innerHTML
|
11
|
+
d.account_id = (xml).at('account_id').innerHTML.to_i
|
12
12
|
d.domain = (xml).at('domain').innerHTML
|
13
13
|
d.home = (xml).at('home').innerHTML
|
14
14
|
d.type = (xml).at('type').innerHTML
|
15
15
|
d.unique_ip = (xml).at('unique_ip').innerHTML
|
16
16
|
|
17
17
|
if d.type == 'http'
|
18
|
-
d.fastcgi = (xml).at('fastcgi').innerHTML
|
18
|
+
d.fastcgi = (xml).at('fastcgi').innerHTML.to_i
|
19
19
|
d.hosting_type = (xml).at('hosting_type').innerHTML
|
20
20
|
d.outside_url = (xml).at('outside_url').innerHTML
|
21
|
-
d.passenger = (xml).at('passenger').innerHTML
|
21
|
+
d.passenger = (xml).at('passenger').innerHTML.to_i
|
22
22
|
d.path = (xml).at('path').innerHTML
|
23
23
|
d.php = (xml).at('php').innerHTML
|
24
|
-
d.php_fcgid = (xml).at('php_fcgid').innerHTML
|
25
|
-
d.security = (xml).at('security').innerHTML
|
24
|
+
d.php_fcgid = (xml).at('php_fcgid').innerHTML.to_i
|
25
|
+
d.security = (xml).at('security').innerHTML.to_i
|
26
26
|
d.user = (xml).at('user').innerHTML
|
27
27
|
d.www_or_not = (xml).at('www_or_not').innerHTML
|
28
|
-
d.xcache = (xml).at('xcache').innerHTML
|
28
|
+
d.xcache = (xml).at('xcache').innerHTML.to_i
|
29
29
|
end
|
30
30
|
|
31
31
|
d
|
data/lib/dreamy/subscriber.rb
CHANGED
@@ -7,10 +7,10 @@ module Dreamy
|
|
7
7
|
def self.new_from_xml(xml)
|
8
8
|
s = new
|
9
9
|
s.email = (xml).at('email').innerHTML
|
10
|
-
s.confirmed = (xml).at('confirmed').innerHTML
|
10
|
+
s.confirmed = (xml).at('confirmed').innerHTML.to_i
|
11
11
|
s.subscribe_date = (xml).at('subscribe_date').innerHTML
|
12
12
|
s.name = (xml).at('name').innerHTML
|
13
|
-
s.num_bounces = (xml).at('num_bounces').innerHTML
|
13
|
+
s.num_bounces = (xml).at('num_bounces').innerHTML.to_i
|
14
14
|
s
|
15
15
|
end
|
16
16
|
end
|
data/lib/dreamy/user.rb
CHANGED
@@ -6,12 +6,12 @@ module Dreamy
|
|
6
6
|
|
7
7
|
def self.new_from_xml(xml)
|
8
8
|
u = new
|
9
|
-
u.account_id = (xml).at('account_id').innerHTML
|
10
|
-
u.disk_used_mb = (xml).at('disk_used_mb').innerHTML
|
9
|
+
u.account_id = (xml).at('account_id').innerHTML.to_i
|
10
|
+
u.disk_used_mb = (xml).at('disk_used_mb').innerHTML.to_f
|
11
11
|
u.gecos = (xml).at('gecos').innerHTML
|
12
12
|
u.home = (xml).at('home').innerHTML
|
13
13
|
u.password = (xml).at('password').innerHTML
|
14
|
-
u.quota_mb = (xml).at('quota_mb').innerHTML
|
14
|
+
u.quota_mb = (xml).at('quota_mb').innerHTML.to_i
|
15
15
|
u.shell = (xml).at('shell').innerHTML
|
16
16
|
u.type = (xml).at('type').innerHTML
|
17
17
|
u.username = (xml).at('username').innerHTML
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/test_helper.rb"
|
2
|
+
|
3
|
+
class DreamyAnnounceListTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "Creation" do
|
6
|
+
setup do
|
7
|
+
@xml = <<EOF
|
8
|
+
<data>
|
9
|
+
<name>Super Announce</name>
|
10
|
+
<account_id>8675309</account_id>
|
11
|
+
<domain>anessalee.net</domain>
|
12
|
+
<listname>testlist</listname>
|
13
|
+
<max_bounces>5</max_bounces>
|
14
|
+
<num_subscribers>22</num_subscribers>
|
15
|
+
<start_date>2009-04-20</start_date>
|
16
|
+
</data>
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
|
20
|
+
should "create a new list of announce lists from xml" do
|
21
|
+
l = Dreamy::AnnounceList.new_from_xml(Hpricot.XML(@xml))
|
22
|
+
assert_equal "Super Announce", l.name
|
23
|
+
assert_equal 8675309, l.account_id
|
24
|
+
assert_equal "anessalee.net", l.domain
|
25
|
+
assert_equal "testlist", l.short_name
|
26
|
+
assert_equal 5, l.max_bounces
|
27
|
+
assert_equal 22, l.subscribers
|
28
|
+
assert_equal "2009-04-20", l.start_date
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
data/test/base_test.rb
CHANGED
@@ -15,8 +15,9 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
15
15
|
context "Domains" do
|
16
16
|
|
17
17
|
should "return array of domain objects" do
|
18
|
-
|
19
|
-
assert_kind_of
|
18
|
+
domains = @@base.domains
|
19
|
+
assert_kind_of Array, domains
|
20
|
+
assert_kind_of Dreamy::Domain, domains.first unless domains.empty?
|
20
21
|
end
|
21
22
|
|
22
23
|
end
|
@@ -24,8 +25,9 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
24
25
|
context "Users" do
|
25
26
|
|
26
27
|
should "return array of user objects" do
|
27
|
-
|
28
|
-
assert_kind_of
|
28
|
+
users = @@base.users
|
29
|
+
assert_kind_of Array, users
|
30
|
+
assert_kind_of Dreamy::User, users.first unless users.empty?
|
29
31
|
end
|
30
32
|
|
31
33
|
should "not include user passwords by default" do
|
@@ -36,12 +38,64 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
36
38
|
context "DNS" do
|
37
39
|
|
38
40
|
should "return array of DNS records" do
|
39
|
-
|
40
|
-
assert_kind_of
|
41
|
+
records = @@base.dns
|
42
|
+
assert_kind_of Array, records
|
43
|
+
assert_kind_of Dreamy::Dns, records.first unless records.empty?
|
41
44
|
end
|
45
|
+
|
46
|
+
context "adding a record" do
|
47
|
+
setup { @record_count = @@base.dns.size }
|
48
|
+
|
49
|
+
should "require 3 arguments" do
|
50
|
+
assert_raise(ArgumentError) { @@base.dns_add("first","second") }
|
51
|
+
end
|
52
|
+
|
53
|
+
should "add record and return true with valid data" do
|
54
|
+
assert @@base.dns_add("test." + CREDS["domain"],"A","208.97.188.35")
|
55
|
+
assert_equal @record_count + 1, @@base.dns.size
|
56
|
+
end
|
57
|
+
|
58
|
+
should "not add record and raise error with invalid data" do
|
59
|
+
assert_raise(Dreamy::ApiError) { @@base.dns_add("test." + CREDS["domain"],"B","208.97.188.35") }
|
60
|
+
assert_equal @record_count, @@base.dns.size
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
context "removing a record" do
|
66
|
+
setup { @record_count = @@base.dns.size }
|
67
|
+
|
68
|
+
should "require 3 arguments" do
|
69
|
+
assert_raise(ArgumentError) { @@base.dns_remove("first","second") }
|
70
|
+
end
|
71
|
+
|
72
|
+
should "remove record and return true with valid data" do
|
73
|
+
assert @@base.dns_remove("test." + CREDS["domain"],"A","208.97.188.35")
|
74
|
+
@record_count -= 1
|
75
|
+
assert_equal @record_count, @@base.dns.size
|
76
|
+
end
|
77
|
+
|
78
|
+
should "not remove record and raise error with invalid data" do
|
79
|
+
assert_raise(Dreamy::ApiError) { @@base.dns_remove("test." + CREDS["domain"],"B","208.97.188.35") }
|
80
|
+
assert_equal @record_count, @@base.dns.size
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
42
85
|
end
|
43
86
|
|
44
87
|
context "Announcement lists" do
|
88
|
+
|
89
|
+
context "listing lists" do
|
90
|
+
|
91
|
+
should "return array of AnnounceList records" do
|
92
|
+
lists = @@base.announce_lists
|
93
|
+
assert_kind_of Array, lists
|
94
|
+
assert_kind_of Dreamy::AnnounceList, lists.first unless lists.empty?
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
|
45
99
|
context "subscribers" do
|
46
100
|
|
47
101
|
should "require values for listname and domain" do
|
@@ -51,7 +105,7 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
51
105
|
should "return array of Subscriber records" do
|
52
106
|
subscribers = @@base.announce_list(CREDS["listname"],CREDS["domain"])
|
53
107
|
assert_kind_of Array, subscribers
|
54
|
-
assert_kind_of Dreamy::Subscriber, subscribers.first
|
108
|
+
assert_kind_of Dreamy::Subscriber, subscribers.first unless subscribers.empty?
|
55
109
|
end
|
56
110
|
|
57
111
|
end
|
@@ -62,9 +116,9 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
62
116
|
assert_raise(ArgumentError) { @@base.announce_add() }
|
63
117
|
end
|
64
118
|
|
65
|
-
should "return true on success" do
|
66
|
-
|
67
|
-
end
|
119
|
+
# should "return true on success" do
|
120
|
+
# assert @@base.announce_add(CREDS["listname"],CREDS["domain"],"new_guy@test.com")
|
121
|
+
# end
|
68
122
|
|
69
123
|
end
|
70
124
|
|
@@ -74,9 +128,9 @@ class DreamyBaseTest < Test::Unit::TestCase
|
|
74
128
|
assert_raise(ArgumentError) { @@base.announce_remove() }
|
75
129
|
end
|
76
130
|
|
77
|
-
should "return true on success" do
|
78
|
-
|
79
|
-
end
|
131
|
+
# should "return true on success" do
|
132
|
+
# assert @@base.announce_remove(CREDS["listname"],CREDS["domain"],"new_guy@test.com")
|
133
|
+
# end
|
80
134
|
|
81
135
|
end
|
82
136
|
|
data/test/dns_test.rb
CHANGED
@@ -19,9 +19,9 @@ EOF
|
|
19
19
|
|
20
20
|
should "create a new DNS entry from xml" do
|
21
21
|
d = Dreamy::Dns.new_from_xml(Hpricot.XML(@xml))
|
22
|
-
assert_equal
|
22
|
+
assert_equal 8675309, d.account_id
|
23
23
|
assert_equal "", d.comment
|
24
|
-
assert_equal
|
24
|
+
assert_equal 0, d.editable
|
25
25
|
assert_equal "anessalee.net", d.record
|
26
26
|
assert_equal "A", d.type
|
27
27
|
assert_equal "202.22.191.4", d.value
|
data/test/domain_test.rb
CHANGED
@@ -40,26 +40,26 @@ EOF
|
|
40
40
|
end
|
41
41
|
|
42
42
|
should "assign valid http domain from xml" do
|
43
|
-
assert_equal
|
43
|
+
assert_equal 8675309, @d.account_id
|
44
44
|
assert_equal "anessalee.net", @d.domain
|
45
|
-
assert_equal
|
45
|
+
assert_equal 0, @d.fastcgi
|
46
46
|
assert_equal "juniormint.Dreamy.com", @d.home
|
47
47
|
assert_equal "full", @d.hosting_type
|
48
48
|
assert_equal "", @d.outside_url
|
49
|
-
assert_equal
|
49
|
+
assert_equal 0, @d.passenger
|
50
50
|
assert_equal "anessalee.net", @d.path
|
51
51
|
assert_equal "pcgi5", @d.php
|
52
|
-
assert_equal
|
53
|
-
assert_equal
|
52
|
+
assert_equal 0, @d.php_fcgid
|
53
|
+
assert_equal 0, @d.security
|
54
54
|
assert_equal "http", @d.type
|
55
55
|
assert_equal "", @d.unique_ip
|
56
56
|
assert_equal "sant0sk1", @d.user
|
57
57
|
assert_equal "both_work", @d.www_or_not
|
58
|
-
assert_equal
|
58
|
+
assert_equal 0, @d.xcache
|
59
59
|
end
|
60
60
|
|
61
61
|
should "assign valid mysql domain from xml" do
|
62
|
-
assert_equal
|
62
|
+
assert_equal 8675309, @m.account_id
|
63
63
|
assert_equal "mysql.anessalee.net", @m.domain
|
64
64
|
assert_equal "zechiel.swordfish.Dreamy.com", @m.home
|
65
65
|
assert_equal "mysqldns", @m.type
|
data/test/subscriber_test.rb
CHANGED
@@ -18,10 +18,10 @@ EOF
|
|
18
18
|
should "create a new user from xml" do
|
19
19
|
s = Dreamy::Subscriber.new_from_xml(Hpricot.XML(@xml))
|
20
20
|
assert_equal "joe@schmoe.com", s.email
|
21
|
-
|
21
|
+
assert_equal 1, s.confirmed
|
22
22
|
assert_equal "2007-12-13 16:55:15", s.subscribe_date
|
23
23
|
assert_equal "Josh", s.name
|
24
|
-
assert_equal
|
24
|
+
assert_equal 0, s.num_bounces
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/test/user_test.rb
CHANGED
@@ -7,7 +7,7 @@ class DreamyUserTest < Test::Unit::TestCase
|
|
7
7
|
@xml = <<EOF
|
8
8
|
<data>
|
9
9
|
<account_id>8675309</account_id>
|
10
|
-
<disk_used_mb>
|
10
|
+
<disk_used_mb>123.04</disk_used_mb>
|
11
11
|
<gecos>Joe Schmoe</gecos>
|
12
12
|
<home>spork.Dreamy.com</home>
|
13
13
|
<password>YahRight!</password>
|
@@ -21,12 +21,12 @@ EOF
|
|
21
21
|
|
22
22
|
should "create a new user from xml" do
|
23
23
|
u = Dreamy::User.new_from_xml(Hpricot.XML(@xml))
|
24
|
-
assert_equal
|
25
|
-
assert_equal
|
24
|
+
assert_equal 8675309, u.account_id
|
25
|
+
assert_equal 123.04, u.disk_used_mb
|
26
26
|
assert_equal "Joe Schmoe", u.gecos
|
27
27
|
assert_equal "spork.Dreamy.com", u.home
|
28
28
|
assert_equal "YahRight!", u.password
|
29
|
-
assert_equal
|
29
|
+
assert_equal 50, u.quota_mb
|
30
30
|
assert_equal "/bin/bash", u.shell
|
31
31
|
assert_equal "mail", u.type
|
32
32
|
assert_equal "joe@schmoe.com", u.username
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sant0sk1-dreamy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerod Santo
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-25 00:00:00 -07:00
|
13
13
|
default_executable: dh
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- VERSION.yml
|
57
57
|
- bin/dh
|
58
58
|
- lib/dreamy.rb
|
59
|
+
- lib/dreamy/announce_list.rb
|
59
60
|
- lib/dreamy/base.rb
|
60
61
|
- lib/dreamy/command.rb
|
61
62
|
- lib/dreamy/commands/announce.rb
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- lib/dreamy/easy_class_maker.rb
|
71
72
|
- lib/dreamy/subscriber.rb
|
72
73
|
- lib/dreamy/user.rb
|
74
|
+
- test/announce_test.rb
|
73
75
|
- test/base_test.rb
|
74
76
|
- test/dns_test.rb
|
75
77
|
- test/domain_test.rb
|
@@ -103,6 +105,7 @@ signing_key:
|
|
103
105
|
specification_version: 2
|
104
106
|
summary: A Ruby library and command line tool for accessing DreamHost's API
|
105
107
|
test_files:
|
108
|
+
- test/announce_test.rb
|
106
109
|
- test/base_test.rb
|
107
110
|
- test/dns_test.rb
|
108
111
|
- test/domain_test.rb
|