Skip to content

FastPix/fastpix-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastPix Ruby SDK

Developer-friendly & type-safe Ruby SDK for integrating with the FastPix Live Streaming API.

License: Apache-2.0

Introduction

The FastPix Ruby SDK simplifies integration with the FastPix platform. This SDK is designed for secure and efficient communication with the FastPix API, enabling easy management of media uploads, live streaming, and simulcasting.

Key Features

  • Media API
    • Upload media files seamlessly from URLs or devices
    • Manage media: list, fetch, update, and delete media assets
    • Generate and manage playback IDs for media access
  • Live API
    • Create, list, update, and delete live streams
    • Generate playback IDs for live streams to control and manage access
    • Simulcast to multiple platforms simultaneously

Prerequisites

  • Ruby 2.7 or later
  • FastPix API credentials (Access Token and Secret Key)

Getting Started with FastPix

To get started with the FastPix Ruby SDK, ensure you have the following:

  • The FastPix APIs are authenticated using an Access Token and a Secret Key. You must generate these credentials to use the SDK.
  • Follow the steps in the Authentication with Access Tokens guide to obtain your credentials.

Table of Contents


Installation

You can install the SDK using one of the following methods:

1. From GitHub (recommended for unpublished gems)

gem install specific_install
gem specific_install https://github.com/FastPix/fastpix-ruby.git

2. Using Bundler in your Gemfile

gem 'fastpixapi', git: 'https://github.com/FastPix/fastpix-ruby.git'

3. Local development (if you have the code locally)

gem build fastpixapi.gemspec
gem install ./fastpixapi-0.0.1.gem

4. (Optional) If published to RubyGems.org

Once published, you can simply run:

gem install fastpixapi

Quick Start

Here's how to get started with the FastPix Ruby SDK:

require 'fastpixapi'

# Initialize the SDK with authentication
sdk = ::FastpixApiSDK::SDK.new(
  security: Models::Components::Security.new(
    username: 'your-username',
    password: 'your-password'
  )
)

# Create a new live stream
request = Models::Components::CreateLiveStreamRequest.new(
  playback_settings: Models::Components::PlaybackSettings.new(),
  input_media_settings: Models::Components::InputMediaSettings.new(
    metadata: Models::Components::CreateLiveStreamRequestMetadata.new()
  )
)

response = sdk.start_live_stream.create_new_stream(request)

if !response.live_stream_response_dto.nil?
  puts "Stream created! ID: #{response.live_stream_response_dto.stream_id}"
end

Authentication

The SDK uses HTTP Basic authentication. Set your credentials when initializing the SDK:

sdk = ::FastpixApiSDK::SDK.new(
  security: Models::Components::Security.new(
    username: 'your-username',
    password: 'your-password'
  )
)

Available Resources & Operations

Example: List All Live Streams

streams = sdk.manage_live_stream.get_all_streams
streams.each do |stream|
  puts "Stream ID: #{stream.id}, Status: #{stream.status}"
end

Error Handling

All operations return a response object or raise an error. For example:

begin
  response = sdk.start_live_stream.create_new_stream(request)
rescue Models::Errors::UnauthorizedError => e
  puts "Unauthorized: #{e.message}"
rescue Models::Errors::InvalidPermissionError => e
  puts "Permission error: #{e.message}"
rescue Models::Errors::ValidationErrorResponse => e
  puts "Validation error: #{e.message}"
rescue Errors::APIError => e
  puts "API error: #{e.message}"
end

Server Selection

You can override the default server URL when initializing the SDK:

sdk = ::FastpixApiSDK::SDK.new(
  server_url: 'https://api.fastpix.io/v1/live',
  security: Models::Components::Security.new(
    username: 'your-username',
    password: 'your-password'
  )
)

Development

Maturity

This SDK is currently in beta, and breaking changes may occur between versions even without a major version update. To avoid unexpected issues, we recommend pinning your dependency to a specific version. This ensures consistent behavior unless you intentionally update to a newer release.

Documentation

For a complete understanding of each API's functionality, including request and response details, parameter descriptions, and additional examples, please refer to the FastPix API Reference.

The API reference provides comprehensive documentation for all available endpoints and features, ensuring developers can integrate and utilize FastPix APIs efficiently.


Contributing

We welcome contributions from the community! If you're interested in contributing to the FastPix Ruby SDK, please follow these steps:

  1. Fork the repository
  2. Create a new branch for your feature or bug fix
  3. Make your changes and commit them
  4. Push your changes to your fork
  5. Create a pull request

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages