class Fog::DNS::Rackspace::Record

Public Instance Methods

destroy() click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 24
def destroy
  requires :zone, :identity
  wait_for_job connection.remove_record(@zone.identity, identity).body['jobId']
  true
end
save() click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 34
def save
  if identity
    update
  else
    create
  end
end
zone() click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 30
def zone
  @zone
end

Private Instance Methods

create() click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 44
def create
  requires :name, :type, :value, :zone

  options = {
    :name => name,
    :type => type,
    :data => value
  }

  if priority
    options[:priority] = priority
  end

  response = wait_for_job connection.add_records(@zone.identity, [options]).body['jobId']
  merge_attributes(response.body['response']['records'].select {|record| record['name'] == self.name && record['type'] == self.type && record['data'] == self.value}.first)
  true
end
update() click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 62
def update
  requires :identity, :zone

  options = {}
  options[:name] = name if name
  options[:type] = type if type
  options[:data] = value if value
  options[:priority] = priority if priority

  wait_for_job connection.modify_record(@zone.identity, identity, options).body['jobId']
  true
end
zone=(new_zone) click to toggle source
# File lib/fog/rackspace/models/dns/record.rb, line 75
def zone=(new_zone)
  @zone = new_zone
end