Cryflare -- A Low-level API Client for Cloudflare® v4

Cryflare is a low-level API client for Cloudflare® v4. It features an intuitive interface that maps perfectly to the Cloudflare API.

Source: https://github.com/GrottoPress/cryflare

Examples

# Create a new client
client = Cryflare::Client.new(
  email: "cloudflare-email",
  key: "cloudflare-api-key"
)
# Get zone by name
client.zones.index(name: "grottopress.com") do |response|
  if response.success?
    response.result.try &.first?.try do |zone|
      puts zone.id
      puts zone.name
      puts zone.owner.name
      # ...
    end
  else
    response.errors.each do |error|
      puts error.code
      puts error.message
    end
  end
end
# Create new DNS record
client.dns_records.create(
  "zone-id",
  type: "A",
  name: "example.com",
  content: "127.0.0.1",
  ttl: 120
) do |response|
  if response.success?
    response.result.try do |dns_record|
      puts dns_record.id
      puts dns_record.name
      puts dns_record.content
      # ...
    end
  else
    response.errors.each do |error|
      puts error.code
      puts error.message
    end
  end
end
# Delete firewall rule
client.firewall_rules.destroy("zone-id", "rule-id") do |response|
  if response.success?
    response.result.try do |firewall_rule|
      puts firewall_rule.id
      # ...
    end
  else
    response.errors.each do |error|
      puts error.code
      puts error.message
    end
  end
end

Source: https://github.com/GrottoPress/cryflare