Class: Fog::HP::DNS::Records

Inherits:
Collection show all
Defined in:
lib/fog/hp/models/dns/records.rb

Instance Attribute Summary collapse

Attributes inherited from Collection

#service

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

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

This class inherits a constructor from Fog::Collection

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



12
13
14
# File 'lib/fog/hp/models/dns/records.rb', line 12

def domain
  @domain
end

Instance Method Details

#allObject



14
15
16
17
# File 'lib/fog/hp/models/dns/records.rb', line 14

def all
  requires :domain
  load(service.list_records_in_a_domain(domain.id).body['records'])
end

#get(record_id) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/fog/hp/models/dns/records.rb', line 19

def get(record_id)
  requires :domain
  ### Inconsistent API - does not return a 'record'
  if record = service.get_record(domain.id, record_id).body
    new(record)
  end
rescue Fog::HP::DNS::NotFound
  nil
end