Skip to content

Commit

Permalink
Rebase with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
kaka-ruto committed Sep 16, 2024
1 parent d800631 commit 2222b90
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Cloudflare

It 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*.
It 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_.

[![Development Status](https://github.com/socketry/cloudflare/workflows/Test/badge.svg)](https://github.com/socketry/cloudflare/actions?workflow=Test)

## Installation

Add this line to your application's Gemfile:

``` ruby
```ruby
gem 'cloudflare'
```

Expand All @@ -24,7 +24,7 @@ Or install it yourself as:

Here are some basic examples. For more details, refer to the code and specs.

``` ruby
```ruby
require 'cloudflare'

# Grab some details from somewhere:
Expand All @@ -34,18 +34,18 @@ key = ENV['CLOUDFLARE_KEY']
Cloudflare.connect(key: key, email: email) do |connection|
# Get all available zones:
zones = connection.zones

# Get a specific zone:
zone = connection.zones.find_by_id("...")
zone = connection.zones.find_by_name("example.com")

# Get DNS records for a given zone:
dns_records = zone.dns_records

# Show some details of the DNS record:
dns_record = dns_records.first
puts dns_record.name

# Add a DNS record. Here we add an A record for `batman.example.com`:
zone = zones.find_by_name("example.com")
zone.dns_records.create('A', 'batman', '1.2.3.4', proxied: false)
Expand All @@ -54,10 +54,10 @@ Cloudflare.connect(key: key, email: email) do |connection|
record = zone.dns_records.find_by_name("example.com") }
record.update(type: "CNAME", name: "nairobi", content: "kanairo.com", proxied: true)


# Get firewall rules:
all_rules = zone.firewall_rules

# Block an ip:
rule = zone.firewall_rules.set('block', '1.2.3.4', notes: "ssh dictionary attack")
end
Expand All @@ -67,7 +67,7 @@ end

You can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit priviledges.

``` ruby
```ruby
require 'cloudflare'

token = 'a_generated_api_token'
Expand All @@ -79,10 +79,10 @@ end

### Using with Async

``` ruby
```ruby
Async do
connection = Cloudflare.connect(...)

# ... do something with connection ...
ensure
connection.close
Expand All @@ -91,24 +91,14 @@ end

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Run `cp .env.example .env` to create a .env file and populate it with the required environment variables. Edit the new file appropriately
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Push to the branch (`git push origin my-new-feature`)
6. Create new Pull Request
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
We welcome contributions to this project.

1. Fork it.
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin my-new-feature`).
5. Create new Pull Request.
3. Run `cp .env.example .env` to create a .env file and populate it with the required environment variables. Edit the new file appropriately
4. Commit your changes (`git commit -am 'Add some feature'`).
5. Push to the branch (`git push origin my-new-feature`).
6. Create new Pull Request.

### Developer Certificate of Origin

Expand All @@ -120,5 +110,5 @@ This project is best served by a collaborative and respectful environment. Treat

## See Also

- [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.
- [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.
- [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.
- [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.

0 comments on commit 2222b90

Please sign in to comment.