{"id":13683399,"url":"https://github.com/socketry/cloudflare","last_synced_at":"2025-05-14T23:08:00.958Z","repository":{"id":3956930,"uuid":"5050292","full_name":"socketry/cloudflare","owner":"socketry","description":"An asynchronous Ruby wrapper for the CloudFlare V4 API. ","archived":false,"fork":false,"pushed_at":"2025-01-22T00:17:53.000Z","size":240,"stargazers_count":148,"open_issues_count":12,"forks_count":90,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-14T04:01:04.067Z","etag":null,"topics":["client","cloudflare","rest","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/socketry.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-07-14T19:19:23.000Z","updated_at":"2025-03-30T21:16:53.000Z","dependencies_parsed_at":"2024-01-13T20:38:43.985Z","dependency_job_id":"d1fe86b7-eff6-4a90-b174-cae3d66e9762","html_url":"https://github.com/socketry/cloudflare","commit_stats":{"total_commits":154,"total_committers":23,"mean_commits":6.695652173913044,"dds":0.551948051948052,"last_synced_commit":"2dcc737c94c65c1e6b55400487ed2eb5db3d805c"},"previous_names":["b4k3r/cloudflare"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fcloudflare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fcloudflare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fcloudflare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/socketry%2Fcloudflare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/socketry","download_url":"https://codeload.github.com/socketry/cloudflare/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243362,"owners_count":22038046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","cloudflare","rest","ruby"],"created_at":"2024-08-02T13:02:09.935Z","updated_at":"2025-05-14T23:07:55.949Z","avatar_url":"https://github.com/socketry.png","language":"Ruby","readme":"# Cloudflare\n\nIt is a Ruby wrapper for the Cloudflare V4 API. It provides a light weight wrapper using `RestClient::Resource`. The wrapper functionality is limited to zones and DNS records at this time, *PRs welcome*.\n\n[![Development Status](https://github.com/socketry/cloudflare/workflows/Test/badge.svg)](https://github.com/socketry/cloudflare/actions?workflow=Test)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n``` ruby\ngem 'cloudflare'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install cloudflare\n\n## Usage\n\nHere are some basic examples. For more details, refer to the code and specs.\n\n``` ruby\nrequire 'cloudflare'\n\n# Grab some details from somewhere:\nemail = ENV['CLOUDFLARE_EMAIL']\nkey = ENV['CLOUDFLARE_KEY']\n\nCloudflare.connect(key: key, email: email) do |connection|\n\t# Get all available zones:\n\tzones = connection.zones\n\t\n\t# Get a specific zone:\n\tzone = connection.zones.find_by_id(\"...\")\n\tzone = connection.zones.find_by_name(\"example.com\")\n\t\n\t# Get DNS records for a given zone:\n\tdns_records = zone.dns_records\n\t\n\t# Show some details of the DNS record:\n\tdns_record = dns_records.first\n\tputs dns_record.name\n\t\n\t# Add a DNS record. Here we add an A record for `batman.example.com`:\n\tzone = zones.find_by_name(\"example.com\")\n\tzone.dns_records.create('A', 'batman', '1.2.3.4', proxied: false)\n\t\n\t# Get firewall rules:\n\tall_rules = zone.firewall_rules\n\t\n\t# Block an ip:\n\trule = zone.firewall_rules.set('block', '1.2.3.4', notes: \"ssh dictionary attack\")\nend\n```\n\n### Using a Bearer Token\n\nYou can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit priviledges.\n\n``` ruby\nrequire 'cloudflare'\n\ntoken = 'a_generated_api_token'\n\nCloudflare.connect(token: token) do |connection|\n\t# ...\nend\n```\n\n### Using with Async\n\n``` ruby\nAsync do\n\tconnection = Cloudflare.connect(...)\n\t\n\t# ... do something with connection ...\nensure\n\tconnection.close\nend\n```\n\n## Contributing\n\nWe welcome contributions to this project.\n\n1.  Fork it.\n2.  Create your feature branch (`git checkout -b my-new-feature`).\n3.  Commit your changes (`git commit -am 'Add some feature'`).\n4.  Push to the branch (`git push origin my-new-feature`).\n5.  Create new Pull Request.\n\n### Developer Certificate of Origin\n\nIn order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.\n\n### Community Guidelines\n\nThis project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.\n\n## See Also\n\n  - [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.\n  - [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketry%2Fcloudflare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketry%2Fcloudflare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketry%2Fcloudflare/lists"}