All Projects → socketry → Cloudflare

socketry / Cloudflare

An asynchronous Ruby wrapper for the CloudFlare V4 API.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Cloudflare

Verb
Organize and send HTTP requests from Emacs
Stars: ✭ 205 (+81.42%)
Mutual labels:  rest, client
Bitcoin Core
A modern Bitcoin Core REST and RPC client.
Stars: ✭ 379 (+235.4%)
Mutual labels:  rest, client
Flaresolverr
Proxy server to bypass Cloudflare protection
Stars: ✭ 241 (+113.27%)
Mutual labels:  rest, cloudflare
Pysnow
Python library for the ServiceNow REST API
Stars: ✭ 162 (+43.36%)
Mutual labels:  rest, client
Wgcf
🚤 Cross-platform, unofficial CLI for Cloudflare Warp
Stars: ✭ 778 (+588.5%)
Mutual labels:  cloudflare, client
Simple Web Server
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
Stars: ✭ 2,261 (+1900.88%)
Mutual labels:  rest, client
Fakerest
Patch fetch/XMLHttpRequest to fake a REST API server in the browser, based on JSON data.
Stars: ✭ 350 (+209.73%)
Mutual labels:  rest, client
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+46848.67%)
Mutual labels:  rest, client
Httpotion
(soft-deprecated) HTTP client for Elixir (use Tesla please)
Stars: ✭ 723 (+539.82%)
Mutual labels:  rest, client
Elasticsearch Js
Official Elasticsearch client library for Node.js
Stars: ✭ 4,828 (+4172.57%)
Mutual labels:  rest, client
Restrequest4delphi
API to consume REST services written in any programming language with support to Lazarus and Delphi
Stars: ✭ 162 (+43.36%)
Mutual labels:  rest, client
Cloudflare Warp Wireguard Client
Generate WireGuard profile from Cloudflare Warp account
Stars: ✭ 102 (-9.73%)
Mutual labels:  cloudflare, client
Anterofit
Strongly typed, asynchronous REST client framework for Rust.
Stars: ✭ 125 (+10.62%)
Mutual labels:  rest, client
Jenkins Rest
Java client, built on top of jclouds, for working with Jenkins REST API
Stars: ✭ 201 (+77.88%)
Mutual labels:  rest, client
Purest
REST API Client Library
Stars: ✭ 448 (+296.46%)
Mutual labels:  rest, client
Swagger Codegen Play Scala
Swagger client generator which is based on the PlayWS library
Stars: ✭ 9 (-92.04%)
Mutual labels:  rest, client
Flickr Sdk
Almost certainly the best Flickr API client in the world for node and the browser
Stars: ✭ 104 (-7.96%)
Mutual labels:  rest, client
Yii2 Rest
Yii2 REST Client
Stars: ✭ 109 (-3.54%)
Mutual labels:  rest
Dapr Demos
Collection of personal Dapr demos (bindings, state, pub/sub, service-to-service invocation)
Stars: ✭ 109 (-3.54%)
Mutual labels:  rest
Cnode Android
a unofficial android client of https://cnodejs.org/
Stars: ✭ 109 (-3.54%)
Mutual labels:  client

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].