cryflare
Cryflare
Cryflare is a low-level API client for Cloudflare® v4. It features an intuitive interface that maps directly to the Cloudflare API.
Usage Examples
# Create a new client
client = Cryflare.new(email: "cloudflare-email", key: "cloudflare-api-key")
-
Get zone by name
client.zones.list(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.delete("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
Documentation
Find the complete documentation in the docs/
directory of this repository.
Todo
- Accounts
- Account members
- Account roles
- User
- User memberships
- User organizations
- Zones
- Zone settings
- DNS records
- Cloudflare IPs
- User-level Firewall Access Rule
- Account-level Firewall access rule
- Firewall Access Rule for a Zone
- Filters
- Firewall rules
- Page Rules for a Zone
- Available Page Rules for a Zone
Development
Generate a token from your Cloudflare account that can read zones (Zone:Read
).
Create a .env.sh
file:
#!/bin/bash
#
export CLOUDFLARE_TOKEN='your-cloudflare-token-here'
Update the file with your own details. Then run tests with source .env.sh && crystal spec
.
IMPORTANT: Remember to set permissions for your env file to 0600
or stricter: chmod 0600 .env*
.
Contributing
- Fork it
- Switch to the
master
branch:git checkout master
- Create your feature branch:
git checkout -b my-new-feature
- Make your changes, updating changelog and documentation as appropriate.
- Commit your changes:
git commit
- Push to the branch:
git push origin my-new-feature
- Submit a new Pull Request against the
GrottoPress:master
branch.
Legal
Cloudflare is a registered trademark of Cloudflare, Inc.
Repository
cryflare
Owner
Statistic
- 9
- 0
- 1
- 1
- 2
- 4 months ago
- December 10, 2020
License
MIT License
Links
Synced at
Wed, 25 Dec 2024 19:41:06 GMT
Languages