Code Monkey home page Code Monkey logo

cloudflare's Introduction

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.

Development Status

Installation

Add this line to your application's Gemfile:

gem 'cloudflare'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cloudflare

Usage

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

require 'cloudflare'

# Grab some details from somewhere:
email = ENV['CLOUDFLARE_EMAIL']
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)
	
	# 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

Using a Bearer Token

You can read more about bearer tokens here. This allows you to limit priviledges.

require 'cloudflare'

token = 'a_generated_api_token'

Cloudflare.connect(token: token) do |connection|
	# ...
end

Using with Async

Async do
	connection = Cloudflare.connect(...)
	
	# ... do something with connection ...
ensure
	connection.close
end

Contributing

  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

See Also

License

Released under the MIT license.

Copyright, 2018, by Samuel G. D. Williams.
Copyright, 2017, by David Rosenbloom.
Copyright, 2012, 2014, by Marcin Prokop.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cloudflare's People

Contributors

b4k3r avatar corbt avatar emckay avatar fiestacasey avatar gregretkowski avatar idletea avatar ioquatix avatar knu avatar lwille avatar mkalygin avatar molizz avatar mperham avatar nna774 avatar norens avatar olleolleolle avatar rdubya avatar shrmnk avatar sonicdes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudflare's Issues

getting error after migration to async-rest

I used to be able to manipulate my spectrum app with this library like this

zone = connection.zones.find_by_id(cf_config['zone_id'])
# get all apps
spectrum = zone['spectrum/apps'].get()
apps = spectrum.body[:result]
# find a spectrum app by name
found_app = apps.find {|app| app[:dns][:name] == name}

Now I get the following error from the latest version (4.0.0):

Traceback (most recent call last):
test.rb:20:in `<main>': undefined method `[]' for #<Cloudflare::Zone:0x00007fddb41085d0> (NoMethodError)

Is there a way to do this in the latest version?

FWIW - I am using this library for a chef recipe to register autoscale servers in CF DNS and Spectrum.

HTTP configuration missing

It's not clear how to configure http for this gem. For example, I would like to use Faraday, set timeouts, and configure logging at least for debugging purposes. As I understand neither cloudflare, nor async-rest provide this functionality. Is there any way?

Root namespace should be module, not class, to conform with typical Ruby gem organisation.

The cloudflare gem includes a root class CloudFlare which makes it hard to make additional gems that build on top of CloudFlare following standard practice. Recommendation is to change:

class CloudFlare to class Connection in module CloudFlare.

Add new method CloudFlare::connect which follows same interface as current CloudFlare.new and make this an alias.

gem install cloudflare -v 2.0.3 is broken: connection.rb is from version v2.0.2

Here's the git diff between the v2.0.2 version and the current HEAD (v2.0.3):

$ git diff v2.0.2..HEAD
diff --git a/lib/cloudflare/connection.rb b/lib/cloudflare/connection.rb
index 6b23229..5ab2dc3 100644
--- a/lib/cloudflare/connection.rb
+++ b/lib/cloudflare/connection.rb
@@ -289,8 +289,9 @@ module CloudFlare
     # @param weight [Intger] (applies to SRV)
     # @param port [Integer] (applies to SRV)
     # @param target [String] (applies to SRV)
+    # @param service_mode [String]

-    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil)
+    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = '1')
       send_req({
         a: :rec_new,
         z: zone,
@@ -305,7 +306,7 @@ module CloudFlare
         weight: weight,
         port: port,
         target: target,
-        service_mode: '1'
+        service_mode: service_mode
       })
     end

@@ -535,7 +536,7 @@ module CloudFlare
       end

       req = Net::HTTP::Post.new(uri.path)
-      req.set_form_data(params)
+      req.set_form_data(params.reject{|k, v| v.nil?})

       http = Net::HTTP.new(uri.host, uri.port)
       http.use_ssl = true
diff --git a/lib/cloudflare/version.rb b/lib/cloudflare/version.rb
index 9248895..6cf4496 100644
--- a/lib/cloudflare/version.rb
+++ b/lib/cloudflare/version.rb
@@ -19,5 +19,5 @@
 # THE SOFTWARE.

 module CloudFlare
-  VERSION = '2.0.2'
+  VERSION = '2.0.3'
 end

And here is lines 291..293 of the connection.rb that actually ships after gem install cloudflare -v 2.0.3:

    # @param target [String] (applies to SRV)

    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil)

Delete/Update

Hello! Thank you for this gem.

Question on DNS record delete syntax...

Tried several options, including this:

zone.dns_records.delete("name" => "ftp", :content_type => "application/json")

And I receive "Method DELETE not available for that URI."

Possible I am doing something obviously wrong.

Time to Migrate to CloudFlare API v4

We’re reaching out because we noticed you’re using CloudFlare’s API v1. Starting November 9th, 2016 at noon Pacific Time (20:00 UTC), CloudFlare will no longer be supporting API v1.

CloudFlare uses API v4 to power our customer dashboard, so unlike API v1, it has support for every single feature on CloudFlare. We've written extensive documentation to help you migrate from v1 to v4 available here: https://www.cloudflare.com/migrating-to-v4/

zone_list doesn't work

/Users/david/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/cloudflare-2.0.3/lib/cloudflare/connection.rb:549:in `send_req': Invalid act. (CloudFlare::RequestError)
    from /Users/david/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/cloudflare-2.0.3/lib/cloudflare/connection.rb:516:in `zone_list'
    from ./cf.rb:6:in `<main>'

Minimal sample:

cf = CloudFlare::connection('xxxxxx', '[email protected]')

p cf.zone_list

Async::REST::Error: Unknown content type: application/octet-stream! on reading from KV

I have the following example code:

Cloudflare.connect(key: CLOUDFLARE_KEY, email: CLOUDFLARE_EMAIL) do |connection|
  puts "we have a connection: #{connection}"
  account = connection.accounts.to_a[0]
  puts "account is: #{account}"

  namespaces = account.kv_namespaces
  puts "namespaces are: #{namespaces}"

  namespace = namespaces.find_by_id(NAMESPACE_ID)
  puts "namespace is: #{namespace}"

  namespace.write_value('my-test', 'asd')
  puts "value is: #{namespace.read_value('my-test')}"

end

Running it in rails c gives the following:

we have a connection: #<Cloudflare::Connection:0x00005640ad3743c8>
account is: #<Cloudflare::Account:0x00005640a81dab70>
namespaces are: #<Cloudflare::KV::Namespaces:0x00005640a72ad6c0>
namespace is: #<Cloudflare::KV::Namespace:0x00005640a604f7d0>
    error: Async::Task [oid=0x624d0] [pid=242] [2020-07-31 10:16:12 +0000]
               |   Async::REST::Error: Unknown content type: application/octet-stream!
               |   → /srv/vendor/bundle/ruby/2.7.0/gems/async-rest-0.10.1/lib/async/rest/wrapper/json.rb:75 in `process_response'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/async-rest-0.10.1/lib/async/rest/representation.rb:67 in `process_response'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/cloudflare-4.2.0/lib/cloudflare/representation.rb:82 in `process_response'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/async-rest-0.10.1/lib/async/rest/representation.rb:80 in `block (2 levels) in <class
               |     /srv/vendor/bundle/ruby/2.7.0/gems/async-rest-0.10.1/lib/async/rest/representation.rb:92 in `value!'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/async-rest-0.10.1/lib/async/rest/representation.rb:107 in `value'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/cloudflare-4.2.0/lib/cloudflare/kv/namespaces.rb:39 in `read_value'
               |     (irb):256 in `block in irb_binding'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/cloudflare-4.2.0/lib/cloudflare.rb:41 in `block in connect'
               |     /srv/vendor/bundle/ruby/2.7.0/gems/async-1.26.1/lib/async/task.rb:258 in `block in make_fiber'

[Feature] Get DNS record from a token that is not allowed to list all zones

Hi,

it currently is not possible to get dns records for a specific domain without granting permissions to list all zones.

As a workaround, this is what I currently do :

connection.with(Cloudflare::Zone, path: "zones/#{cloudflare_zone}").dns_records

It would be great if it could be natively supported :)

It would be even better if we could do something like this (if the api supports it, probably not):

connection.zone_by_name("domain.com").dns_records

Thank you !

Equivalent of `TRAVIS_JOB_ID`?

@bryanmacfarlane This test suite is very tricky to run because Cloudflare do not provide a testing environment.

Each test run must use a unique hostname as the root for running tests, e.g. adding DNS records, firewall rules, etc.

In travis, each job is sequentially assigned a JOB ID, e.g. if the matrix has 8 entries, there will be JOB IDs 1..8 inclusive.

Is there such an equivalent for GitHub Actions? e.g. GITHUB_JOB_ID which would be 1 for the first matrix permutation, 2, for the next one, etc.

Or do you have some other idea how to make this work?

No async task available!

No async task available!
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-1.24.1/lib/async/task.rb:183:in `current'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-io-1.27.1/lib/async/io/host_endpoint.rb:53:in `connect'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-io-1.27.1/lib/async/io/ssl_endpoint.rb:90:in `connect'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-http-0.50.0/lib/async/http/endpoint.rb:201:in `connect'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-http-0.50.0/lib/async/http/client.rb:140:in `block in make_pool'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-pool-0.2.0/lib/async/pool/controller.rb:181:in `create_resource'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-pool-0.2.0/lib/async/pool/controller.rb:210:in `block in available_resource'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-1.24.1/lib/async/semaphore.rb:78:in `acquire'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-pool-0.2.0/lib/async/pool/controller.rb:191:in `available_resource'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-pool-0.2.0/lib/async/pool/controller.rb:166:in `wait_for_resource'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-pool-0.2.0/lib/async/pool/controller.rb:76:in `acquire'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-http-0.50.0/lib/async/http/client.rb:104:in `call'
/Users/mikeperham/.gem/ruby/2.6.3/gems/protocol-http-0.13.0/lib/protocol/http/middleware.rb:40:in `call'
/Users/mikeperham/.gem/ruby/2.6.3/gems/protocol-http-0.13.0/lib/protocol/http/accept_encoding.rb:48:in `call'
/Users/mikeperham/.gem/ruby/2.6.3/gems/protocol-http-0.13.0/lib/protocol/http/middleware.rb:40:in `call'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-rest-0.10.1/lib/async/rest/representation.rb:76:in `block (2 levels) in <class:Representation>'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-rest-0.10.1/lib/async/rest/representation.rb:92:in `value!'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-rest-0.10.1/lib/async/rest/representation.rb:107:in `value'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-rest-0.10.1/lib/async/rest/resource.rb:84:in `tap'
/Users/mikeperham/.gem/ruby/2.6.3/gems/async-rest-0.10.1/lib/async/rest/resource.rb:84:in `get'
/Users/mikeperham/.gem/ruby/2.6.3/gems/cloudflare-4.2.0/lib/cloudflare/paginate.rb:29:in `each'
/Users/mikeperham/.gem/ruby/2.6.3/gems/cloudflare-4.2.0/lib/cloudflare/zones.rb:80:in `each'
/Users/mikeperham/.gem/ruby/2.6.3/gems/cloudflare-4.2.0/lib/cloudflare/zones.rb:80:in `first'
/Users/mikeperham/.gem/ruby/2.6.3/gems/cloudflare-4.2.0/lib/cloudflare/zones.rb:80:in `find_by_name'
/Users/mikeperham/src/machine/Rakefile:18:in `dns_add'

I don't understand the migration policy for v4. If you are going to require connect to take a block, please break the old usage and raise an error with the fix. Instead I had to find this repo, find an associated issue and then realize that the semantics for connect had changed.

Something like this would help immensely:

raise "Cloudflare.connect takes a block in v4, see README at (link)" unless block_given?

Deleting a single dns record

zone.dns_records.find_by_name("ftp.domain.com").delete

as mentioned in issue #35 used the following but still getting
Method DELETE not available for that URI.

I am working on automated acme certificate generation for each of my subdomains.
for acme challenge verification inserting a txt record was breeze.
But after certificate generation I would like to delete that dns record.
Its a TXT record
like "_acme-challenge.subdomain.domain.tld"

my method goes like this

Cloudflare.connect(key: @key, email: @email) do |connection|
# Remove DNS entry
zone = connection.zones.find_by_name("domain.tld")
zone.dns_records.delete.find_by_name("_acme-challenge.subdomain.domain.tld").delete
end

This should have got the job done. Am I missing out something?

No async task available

Am I doing something wrong with this example? Do I need to initialize Async somehow?

irb(main):001:0> c = Rails.application.credentials.cloudflare
=> {:key=>"xxxx", :email=>"[email protected]"}
irb(main):002:0>
irb(main):003:0> connection = Cloudflare.connect(
irb(main):004:1*   key:   c[:key],
irb(main):005:1*   email: c[:email]
irb(main):006:1> )
=> #<Cloudflare::Connection #<Async::REST::Resource #<HTTP::Protocol::Reference:0x0000000810a5cf68 @path="/client/v4", @query_string=nil, @fragment=nil, @parameters=nil> #<HTTP::Protocol::Headers:0x0000000810a5cf18 @fields=[["X-Auth-Key", "xxxx"], ["X-Auth-Email", "[email protected]"]], @indexed={"x-auth-key"=>["1a7494de7ab1e0fa6fe7ea7aabbdd3e051fd0"], "x-auth-email"=>["[email protected]"]}>>: value=nil>
irb(main):007:0>
irb(main):008:0> connection.accounts.first
Traceback (most recent call last):
        2: from (irb):8
        1: from (irb):8:in `first'
RuntimeError (No async task available!)
irb(main):009:0>

Ruby 2.5.3, Rails 5.2.2, Cloudflare 4.0.0, FreeBSD 11

If I try using rails runner test.rb, I get a backtrace:

23: from /usr/home/bob/cloudflare-test-site/test.rb:8:in `first'
22: from /usr/home/bob/.gem/ruby/2.5.3/gems/cloudflare-4.0.0/lib/cloudflare/paginate.rb:37:in `each'
21: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-rest-0.6.0/lib/async/rest/resource.rb:78:in `get'
20: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-rest-0.6.0/lib/async/rest/resource.rb:78:in `tap'
19: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-rest-0.6.0/lib/async/rest/representation.rb:94:in `value'
18: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-rest-0.6.0/lib/async/rest/representation.rb:83:in `value!'
17: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-rest-0.6.0/lib/async/rest/representation.rb:74:in `block (2 levels) in <class:Representation>'
16: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/middleware.rb:57:in `call'
15: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/accept_encoding.rb:48:in `call'
14: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/middleware.rb:57:in `call'
13: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/client.rb:80:in `call'
12: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/pool.rb:71:in `acquire'
11: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/pool.rb:131:in `wait_for_resource'
10: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/pool.rb:169:in `available_resource'
9: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/pool.rb:142:in `create'
8: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/client.rb:117:in `block in make_pool'
7: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-http-0.37.13/lib/async/http/url_endpoint.rb:176:in `connect'
6: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-io-1.18.2/lib/async/io/ssl_endpoint.rb:86:in `connect'
5: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-io-1.18.2/lib/async/io/host_endpoint.rb:49:in `connect'
4: from /usr/home/bob/.rubies/ruby-2.5.3/lib/ruby/2.5.0/socket.rb:227:in `foreach'
3: from /usr/home/bob/.rubies/ruby-2.5.3/lib/ruby/2.5.0/socket.rb:227:in `each'
2: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-io-1.18.2/lib/async/io/host_endpoint.rb:51:in `block in connect'
1: from /usr/home/bob/.gem/ruby/2.5.3/gems/async-io-1.18.2/lib/async/io/socket.rb:162:in `connect'
/usr/home/bob/.gem/ruby/2.5.3/gems/async-1.15.1/lib/async/task.rb:143:in `current': No async task available! (RuntimeError)

add MX record

How do we use this to add an MX record? I don't see a spot for priority.
I tried zone.dns_records.create('MX', "", "mail.example.com.") but it threw and error.

async-http upgrade breaks connection

Hi, thanks for the great gem.

This is less an issue, more a warning.

Today we updated another gem that bumped async-http from 0.59.3 to 0.59.5.

After which we began getting No route for that URI (Code: 7000) errors from Cloudflare. It appeared for some reason the upgrade forced the cloudflare gem to begin calling /client/zones instead of /client/v4/zones.

We downgraded async-http back to 0.59.3 and everything began to work again.

Pagination does not seem to work

For the following code:

require 'cloudflare'
dns_records = nil
Cloudflare.connect(key: api_key, email: email) do |connection|
  zone = connection.zones.find_by_name('mydomain.info')
  dns_records = zone.dns_records.get
end
dns_records.results.length

dns_records.results.length outputs 20. I definitely have more than 20 records.

Does Paginate.each only paginate zones and not dns records inside of zones? I'd be OK doing zone.dns_records.get.find_by_nameto get a result as well, but that only returns a record if it's in the first 20 returned results which is also a problem.

Undefined method "Sync" when using cloudflare-dns-update

Not sure when this started, but I’m seeing this error when using the gem:

♠ cloudflare-dns-update
 0.22s    error: Cloudflare::DNS::Update::Command [pid=86231] [2020-11-28 18:22:15 -0500]
               |   NoMethodError: undefined method `Sync' for #<Cloudflare::DNS::Update::Command::Top:0x00007fe2ce8b06b0>
               |   Did you mean?  Async
               |   → /usr/local/var/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cloudflare-dns-update-3.0.1/lib/cloudflare/dns/update/command.rb:170 in `call'
               |     /usr/local/var/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/samovar-2.1.4/lib/samovar/command.rb:36 in `call'
               |     /usr/local/var/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cloudflare-dns-update-3.0.1/lib/cloudflare/dns/update/command.rb:34 in `call'
               |     /usr/local/var/rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/cloudflare-dns-update-3.0.1/bin/cloudflare-dns-update:26 in `<top (required)>'
               |     /usr/local/var/rbenv/versions/2.7.0/bin/cloudflare-dns-update:23 in `load'
               |     /usr/local/var/rbenv/versions/2.7.0/bin/cloudflare-dns-update:23 in `<main>'

I’m a bit rusty with my Ruby, so I’m not really sure where it’s expected the Sync method to come from.

zone.record seems to be nil

this happens when calling .all

cloudflare-3.2.2/lib/cloudflare/zone.rb:192:in to_s': undefined method []' for nil:NilClass (NoMethodError)

works if preload = true

Updating entry with DNS and HTTP Proxy (CDN)

Not sure if this is something I'm missing in the options for managing records with cloudflare, or if this is something missing in the gem, but whenever I manage a record via the gem, the setting for DNS and HTTP proxy (CDN) is toggled to off.
screen shot 2016-06-30 at 10 29 56 am

Is there an option I'm missing, or is this not supported by the current implementation on the gem?

Thanks for the assistance.

[Feature] Add support for KV namespace write key value expiration and expiration_ttl

Looks like this isn't supported currently in the lib:
https://api.cloudflare.com/#workers-kv-namespace-write-key-value-pair

Write a value identified by a key... Existing values and expirations will be overwritten. If neither expiration nor expiration_ttl is specified, the key-value pair will never expire. If both are set, expiration_ttl is used and expiration is ignored.

PUT accounts/:account_identifier/storage/kv/namespaces/:namespace_identifier/values/:key_name?expiration=:expiration&expiration_ttl=:expiration_tt

[Bug?] All exceptions are catched in the connection block

Hi,

It seems like all exceptions are being catched by the connection block :

Cloudflare.connect(token: cloudflare_token) do |connection|
        raise "Exception"
end

I would like my service to crash if anything fails or if the cloudflare authentication fail.
Could this be fixed ? :)

Readme: link to API docs at Cloudflare

In order to be able to explore the possibilities of the library, finding out what the API it wraps can do would help a first-time reader getting familiar with the library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.