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

#initialize, #inspect, #method_missing, opts, relationship, #respond_to_missing?, #to_h

Constructor Details

This class inherits a constructor from CFC::APIObject

Dynamic Method Handling

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

Class Method Details

.listObject



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

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

Instance Method Details

#purge_all_filesObject



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

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

#recordsObject



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

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

#to_json(*_args) ⇒ Object



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

def to_json(*_args)
  "com.cloudflare.api.account.zone.#{id}"
end