dnsimple-ruby 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/dnsimple.rb +1 -0
- data/lib/dnsimple/cli.rb +2 -0
- data/lib/dnsimple/commands/check_domain.rb +11 -0
- data/lib/dnsimple/domain.rb +27 -2
- metadata +6 -5
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.1
|
data/bin/dnsimple.rb
CHANGED
@@ -35,6 +35,7 @@ help # Show this usage
|
|
35
35
|
info # Show your account information
|
36
36
|
|
37
37
|
list # List all domains
|
38
|
+
check domain.com # Check if a domain is available (for registration)
|
38
39
|
describe domain.com # Describe the given domain
|
39
40
|
create [--template=short_name] domain.com # Add the given domain
|
40
41
|
register [--template=short_name] domain.com registrant_id # Register the given domain with DNSimple
|
data/lib/dnsimple/cli.rb
CHANGED
@@ -31,6 +31,7 @@ module DNSimple
|
|
31
31
|
{
|
32
32
|
'info' => DNSimple::Commands::DescribeUser,
|
33
33
|
|
34
|
+
'check' => DNSimple::Commands::CheckDomain,
|
34
35
|
'create' => DNSimple::Commands::CreateDomain,
|
35
36
|
'register' => DNSimple::Commands::RegisterDomain,
|
36
37
|
'transfer' => DNSimple::Commands::TransferDomain,
|
@@ -68,6 +69,7 @@ module DNSimple
|
|
68
69
|
end
|
69
70
|
|
70
71
|
require 'dnsimple/commands/describe_user'
|
72
|
+
require 'dnsimple/commands/check_domain'
|
71
73
|
require 'dnsimple/commands/create_domain'
|
72
74
|
require 'dnsimple/commands/register_domain'
|
73
75
|
require 'dnsimple/commands/transfer_domain'
|
data/lib/dnsimple/domain.rb
CHANGED
@@ -36,12 +36,37 @@ module DNSimple #:nodoc:
|
|
36
36
|
|
37
37
|
# Apply the given named template to the domain. This will add
|
38
38
|
# all of the records in the template to the domain.
|
39
|
-
def apply(
|
40
|
-
template =
|
39
|
+
def apply(template, options={})
|
40
|
+
template = resolve_template(template)
|
41
41
|
options.merge!({:basic_auth => Client.credentials})
|
42
42
|
self.class.post("#{Client.base_uri}/domains/#{id}/templates/#{template.id}/apply.json", options)
|
43
43
|
end
|
44
44
|
|
45
|
+
def resolve_template(template)
|
46
|
+
case template
|
47
|
+
when DNSimple::Template
|
48
|
+
template
|
49
|
+
else
|
50
|
+
DNSimple::Template.find(template)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.check(name, options={})
|
55
|
+
options.merge!(:basic_auth => Client.credentials)
|
56
|
+
response = self.get("#{Client.base_uri}/domains/#{name}/check.json", options)
|
57
|
+
pp response if Client.debug?
|
58
|
+
case response.code
|
59
|
+
when 200
|
60
|
+
"registered"
|
61
|
+
when 401
|
62
|
+
raise RuntimeError, "Authentication failed"
|
63
|
+
when 404
|
64
|
+
"available"
|
65
|
+
else
|
66
|
+
raise "Error: #{response.code}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
45
70
|
# Create the domain with the given name in DNSimple. This
|
46
71
|
# method returns a Domain instance if the name is created
|
47
72
|
# and raises an error otherwise.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnsimple-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 1
|
10
|
+
version: 0.7.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anthony Eden
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-12 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/dnsimple/client.rb
|
63
63
|
- lib/dnsimple/commands/add_template_record.rb
|
64
64
|
- lib/dnsimple/commands/apply_template.rb
|
65
|
+
- lib/dnsimple/commands/check_domain.rb
|
65
66
|
- lib/dnsimple/commands/clear_domain.rb
|
66
67
|
- lib/dnsimple/commands/create_contact.rb
|
67
68
|
- lib/dnsimple/commands/create_domain.rb
|