Class: Cloudflare::API::Zone
Instance Method Summary collapse
-
#initialize(options, zone_id) ⇒ Zone
constructor
A new instance of Zone.
- #patch_record(id, updates) ⇒ Object
- #record(name) ⇒ Object
- #records(query = {}) ⇒ Object
Constructor Details
#initialize(options, zone_id) ⇒ Zone
Returns a new instance of Zone.
47 48 49 50 |
# File 'lib/cloudflare/api.rb', line 47 def initialize(, zone_id) @options = self.class.base_uri "https://api.cloudflare.com/client/v4/zones/#{zone_id}" end |
Instance Method Details
#patch_record(id, updates) ⇒ Object
63 64 65 |
# File 'lib/cloudflare/api.rb', line 63 def patch_record(id, updates) self.class.patch("/dns_records/#{id}", @options.merge(body: updates.to_json)) end |
#record(name) ⇒ Object
57 58 59 60 61 |
# File 'lib/cloudflare/api.rb', line 57 def record(name) records = records(name: name) raise "#{name} not found" if records.empty? records.first end |
#records(query = {}) ⇒ Object
52 53 54 55 |
# File 'lib/cloudflare/api.rb', line 52 def records(query = {}) = @options.merge(query: query) self.class.get('/dns_records', ).parsed_response end |