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.



25
26
27
# File 'lib/fog/rage4/models/dns/record.rb', line 25

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



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

def destroy
  service.delete_record(id)
  true
end

#domainObject



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

def domain
  name
end

#saveObject



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

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



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

def zone
  @zone
end