Class: Fog::DNS::DNSimple::Records

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

Instance Method Summary collapse

Instance Method Details

#allObject



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

def all
  requires :zone
  clear
  data = service.list_records(zone.id).body.map {|record| record['record']}
  load(data)
end

#get(record_id) ⇒ Object



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

def get(record_id)
  requires :zone
  data = service.get_record(zone.id, record_id).body["record"]
  new(data)
rescue Excon::Errors::NotFound
  nil
end

#new(attributes = {}) ⇒ Object



27
28
29
30
# File 'lib/fog/dnsimple/models/dns/records.rb', line 27

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