Class: Fog::HP::DNS::Record

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

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

Methods included from Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

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

Constructor Details

#initialize(new_attributes = {}) ⇒ Record

Returns a new instance of Record.



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

def initialize(new_attributes = {})
  super(new_attributes)
  self.domain_id = domain.id if domain
  self
end

Instance Method Details

#destroyObject



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

def destroy
  requires :id, :domain_id
  service.delete_record(self.domain_id, id)
  true
end

#saveObject



32
33
34
# File 'lib/fog/hp/models/dns/record.rb', line 32

def save
  identity ? update : create
end