Class: Webhookdb::Cloudflare

Inherits:
Object
  • Object
show all
Includes:
Appydays::Configurable, Appydays::Loggable
Defined in:
lib/webhookdb/cloudflare.rb

Class Method Summary collapse

Class Method Details

.create_zone_dns_record(name:, content:, zone_id:, type: "CNAME", ttl: 1) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/webhookdb/cloudflare.rb', line 23

def self.create_zone_dns_record(name:, content:, zone_id:, type: "CNAME", ttl: 1)
  body = {
    type:,
    name:,
    content:,
    ttl:,
  }
  response = Webhookdb::Http.post(
    self.host + "/client/v4/zones/#{zone_id}/dns_records",
    body,
    headers: self.headers,
    logger: self.logger,
    timeout: nil,
  )
  return Oj.load(response.body)
end

.headersObject



16
17
18
19
20
# File 'lib/webhookdb/cloudflare.rb', line 16

def self.headers
  return {
    "Authorization" => "Bearer #{self.api_token}",
  }
end