Class: Fog::DNS::Softlayer::Record

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

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Record

Returns a new instance of Record.



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

def initialize(attributes={})
  self.domain_id = attributes[:domain_id]
  super(attributes)
end

Instance Method Details

#destroyObject



30
31
32
33
# File 'lib/fog/softlayer/models/dns/record.rb', line 30

def destroy
  response = service.delete_record(identity)
  response.body
end

#saveObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fog/softlayer/models/dns/record.rb', line 35

def save
  requires :name, :type, :value, :domain_id
  opts = generate_template

  # to save or to update, thats the question
  if id.nil?
    data = service.create_record(opts)
    merge_attributes(data.body)
  else
    data = service.update_record(self.id, opts)
  end
  true
end