Class: Rubber::Dns::Zerigo

Inherits:
Base
  • Object
show all
Defined in:
lib/rubber/dns/zerigo.rb

Instance Attribute Summary

Attributes inherited from Base

#env, #provider_env, #provider_name

Instance Method Summary collapse

Methods inherited from Base

#destroy, #host_records_equal?, #setup_opts, #up_to_date, #update

Constructor Details

#initialize(env) ⇒ Zerigo

Returns a new instance of Zerigo.



134
135
136
# File 'lib/rubber/dns/zerigo.rb', line 134

def initialize(env)
  super(env, "zerigo")
end

Instance Method Details

#create_host_record(opts = {}) ⇒ Object



145
146
147
148
149
150
# File 'lib/rubber/dns/zerigo.rb', line 145

def create_host_record(opts = {})
  opts = setup_opts(opts, [:host, :data, :domain, :type, :ttl])
  zone = Zone.get_zone(opts[:domain], provider_env)

  zone.create_host(opts)
end

#destroy_host_record(opts = {}) ⇒ Object



152
153
154
155
156
157
158
159
# File 'lib/rubber/dns/zerigo.rb', line 152

def destroy_host_record(opts = {})
  opts = setup_opts(opts, [:host, :domain])
  zone = Zone.get_zone(opts[:domain], provider_env)

  find_host_records(opts).each do |h|
    zone.delete_host(h[:id])
  end
end

#find_host_records(opts = {}) ⇒ Object



138
139
140
141
142
143
# File 'lib/rubber/dns/zerigo.rb', line 138

def find_host_records(opts = {})
  opts = setup_opts(opts, [:host, :domain])
  zone = Zone.get_zone(opts[:domain], provider_env)

  zone.find_host_records(opts)
end

#update_host_record(old_opts = {}, new_opts = {}) ⇒ Object



161
162
163
164
165
166
167
168
169
# File 'lib/rubber/dns/zerigo.rb', line 161

def update_host_record(old_opts={}, new_opts={})
  old_opts = setup_opts(old_opts, [:host, :domain])
  new_opts = setup_opts(new_opts.merge(:no_defaults =>true), [])
  zone = Zone.get_zone(old_opts[:domain], provider_env)

  find_host_records(old_opts).each do |h|
    zone.update_host(h[:id], h.merge(new_opts))
  end
end