fastly-ruby
A Ruby client library for interacting with most facets of the Fastly API.
NOTE: This 4.x release is a new generated API client for the Fastly API. The previous 3.x version is no longer supported, but can be found at https://github.com/fastly/fastly-ruby/tree/v3.x.
⚠️ This client library (v4.1.0
) is an early-access release. Features may change without notice. Use at your own risk.
We strongly recommend that you do not install alpha and beta releases on live production services. No official support is provided for such releases. Please try out the library in a test environment, see what breaks without worrying about consequences, and give us feedback.
Read about the Fastly Product Lifecycle.
Installation
To install via RubyGems, add the following to your project's Gemfile
:
gem 'fastly', '~> v4.1.0'
Then run bundle install
.
Usage
# Load the gem
require 'fastly'
# Authorize the client with a Fastly API token.
Fastly.configure do |config|
# Configure API key authorization: token
config.api_token = 'YOUR API KEY'
end
api_instance = Fastly::AclApi.new
opts = {
service_id: 'SU1Z0isxPaozGVKXdv0eY', # String
version_id: 56, # Integer
name: 'my_acl', # String
}
begin
result = api_instance.create_acl(opts)
p result
rescue Fastly::ApiError => e
puts "Exception when calling AclApi->create_acl: #{e}"
end
Authorization
The Fastly API requires an API token for most operations. Set it in the Ruby client by assigning to api_token
of a configuration as shown:
# Authorize the client with a Fastly API token.
Fastly.configure do |config|
# Configure API key authorization: token
config.api_token = 'YOUR API KEY'
end
Alternatively, set the FASTLY_API_TOKEN
environment variable instead of setting api_token
.
Documentation for API Endpoints
The main documentation for the Fastly API can be found on our Developer Hub.
Issues
If you encounter any non-security-related bug or unexpected behavior, please file an issue using the bug report template.
Security issues
Please see our SECURITY.md for guidance on reporting security-related issues.
License
MIT.