module Fog
module Zerigo
class DNS
class Real
# Update a host record
#
# ==== Parameters
# * host_id<~Integer> - host ID of the record to update
# * options<~Hash> - optional paramaters
# * host_type<~String>
# * data<~String>
# * hostname<~String> - Note: normally this is set/required!!
# * notes<~String>
# * priority<~Integer> - Note: required for MX or SRV records
# * ttl<~Integer>
# ==== Returns
# * response<~Excon::Response>:
# * 'status'<~Integer> - 200 for success
#
def update_host( host_id, options = {})
optional_tags= ''
options.each { |option, value|
case option
when :host_type
optional_tags+= "#{host_type}"
when :data
optional_tags+= "#{data}"
when :hostname
optional_tags+= "#{value}"
when :notes
optional_tags+= "#{value}"
when :priority
optional_tags+= "#{value}"
when :ttl
optional_tags+= "#{value}"
end
}
request(
:body => %Q{#{optional_tags}},
:expects => 200,
:method => 'PUT',
:path => "/api/1.1/hosts/#{host_id}.xml"
)
end
end
end
end
end