Class: Rubber::Dns::Zerigo
- Inherits:
-
Base
- Object
- Base
- Rubber::Dns::Zerigo
show all
- Defined in:
- lib/rubber/dns/zerigo.rb
Instance Attribute Summary
Attributes inherited from Base
#env
Instance Method Summary
collapse
Methods inherited from Base
#destroy, #hostname, #up_to_date, #update
Constructor Details
#initialize(env) ⇒ Zerigo
Returns a new instance of Zerigo.
76
77
78
79
80
81
82
|
# File 'lib/rubber/dns/zerigo.rb', line 76
def initialize(env)
super(env)
@zerigo_env = env.dns_providers.zerigo
@ttl = (@zerigo_env.ttl || 300).to_i
@record_type = @zerigo_env.record_type || "A"
@zone = Zone.new(@zerigo_env.customer_id, @zerigo_env.email, @zerigo_env.token, env.domain)
end
|
Instance Method Details
#create_host_record(host, ip) ⇒ Object
92
93
94
95
96
97
98
99
|
# File 'lib/rubber/dns/zerigo.rb', line 92
def create_host_record(host, ip)
host = @zone.new_host()
host['host-type'] = @record_type
host['ttl'] = @ttl
host['hostname'] = host
host['data'] = ip
@zone.create_host(host)
end
|
#destroy_host_record(host) ⇒ Object
101
102
103
|
# File 'lib/rubber/dns/zerigo.rb', line 101
def destroy_host_record(host)
@zone.delete_host(host)
end
|
#host_exists?(host) ⇒ Boolean
88
89
90
|
# File 'lib/rubber/dns/zerigo.rb', line 88
def host_exists?(host)
@zone.host(host)
end
|
#nameserver ⇒ Object
84
85
86
|
# File 'lib/rubber/dns/zerigo.rb', line 84
def nameserver
"a.ns.zerigo.net"
end
|
#update_domain_record(ip) ⇒ Object
update the top level domain record which has an empty hostName
112
113
114
115
116
|
# File 'lib/rubber/dns/zerigo.rb', line 112
def update_domain_record(ip)
old = @zone.hosts.find {|h| h['hostname'].nil? }
old['data'] = ip
@zone.update_host(old)
end
|
#update_host_record(host, ip) ⇒ Object
105
106
107
108
109
|
# File 'lib/rubber/dns/zerigo.rb', line 105
def update_host_record(host, ip)
old = @zone.host(host)
old['data'] = ip
@zone.update_host(old)
end
|