enom 0.9.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/enom.rb +0 -1
- data/lib/enom/domain.rb +2 -2
- data/test/account_test.rb +1 -0
- data/test/cli_test.rb +0 -8
- data/test/contact_info_test.rb +23 -0
- data/test/domain_test.rb +56 -9
- data/test/test_helper.rb +96 -2
- metadata +4 -3
data/bin/enom.rb
CHANGED
@@ -32,7 +32,6 @@ All commands are executed as enom [options] command [command-options] args
|
|
32
32
|
The following commands are available:
|
33
33
|
|
34
34
|
help # Show this usage
|
35
|
-
info # Show your account information
|
36
35
|
|
37
36
|
list # List all domains
|
38
37
|
check domain.com # Check if a domain is available (for registration)
|
data/lib/enom/domain.rb
CHANGED
@@ -100,7 +100,7 @@ module Enom
|
|
100
100
|
|
101
101
|
# Check if the domain is currently locked. locked? helper method also available
|
102
102
|
def locked
|
103
|
-
unless @locked
|
103
|
+
unless defined?(@locked)
|
104
104
|
response = Client.request('Command' => 'GetRegLock', 'SLD' => sld, 'TLD' => tld)['interface_response']['reg_lock']
|
105
105
|
@locked = response == '1'
|
106
106
|
end
|
@@ -137,7 +137,7 @@ module Enom
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def expiration_date
|
140
|
-
unless @expiration_date
|
140
|
+
unless defined?(@expiration_date)
|
141
141
|
date_string = @domain_payload['interface_response']['GetDomainInfo']['status']['expiration']
|
142
142
|
@expiration_date = Date.strptime(date_string.split(' ').first, "%m/%d/%Y")
|
143
143
|
end
|
data/test/account_test.rb
CHANGED
data/test/cli_test.rb
CHANGED
@@ -32,14 +32,6 @@ class CliTest < Test::Unit::TestCase
|
|
32
32
|
assert_equal "Renewed test123456test123456.com", @cli.execute("renew", ["test123456test123456.com"])
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
36
|
-
# context "'describe'" do
|
37
|
-
# should "show the domain information" do
|
38
|
-
# assert_equal "...", @cli.execute("describe", ["test1234test1234.com"])
|
39
|
-
# end
|
40
|
-
# end
|
41
|
-
|
42
|
-
|
43
35
|
end
|
44
36
|
|
45
37
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ContactInfoTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "A domain in your account" do
|
6
|
+
setup do
|
7
|
+
Enom::Client.username = "resellid"
|
8
|
+
Enom::Client.password = "resellpw"
|
9
|
+
Enom::Client.test = false
|
10
|
+
@domain = Enom::Domain.find("test123456test123456.com")
|
11
|
+
end
|
12
|
+
|
13
|
+
should "respond to included contact methods" do
|
14
|
+
Enom::ContactInfo::CONTACT_TYPES.each do |contact_type|
|
15
|
+
assert_respond_to @domain, "#{contact_type.downcase}_contact_info"
|
16
|
+
assert_respond_to @domain, "update_#{contact_type.downcase}_contact_info"
|
17
|
+
end
|
18
|
+
assert_respond_to @domain, :all_contact_info
|
19
|
+
assert_respond_to @domain, :update_all_contact_info
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/test/domain_test.rb
CHANGED
@@ -9,6 +9,20 @@ class DomainTest < Test::Unit::TestCase
|
|
9
9
|
Enom::Client.test = false
|
10
10
|
end
|
11
11
|
|
12
|
+
context "listing all domains" do
|
13
|
+
setup do
|
14
|
+
@domains = Enom::Domain.all
|
15
|
+
end
|
16
|
+
should "return several domain objects" do
|
17
|
+
@domains.each do |domain|
|
18
|
+
assert_kind_of Enom::Domain, domain
|
19
|
+
end
|
20
|
+
end
|
21
|
+
should "return two domains" do
|
22
|
+
assert_equal 2, @domains.size
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
12
26
|
context "checking for available domains" do
|
13
27
|
should "return 'available' for an available domain" do
|
14
28
|
assert_equal "available", Enom::Domain.check("test123456test123456.com")
|
@@ -63,15 +77,48 @@ class DomainTest < Test::Unit::TestCase
|
|
63
77
|
assert !@domain.unlocked?
|
64
78
|
end
|
65
79
|
|
66
|
-
|
67
|
-
nameservers
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
80
|
+
context "with default nameservers" do
|
81
|
+
should "have default Enom nameservers" do
|
82
|
+
nameservers = [
|
83
|
+
"dns1.name-services.com",
|
84
|
+
"dns2.name-services.com",
|
85
|
+
"dns3.name-services.com",
|
86
|
+
"dns4.name-services.com",
|
87
|
+
"dns5.name-services.com"
|
88
|
+
]
|
89
|
+
assert_equal nameservers, @domain.nameservers
|
90
|
+
end
|
91
|
+
should "update nameservers if there are 2 or more provided" do
|
92
|
+
new_nameservers = ["ns1.foo.com", "ns2.foo.com"]
|
93
|
+
@domain.update_nameservers(new_nameservers)
|
94
|
+
assert_equal new_nameservers, @domain.nameservers
|
95
|
+
end
|
96
|
+
should "not update nameservers if less than 2 or more than 12 are provided" do
|
97
|
+
not_enough = ["ns1.foo.com"]
|
98
|
+
too_many = ["ns1.foo.com", "ns2.foo.com", "ns3.foo.com", "ns4.foo.com", "ns5.foo.com", "ns6.foo.com", "ns7.foo.com", "ns8.foo.com", "ns9.foo.com", "ns10.foo.com", "ns11.foo.com", "ns12.foo.com", "ns13.foo.com"]
|
99
|
+
assert_raises Enom::InvalidNameServerCount do
|
100
|
+
@domain.update_nameservers(not_enough)
|
101
|
+
end
|
102
|
+
assert_raises Enom::InvalidNameServerCount do
|
103
|
+
@domain.update_nameservers(too_many)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
should "have an expiration date" do
|
109
|
+
assert_kind_of Date, @domain.expiration_date
|
110
|
+
assert_equal "2012-01-30", @domain.expiration_date.strftime("%Y-%m-%d")
|
111
|
+
end
|
112
|
+
|
113
|
+
context "that is currently locked" do
|
114
|
+
setup do
|
115
|
+
@domain.unlock
|
116
|
+
end
|
117
|
+
|
118
|
+
should "unlock successfully" do
|
119
|
+
assert !@domain.locked?
|
120
|
+
assert @domain.unlocked?
|
121
|
+
end
|
75
122
|
end
|
76
123
|
end
|
77
124
|
end
|
data/test/test_helper.rb
CHANGED
@@ -241,8 +241,8 @@ class Test::Unit::TestCase
|
|
241
241
|
<DomainCount>74</DomainCount>
|
242
242
|
<Command>GETBALANCE</Command>
|
243
243
|
<ErrCount>0</ErrCount>
|
244
|
-
<Server>
|
245
|
-
<Site>
|
244
|
+
<Server>RESELLERTEST</Server>
|
245
|
+
<Site>eNom</Site>
|
246
246
|
<Done>true</Done>
|
247
247
|
<debug><![CDATA[]]></debug>
|
248
248
|
</interface-response>
|
@@ -274,6 +274,100 @@ class Test::Unit::TestCase
|
|
274
274
|
<debug><![CDATA[]]></debug>
|
275
275
|
</interface-response>
|
276
276
|
EOF
|
277
|
+
},
|
278
|
+
{
|
279
|
+
:command => "SetRegLock",
|
280
|
+
:request => "https://reseller.enom.com/interface.asp?Command=SetRegLock&SLD=test123456test123456&TLD=com&UnlockRegistrar=1&UID=resellid&PW=resellpw&ResponseType=xml",
|
281
|
+
:response => <<-EOF
|
282
|
+
<?xml version="1.0"?>
|
283
|
+
<interface-response>
|
284
|
+
<RegistrarLock>ACTIVE</RegistrarLock>
|
285
|
+
<RRPCodeSR>200</RRPCodeSR>
|
286
|
+
<RRPText>Command completed successfully</RRPText>
|
287
|
+
<Command>SETREGLOCK</Command>
|
288
|
+
<Language>eng</Language>
|
289
|
+
<ErrCount>0</ErrCount>
|
290
|
+
<ResponseCount>0</ResponseCount>
|
291
|
+
<MinPeriod>1</MinPeriod>
|
292
|
+
<MaxPeriod>10</MaxPeriod>
|
293
|
+
<Server>RESELLERTEST</Server>
|
294
|
+
<Site>eNom</Site>
|
295
|
+
<IsLockable>True</IsLockable>
|
296
|
+
<IsRealTimeTLD>True</IsRealTimeTLD>
|
297
|
+
<TimeDifference>+08.00</TimeDifference>
|
298
|
+
<ExecTime>1.016</ExecTime>
|
299
|
+
<Done>true</Done>
|
300
|
+
<debug><![CDATA[]]></debug>
|
301
|
+
</interface-response>
|
302
|
+
EOF
|
303
|
+
},
|
304
|
+
{
|
305
|
+
:command => "ModifyNS",
|
306
|
+
:request => "https://reseller.enom.com/interface.asp?Command=ModifyNS&SLD=test123456test123456&TLD=com&NS1=ns1.foo.com&NS2=ns2.foo.com&UID=resellid&PW=resellpw&ResponseType=xml",
|
307
|
+
:response => <<-EOF
|
308
|
+
<?xml version="1.0"?>
|
309
|
+
<interface-response>
|
310
|
+
<reg-lock>0</reg-lock>
|
311
|
+
<registrar>E</registrar>
|
312
|
+
<RRPCode>200</RRPCode>
|
313
|
+
<RRPText>Command completed successfully</RRPText>
|
314
|
+
<Command>MODIFYNS</Command>
|
315
|
+
<Language>eng</Language>
|
316
|
+
<ErrCount>0</ErrCount>
|
317
|
+
<ResponseCount>0</ResponseCount>
|
318
|
+
<MinPeriod>1</MinPeriod>
|
319
|
+
<MaxPeriod>10</MaxPeriod>
|
320
|
+
<Server>RESELLERTEST</Server>
|
321
|
+
<Site>eNom</Site>
|
322
|
+
<IsLockable>True</IsLockable>
|
323
|
+
<IsRealTimeTLD>True</IsRealTimeTLD>
|
324
|
+
<TimeDifference>+08.00</TimeDifference>
|
325
|
+
<ExecTime>1.594</ExecTime>
|
326
|
+
<Done>true</Done>
|
327
|
+
<debug><![CDATA[]]></debug>
|
328
|
+
</interface-response>
|
329
|
+
EOF
|
330
|
+
},
|
331
|
+
{
|
332
|
+
:command => "GetAllDomains",
|
333
|
+
:request => "https://reseller.enom.com/interface.asp?Command=GetAllDomains&UID=resellid&PW=resellpw&ResponseType=xml",
|
334
|
+
:response => <<-EOF
|
335
|
+
<?xml version="1.0"?>
|
336
|
+
<interface-response>
|
337
|
+
<GetAllDomains>
|
338
|
+
<DomainDetail>
|
339
|
+
<DomainName>test1234567test1234567.com</DomainName>
|
340
|
+
<DomainNameID>340724808</DomainNameID>
|
341
|
+
<expiration-date>1/30/2012 5:23:00 PM</expiration-date>
|
342
|
+
<lockstatus>Locked</lockstatus>
|
343
|
+
<AutoRenew>No</AutoRenew>
|
344
|
+
</DomainDetail>
|
345
|
+
<DomainDetail>
|
346
|
+
<DomainName>test123456test123456.com</DomainName>
|
347
|
+
<DomainNameID>340724807</DomainNameID>
|
348
|
+
<expiration-date>1/30/2013 5:21:00 PM</expiration-date>
|
349
|
+
<lockstatus>Locked</lockstatus>
|
350
|
+
<AutoRenew>No</AutoRenew>
|
351
|
+
</DomainDetail>
|
352
|
+
<domaincount>2</domaincount>
|
353
|
+
<UserRequestStatus>DomainBox</UserRequestStatus>
|
354
|
+
</GetAllDomains>
|
355
|
+
<Command>GETALLDOMAINS</Command>
|
356
|
+
<Language>eng</Language>
|
357
|
+
<ErrCount>0</ErrCount>
|
358
|
+
<ResponseCount>0</ResponseCount>
|
359
|
+
<MinPeriod/>
|
360
|
+
<MaxPeriod>10</MaxPeriod>
|
361
|
+
<Server>RESELLERTEST</Server>
|
362
|
+
<Site>eNom</Site>
|
363
|
+
<IsLockable/>
|
364
|
+
<IsRealTimeTLD/>
|
365
|
+
<TimeDifference>+0.00</TimeDifference>
|
366
|
+
<ExecTime>0.156</ExecTime>
|
367
|
+
<Done>true</Done>
|
368
|
+
<debug><![CDATA[]]></debug>
|
369
|
+
</interface-response>
|
370
|
+
EOF
|
277
371
|
}
|
278
372
|
]
|
279
373
|
|
metadata
CHANGED
@@ -3,10 +3,10 @@ name: enom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
+
- 1
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
|
9
|
-
version: 0.9.10
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- James Miller
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- test/account_test.rb
|
86
86
|
- test/cli_test.rb
|
87
87
|
- test/client_test.rb
|
88
|
+
- test/contact_info_test.rb
|
88
89
|
- test/domain_test.rb
|
89
90
|
- test/test_helper.rb
|
90
91
|
- bin/enom
|