def get(record_name, record_type = nil, record_identifier = nil)
requires :zone
record_name = record_name + "." unless record_name.end_with?(".")
record_type = record_type.upcase unless record_type.nil?
options = {
:max_items => 1,
:name => record_name,
:type => record_type,
:identifier => record_identifier
}
options.delete_if {|key, value| value.nil?}
data = connection.list_resource_record_sets(zone.id, options).body
data = data['ResourceRecordSets'].shift
if data
record = new(data)
if record.name == record_name
if (!record_type.nil? && record.type != record_type) ||
(!record_identifier.nil? && record.set_identifier != record_identifier)
nil
else
record
end
end
else
nil
end
rescue Excon::Errors::NotFound
nil
end