Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cfc

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cfc

  • 0.1.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

cfc

Simple library for interacting with the Cloudflare API.

Install

gem install cfc

If you're installing for development/contribution, just clone the repository.

Usage

Once you've required the gem, you must then configure it with required credentials before you can use it. You can do this by calling CFC::Config.configure, as shown below. You must provide a valid API token for the gem to use in API requests.

CFC::Config.configure do |config|
  config.token = 'your_api_token_here'
end

Alternatively, you can authenticate with your API key and email address:

CFC::Config.configure do |config|
  config.api_key = 'your_api_key_here'
  config.api_email = 'your_email_here'
end

You can then use the library either by instantiating CFC::API and using that class to send API requests directly, or, you can use pre-provided objects in lib/objects/, which represent a data type from the Cloudflare API and may provide methods to perform common or simple tasks on those types. For instance, to list DNS records in all zones you administer (assuming you've already configured the gem as above):

CFC::Zone.list.each do |zone|
  puts zone.records
end

Or if you need to roll all of your current API tokens:

new_tokens = CFC::UserAPIToken.list.each do |token|
  token.roll['result']
end

# Once you've rolled tokens, of course, your existing token won't work, so you
# probably want to update that.
CFC::Config.configure do |config|
  config.token = new_tokens[0]
end

Contributing

As with all Codidact projects, contributions are welcome and must adhere to the Codidact Code of Conduct. Please create an issue to discuss any major changes you propose to make, or if you think your changes may not be accepted for any reason—we'd always rather discuss something unnecessarily than have to reject someone's hard work.

License

This project is licensed under the terms of the MIT license, which may be found in the LICENSE file.

FAQs

Package last updated on 07 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc