Class: Fog::DNS::Rage4::Record

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/rage4/models/dns/record.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Record

Returns a new instance of Record.



29
30
31
# File 'lib/fog/rage4/models/dns/record.rb', line 29

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



37
38
39
40
# File 'lib/fog/rage4/models/dns/record.rb', line 37

def destroy
  service.delete_record(id)
  true
end

#domainObject



33
34
35
# File 'lib/fog/rage4/models/dns/record.rb', line 33

def domain
  name
end

#saveObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/fog/rage4/models/dns/record.rb', line 46

def save
  requires :name, :type, :value
  options = {}
  options[:priority] = priority if priority
  options[:ttl]  = ttl if ttl
  options[:geozone] = geo_region_id if geo_region_id
  options[:geolock] = geo_lock if geo_lock
  options[:geolat] = geo_lat if geo_lat
  options[:geolong] = geo_long if geo_long
  options[:udplimit] = udp_limit if udp_limit

  # decide whether its a new record or update of an existing
  if id.nil?
    data = service.create_record(zone.id, name, value, type, options)
  else
    data = service.update_record(id, name, value, type, options)
  end

  merge_attributes(options)
  merge_attributes(:name =>  name, :value => value, :type => type)
  true
end

#zoneObject



42
43
44
# File 'lib/fog/rage4/models/dns/record.rb', line 42

def zone
  @zone
end