Class: Fog::Bluebox::DNS::Record

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

#initialize(attributes = {}) ⇒ Record

Returns a new instance of Record.



17
18
19
# File 'lib/fog/dns/models/bluebox/record.rb', line 17

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject



21
22
23
24
25
# File 'lib/fog/dns/models/bluebox/record.rb', line 21

def destroy
  requires :identity
  connection.delete_record(@zone.identity, identity)
  true
end

#saveObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/fog/dns/models/bluebox/record.rb', line 31

def save
  requires :zone, :type, :name, :ip
  data = unless identity
    connection.create_record(zone.identity, type, name, ip)
  else
    connection.update_record(zone.identity, identity, {:type => type, :name => name, :content => ip})
  end
  merge_attributes(data.body)
  true
end

#zoneObject



27
28
29
# File 'lib/fog/dns/models/bluebox/record.rb', line 27

def zone
  @zone
end