Class: CFC::Zone

Inherits:
APIObject show all
Defined in:
lib/cfc/objects/zone.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from APIObject

#inspect, #method_missing, relationships, #respond_to_missing?

Constructor Details

#initialize(data) ⇒ Zone

Returns a new instance of Zone.



18
19
20
# File 'lib/cfc/objects/zone.rb', line 18

def initialize(data)
  super(data)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CFC::APIObject

Class Method Details

.listObject



13
14
15
16
# File 'lib/cfc/objects/zone.rb', line 13

def self.list
  data = @api.get_json('zones')['result']
  data.map { |z| new(z) }
end

Instance Method Details

#purge_all_filesObject



22
23
24
# File 'lib/cfc/objects/zone.rb', line 22

def purge_all_files
  @api.post_to_json("zones/#{id}/purge_cache", { purge_everything: true })
end

#recordsObject



26
27
28
29
# File 'lib/cfc/objects/zone.rb', line 26

def records
  data = @api.get_json("zones/#{id}/dns_records")['result']
  data.map { |r| CFC::Record.new(r) }
end