Class: Fog::DNS::Rage4::Records

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rage4/models/dns/records.rb

Instance Method Summary collapse

Instance Method Details

#allObject



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

def all
  requires :zone
  clear
  data = service.list_records(zone.id).body
  load(data)
end

#get(record_id) ⇒ Object



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

def get(record_id)
  requires :zone
  data = service.list_records(zone.id).select {|record| record['id'] == record_id }
  if !data.empty?
    new(data.first)
  else
    nil
  end
rescue Excon::Errors::NotFound
  nil
end

#new(attributes = {}) ⇒ Object



31
32
33
34
# File 'lib/fog/rage4/models/dns/records.rb', line 31

def new(attributes = {})
  requires :zone
  super({ :zone => zone }.merge!(attributes))
end