A robust, type-safe Ruby SDK for integrating Ruby applications with the FastPix video API.
The FastPix Ruby SDK lets you upload and manage on-demand video, create and manage live streams, create playback IDs, manage playlists and signing keys, retrieve video analytics, and use in-video AI capabilities.
Works with: Ruby 3.2+ · Bundler · RubyGems · FastPix API
📖 Docs: https://fastpix.com/docs/language-sdks/ruby-sdk 🚀 Free account: https://dashboard.fastpix.com
Skip straight to a section without scrolling:
If you are using the FastPix Ruby SDK for the first time, follow these steps in order:
- Check your Ruby version
- Install the SDK
- Configure authentication
- Initialize the FastPix client
- Create your first media
- Verify your integration
- Understand the media workflow
- Explore the available APIs
Do not skip the verification steps. If a Ruby, dependency, or authentication problem occurs, fix it before continuing to the next API operation.
To use the FastPix Ruby SDK, make sure you have:
- Ruby 3.2 or later.
- Bundler.
- Internet access.
- A FastPix account.
- A FastPix Access Token.
- A FastPix Secret Key.
| Requirement | Version | Description |
|---|---|---|
| Ruby | 3.2+ |
Core runtime environment |
| Bundler | Latest | Dependency management |
| Internet | Required | API communication and authentication |
| FastPix account | Required | Required for API credentials |
The SDK is intended for Ruby 3.2 and later.
FastPix uses HTTP Basic Authentication.
| SDK value | FastPix credential |
|---|---|
username |
Access Token |
password |
Secret Key |
Follow the Authentication with Basic Auth guide to obtain your credentials.
For local development, set your credentials as environment variables:
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Never commit credentials to source control. Use environment variables or a secure credential-management system.
Before installing the SDK, verify that your Ruby version meets the minimum requirement:
ruby -vYou can also run this check programmatically:
ruby -e 'v = RUBY_VERSION.split(".").map(&:to_i); abort("Ruby 3.2+ is required. Found #{RUBY_VERSION}") if v < [3,2,0]; puts "Ruby #{RUBY_VERSION} OK"'If the command prints:
Ruby 3.2+ is required...
install a supported Ruby version before continuing.
If you use Homebrew on Apple Silicon:
brew install rubyAdd the Homebrew Ruby installation to your PATH:
echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcVerify that your shell is using the Homebrew Ruby:
which ruby
ruby -vThe which ruby command should return a path under:
/opt/homebrew/opt/ruby/bin/ruby
Note: macOS may include an older system Ruby. Installing a newer Ruby does not automatically make it the default
rubycommand.
Verify that Bundler is available:
bundle -vIf Bundler is not installed:
gem install bundlerVerify the installation:
bundle -vThe FastPix Ruby SDK is distributed as the fastpixapi RubyGem.
For an existing Ruby project, add the SDK to your project:
bundle add fastpixapiThen verify that Ruby can load the SDK:
bundle exec ruby -e 'require "fastpixapi"; puts "FastPix Ruby SDK loaded successfully"'If you are not using Bundler:
gem install fastpixapiVerify the installation:
ruby -e 'require "fastpixapi"; puts "FastPix Ruby SDK loaded successfully"'You can also check the installed gem:
gem list '^fastpixapi$'FastPix uses Basic Authentication. Set your Access Token and Secret Key as environment variables so they stay out of your source code:
export FASTPIX_USERNAME="your-access-token"
export FASTPIX_PASSWORD="your-secret-key"Confirm that both variables are set without displaying their values:
[ -n "$FASTPIX_USERNAME" ] && echo "Access Token: set" || echo "Access Token: missing"
[ -n "$FASTPIX_PASSWORD" ] && echo "Secret Key: set" || echo "Secret Key: missing"You can also validate both variables with Ruby:
ruby -e 'abort("FASTPIX_USERNAME is not set") if ENV["FASTPIX_USERNAME"].to_s.empty?; abort("FASTPIX_PASSWORD is not set") if ENV["FASTPIX_PASSWORD"].to_s.empty?; puts "FastPix credentials are configured"'Security: Never print, commit, or hard-code your Access Token or Secret Key.
Create a project directory, then initialize the client and create your first media:
mkdir fastpix-ruby-demo
cd fastpix-ruby-demoThe easiest way to verify your integration is to create media from a publicly accessible video URL.
FastPix provides a sample video:
https://static.fastpix.com/fp-sample-video.mp4
Create an example.rb file:
cat > example.rb <<'RUBY'
require "json"
require "fastpixapi"
Models = ::FastpixClient::Models
client = ::FastpixClient::Fastpixapi.new(
security: Models::Components::Security.new(
username: ENV.fetch("FASTPIX_USERNAME"),
password: ENV.fetch("FASTPIX_PASSWORD")
)
)
request = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::PullVideoInput.new(
type: "video",
url: "https://static.fastpix.com/fp-sample-video.mp4"
)
],
metadata: {
"source" => "fastpix-ruby-readme"
}
)
begin
response = client.input_video.create_media(request: request)
puts JSON.pretty_generate(
JSON.parse(response.raw_response.body)
)
rescue FastpixClient::Models::Errors::APIError => e
warn "FastPix API request failed"
warn "Status: #{e.status_code}"
warn "Message: #{e.message}"
warn "Body: #{e.body}"
exit 1
end
RUBYRun the example:
bundle exec ruby example.rbIf you installed the SDK with gem install, run:
ruby example.rbMore examples: For additional runnable examples, see the
examples/directory in this repository.
A successful request returns a response containing the newly created media resource.
A successful response contains:
{
"success": true,
"data": {
"id": "..."
}
}The data.id value is the unique media ID assigned to the media.
For an automated verification, use this version of the example:
cat > verify.rb <<'RUBY'
require "json"
require "fastpixapi"
Models = ::FastpixClient::Models
abort("FASTPIX_USERNAME is not set") if ENV["FASTPIX_USERNAME"].to_s.empty?
abort("FASTPIX_PASSWORD is not set") if ENV["FASTPIX_PASSWORD"].to_s.empty?
client = ::FastpixClient::Fastpixapi.new(
security: Models::Components::Security.new(
username: ENV.fetch("FASTPIX_USERNAME"),
password: ENV.fetch("FASTPIX_PASSWORD")
)
)
request = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::PullVideoInput.new(
type: "video",
url: "https://static.fastpix.com/fp-sample-video.mp4"
)
],
metadata: {
"source" => "fastpix-ruby-readme"
}
)
begin
response = client.input_video.create_media(request: request)
body = JSON.parse(response.raw_response.body)
abort("FastPix API returned success=false") unless body["success"]
media_id = body.dig("data", "id")
abort("FastPix API response did not contain data.id") unless media_id
puts "Media created successfully"
puts "Media ID: #{media_id}"
rescue FastpixClient::Models::Errors::APIError => e
warn "FastPix API request failed"
warn "Status: #{e.status_code}"
warn "Message: #{e.message}"
warn "Body: #{e.body}"
exit 1
end
RUBYRun it:
bundle exec ruby verify.rbExpected output:
Media created successfully
Media ID: <media-id>
If you see this output, your Ruby environment, SDK installation, credentials, and connection to the FastPix API are working.
Creating media is usually the first step in a FastPix on-demand video workflow. You create the media, poll it until processing finishes, then create a playback ID to play it.
The media ID identifies the media resource in subsequent API calls.
A playback ID provides access to the media for playback.
For more information about the video-on-demand workflow, see the FastPix Video on Demand documentation.
Comprehensive Ruby SDK for FastPix platform integration with full API coverage.
Upload, manage, and transform video content with comprehensive media management capabilities.
For detailed documentation, see FastPix Video on Demand Overview.
- Create from URL - Upload video content from external URL
- Upload from Device - Upload video files directly from device
- List All Media - Retrieve complete list of all media files
- Get Media by ID - Get detailed information for specific media
- Update Media - Modify media metadata and settings
- Delete Media - Remove media files from library
- Cancel Upload - Stop ongoing media upload process
- Get Input Info - Retrieve detailed input information
- List Uploads - Get all available upload URLs
- Get Media Clips - Get all clips of a media
- Get Media Summary - Get the summary of a video
- Update Source Access - Update the source access of a media by ID
- Update MP4 Support - Update the mp4Support of a media by ID
- Add Media Track - Add audio or subtitle track
- Update Media Track - Update audio or subtitle track
- Delete Media Track - Delete audio or subtitle track
- Generate Subtitle Track - Generate track subtitle
- List Live Clips - Get all clips of a live stream
- Create Playback ID - Generate secure playback identifier
- List Playback IDs - Get all playback IDs details for a media
- Delete Playback ID - Remove playback access
- Get Playback ID - Retrieve playback configuration details
- Update Domain Restrictions - Update domain restrictions for a playback ID
- Update User-Agent Restrictions - Update user-agent restrictions for a playback ID
- Create Playlist - Create new video playlist
- List Playlists - Get all available playlists
- Get Playlist - Retrieve specific playlist details
- Update Playlist - Modify playlist settings and metadata
- Delete Playlist - Remove playlist from library
- Add Media - Add media items to playlist
- Change Media Order - Change order of media in playlist
- Delete Media from Playlist - Remove media from playlist
- Create Key - Generate new signing key pair
- List Keys - Get all available signing keys
- Delete Key - Remove signing key from system
- Get Key by ID - Retrieve specific signing key details
- List DRM Configs - Get all DRM configuration options
- Get DRM Config - Retrieve specific DRM configuration
Stream, manage, and transform live video content with real-time broadcasting capabilities.
For detailed documentation, see FastPix Live Stream Overview.
- Create Stream - Initialize new live streaming session
- List Streams - Retrieve all active live streams
- Get Viewer Count - Get real-time viewer statistics
- Get Stream - Retrieve detailed stream information
- Delete Stream - Terminate and remove live stream
- Update Stream - Modify stream settings and configuration
- Enable Stream - Activate live streaming
- Disable Stream - Pause live streaming
- Complete Stream - Finalize and archive stream
- Create Playback ID - Generate secure live playback access
- Delete Playback ID - Revoke live playback access
- Get Playback ID - Retrieve live playback configuration
- Update Domain Restrictions - Restrict live playback by domain
- Update User-Agent Restrictions - Restrict live playback by user agent
- Create Simulcast - Set up multi-platform streaming
- Delete Simulcast - Remove simulcast configuration
- Get Simulcast - Retrieve simulcast settings
- Update Simulcast - Modify simulcast parameters
Monitor video performance and quality with comprehensive analytics and real-time metrics.
For detailed documentation, see FastPix Video Data Overview.
- List Breakdown Values - Get detailed breakdown of metrics by dimension
- List Overall Values - Get aggregated metric values across all content
- Get Timeseries Data - Retrieve time-based metric trends and patterns
- List Comparison Values - List comparison values
- List Video Views - Get comprehensive list of video viewing sessions
- Get View Details - Retrieve detailed information about specific video views
- List Top Content - Find your most popular and engaging content
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
- List Errors - List errors
Transform and enhance your video content with AI and editing capabilities.
- Update Summary - Create AI-generated video summaries
- Generate Chapters - Automatically generate video chapter markers
- Extract Entities - Identify and extract named entities from content
- Enable Moderation - Activate content moderation and safety checks
FastpixClient::Models::Errors::APIError is the primary error class for HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
message |
String |
Error message |
status_code |
Integer |
HTTP response status code (e.g. 404) |
raw_response |
Faraday::Response |
Raw HTTP response |
body |
String |
HTTP body. Can be empty if no body is returned. |
require 'json'
require 'fastpixapi'
Models = ::FastpixClient::Models
s = ::FastpixClient::Fastpixapi.new(
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key'
)
)
begin
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::PullVideoInput.new(
type: 'video',
url: 'https://static.fastpix.com/fp-sample-video.mp4',
),
],
metadata: { 'key1' => 'value1' },
)
res = s.input_video.create_media(request: req)
puts JSON.pretty_generate(JSON.parse(res.raw_response.body))
rescue FastpixClient::Models::Errors::APIError => e
puts e.message
puts e.status_code
puts e.body
rescue StandardError
puts res.raw_response.body.to_s if defined?(res) && res&.raw_response
endThe default server can be overridden globally by passing a URL to the server_url optional parameter when initializing the SDK client instance:
require 'json'
require 'fastpixapi'
Models = ::FastpixClient::Models
s = ::FastpixClient::Fastpixapi.new(
server_url: 'https://api.fastpix.com/v1/',
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key'
)
)
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::PullVideoInput.new(
type: 'video',
url: 'https://static.fastpix.com/fp-sample-video.mp4',
),
],
metadata: { 'key1' => 'value1' },
)
begin
res = s.input_video.create_media(request: req)
puts JSON.pretty_generate(JSON.parse(res.raw_response.body))
rescue FastpixClient::Models::Errors::APIError => e
puts JSON.pretty_generate(JSON.parse(e.body))
rescue StandardError
puts res.raw_response.body.to_s if defined?(res) && res&.raw_response
endHow do I install the FastPix Ruby SDK?
Add gem 'fastpixapi' to your Gemfile and run bundle install, or run gem install fastpixapi. See Install the SDK.
How do I authenticate the SDK?
FastPix uses Basic Auth: pass your access token as username and your secret key as password in Models::Components::Security when constructing the client. See Initialize the FastPix client.
How do I upload a video in Ruby?
Create media from a URL or a direct upload through s.input_video, for example s.input_video.create_media(request: req). See Create your first media and Available Resources and Operations.
How do I start a live stream? Use the Live API resources to create and manage streams, simulcasts, and live playback IDs. See Available Resources and Operations.
How do I get video analytics and metrics in Ruby? The Video Data API exposes metrics, views, dimensions, and errors for quality-of-experience monitoring. See Available Resources and Operations.
How do I handle API errors?
Rescue FastpixClient::Models::Errors::APIError, which exposes the message, status code, body, and raw response. See Error Handling.
How do I change the API base URL?
Pass a server_url when constructing the client. See Server Selection.
Which Ruby versions are supported? Ruby 3.2 and above. See Before you begin.
Is the SDK production-ready? The SDK is currently in beta; pin your gem to a specific version to avoid breaking changes between releases. See Maturity.
Is the SDK typed? Yes - it is a type-safe client generated from the FastPix API specification. See Development.
FastPix publishes a server SDK for every major backend language, each generated from the same API specification:
| Language | Repo | Install |
|---|---|---|
| Ruby (this repo) | fastpix-ruby | gem install fastpixapi |
| Node.js / TypeScript | node-sdk | npm install @fastpix/fastpix-node |
| Python | fastpix-python | pip install fastpix-python |
| PHP | fastpix-php | composer require fastpix/sdk |
| Go | fastpix-go | go get github.com/FastPix/fastpix-go |
| Java | fastpix-java | io.fastpix:sdk (Maven/Gradle) |
| C# / .NET | fastpix-sdk-csharp | dotnet add package Fastpix |
To upload and play the media these SDKs create, use the FastPix browser libraries: web-uploads-sdk, react-web-uploader, and web-player-component. Browse everything in the FastPix organization.
This Ruby SDK is programmatically generated from our API specifications. Any manual modifications to internal files may be overwritten during subsequent generation cycles.
We value community contributions and feedback. Feel free to submit pull requests or open issues with your suggestions, and we'll do our best to include them in future releases.
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version so you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
For comprehensive understanding of each API's functionality, including detailed request and response specifications, parameter descriptions, and additional examples, please refer to the FastPix API Reference.
The API reference offers complete documentation for all available endpoints and features, enabling developers to integrate and leverage FastPix APIs effectively.
