A robust, type-safe Ruby SDK designed for seamless integration with the FastPix API platform.
The FastPix Ruby SDK simplifies integration with the FastPix platform. It provides a clean, Ruby interface for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, on‑demand content, playlists, video analytics, and signing keys for secure access and token management. It is intended for use with Ruby 3.2 and above.
Requirement | Version | Description |
---|---|---|
Ruby | 3.2+ |
Core runtime environment |
Bundler | 2.4+ |
Dependency management for Ruby gems |
Internet | Required |
API communication and authentication |
Pro Tip: We recommend using Ruby 3.3+ for optimal performance and the latest language features.
To get started with the FastPix Ruby SDK, ensure you have the following:
-
The FastPix APIs are authenticated using a Username and a Password. You must generate these credentials to use the SDK.
-
Follow the steps in the Authentication with Basic Auth guide to obtain your credentials.
Configure your FastPix credentials using environment variables for enhanced security and convenience:
# Set your FastPix credentials
export FASTPIX_USERNAME="your_username_here"
export FASTPIX_PASSWORD="your_password_here"
# Or add to your .env file
echo "FASTPIX_USERNAME=your_username_here" >> .env
echo "FASTPIX_PASSWORD=your_password_here" >> .env
Security Note: Never commit your credentials to version control. Use environment variables or secure credential management systems.
Install the FastPix Ruby SDK using RubyGems:
gem install fastpixapi
Or if you're using a bundler:
# Add to your Gemfile
gem 'fastpixapi', '~> 1.0.0'
# Install dependencies
bundle install
Import the necessary modules for your FastPix integration:
# Basic imports
require 'fastpixapi'
# Access to models and components
Models = ::FastpixApiSDK::Models
Initialize the FastPix SDK with your credentials:
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
security: Models::Components::Security.new(
username: "your-access-token",
password: "your-secret-key",
),
)
Or using environment variables:
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
security: Models::Components::Security.new(
username: ENV["FASTPIX_ACCESS_TOKEN"],
password: ENV["FASTPIX_SECRET_KEY"],
),
)
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key',
),
)
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::VideoInput.new(
type: 'video',
url: 'https://static.fastpix.io/sample.mp4',
),
],
metadata: {
"key1": 'value1',
},
access_policy: Models::Components::CreateMediaRequestAccessPolicy::PUBLIC,
)
res = s.input_video.create_media(request: req)
unless res.create_media_success_response.nil?
# handle response
end
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
- Add Track - Add audio or subtitle tracks to media
- Cancel Upload - Stop ongoing media upload process
- Update Track - Modify existing audio or subtitle tracks
- Delete Track - Remove audio or subtitle tracks
- Generate Subtitles - Create automatic subtitles for media
- Update Source Access - Control access permissions for media source
- Update MP4 Support - Configure MP4 download capabilities
- Get Input Info - Retrieve detailed input information
- List Uploads - Get all available upload URLs
- Get Media Clips - Retrieve all video clips for media
- Create Playback ID - Generate secure playback identifier
- Delete Playback ID - Remove playback access
- Get Playback ID - Retrieve playback configuration details
- 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
- Reorder Media - Change order of media in playlist
- Remove Media - 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 - 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
- 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 - Compare metrics across different time periods
- 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
- Get Concurrent Viewers - Monitor real-time viewer counts over time
- Get Viewer Breakdown - Analyze viewers by device, location, and other dimensions
- List Dimensions - Get available data dimensions for filtering and analysis
- List Filter Values - Get specific values for a particular dimension
Enhance video content with AI-powered features including moderation, summarization, and intelligent categorization.
For detailed documentation, see Video Moderation Guide.
- Generate Summary - Create AI-generated video summaries
- Create Chapters - Automatically generate video chapter markers
- Extract Entities - Identify and extract named entities from content
- Enable Moderation - Activate content moderation and safety checks
Handle and manage errors with comprehensive error handling capabilities and detailed error information for all API operations.
- List Errors - Retrieve comprehensive error logs and diagnostics
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a RetryConfig
object to the call:
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key',
),
)
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::VideoInput.new(
type: 'video',
url: 'https://static.fastpix.io/sample.mp4',
),
],
metadata: {
"key1": 'value1',
},
access_policy: Models::Components::CreateMediaRequestAccessPolicy::PUBLIC,
)
res = s.input_video.create_media(request: req)
unless res.create_media_success_response.nil?
# handle response
end
If you'd like to override the default retry strategy for all operations that support retries, you can use the retry_config
optional parameter when initializing the SDK:
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
retry_config: Utils::RetryConfig.new(
backoff: Utils::BackoffStrategy.new(
exponent: 1.1,
initial_interval: 1,
max_elapsed_time: 100,
max_interval: 50
),
retry_connection_errors: false,
strategy: 'backoff'
),
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key',
),
)
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::VideoInput.new(
type: 'video',
url: 'https://static.fastpix.io/sample.mp4',
),
],
metadata: {
"key1": 'value1',
},
access_policy: Models::Components::CreateMediaRequestAccessPolicy::PUBLIC,
)
res = s.input_video.create_media(request: req)
unless res.create_media_success_response.nil?
# handle response
end
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error.
By default an API error will raise a Errors::APIError
, which has the following properties:
Property | Type | Description |
---|---|---|
message |
string | The error message |
status_code |
int | The HTTP status code |
raw_response |
Faraday::Response | The raw HTTP response |
body |
string | The response content |
When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the create_media
method throws the following exceptions:
Error Type | Status Code | Content Type |
---|---|---|
Models::Errors::BadRequestError | 400 | application/json |
Models::Errors::InvalidPermissionError | 401 | application/json |
Models::Errors::ForbiddenError | 403 | application/json |
Models::Errors::ValidationErrorResponse | 422 | application/json |
Errors::APIError | 4XX, 5XX | */* |
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key',
),
)
begin
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::VideoInput.new(
type: 'video',
url: 'https://static.fastpix.io/sample.mp4',
),
],
metadata: {
"key1": 'value1',
},
access_policy: Models::Components::CreateMediaRequestAccessPolicy::PUBLIC,
)
res = s.input_video.create_media(request: req)
unless res.create_media_success_response.nil?
# handle response
end
rescue Models::Errors::BadRequestError => e
# handle e.container data
raise e
rescue Models::Errors::InvalidPermissionError => e
# handle e.container data
raise e
rescue Models::Errors::ForbiddenError => e
# handle e.container data
raise e
rescue Models::Errors::ValidationErrorResponse => e
# handle e.container data
raise e
rescue Errors::APIError => e
# handle default exception
raise e
end
The default server can be overridden globally by passing a URL to the server_url (String)
optional parameter when initializing the SDK client instance. For example:
require 'fastpixapi'
Models = ::FastpixApiSDK::Models
s = ::FastpixApiSDK::Fastpix.new(
server_url: 'https://api.fastpix.io/v1/',
security: Models::Components::Security.new(
username: 'your-access-token',
password: 'your-secret-key',
),
)
req = Models::Components::CreateMediaRequest.new(
inputs: [
Models::Components::VideoInput.new(
type: 'video',
url: 'https://static.fastpix.io/sample.mp4',
),
],
metadata: {
"key1": 'value1',
},
access_policy: Models::Components::CreateMediaRequestAccessPolicy::PUBLIC,
)
res = s.input_video.create_media(request: req)
unless res.create_media_success_response.nil?
# handle response
end
This Ruby SDK is programmatically generated from our API specifications. Any manual modifications to internal files will 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.
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.
<style> :root { --badge-gray-bg: #f3f4f6; --badge-gray-border: #d1d5db; --badge-gray-text: #374151; --badge-blue-bg: #eff6ff; --badge-blue-border: #3b82f6; --badge-blue-text: #3b82f6; } @media (prefers-color-scheme: dark) { :root { --badge-gray-bg: #374151; --badge-gray-border: #4b5563; --badge-gray-text: #f3f4f6; --badge-blue-bg: #1e3a8a; --badge-blue-border: #3b82f6; --badge-blue-text: #93c5fd; } } h1 { border-bottom: none !important; margin-bottom: 4px; margin-top: 0; letter-spacing: 0.5px; font-weight: 600; } .badge-text { letter-spacing: 1px; font-weight: 300; } .badge-container { display: inline-flex; align-items: center; background: var(--badge-gray-bg); border: 1px solid var(--badge-gray-border); border-radius: 6px; overflow: hidden; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 11px; text-decoration: none; vertical-align: middle; } .badge-container.blue { background: var(--badge-blue-bg); border-color: var(--badge-blue-border); } .badge-icon-section { padding: 4px 8px; border-right: 1px solid var(--badge-gray-border); display: flex; align-items: center; } .badge-text-section { padding: 4px 10px; color: var(--badge-gray-text); font-weight: 400; } .badge-container.blue .badge-text-section { color: var(--badge-blue-text); } .badge-link { text-decoration: none; margin-left: 8px; display: inline-flex; vertical-align: middle; } .badge-link:hover { text-decoration: none; } .badge-link:first-child { margin-left: 0; } .badge-icon-section svg { color: var(--badge-gray-text); } .badge-container.blue .badge-icon-section svg { color: var(--badge-blue-text); } </style>