Giter Site home page Giter Site logo

muxinc / mux-ruby Goto Github PK

View Code? Open in Web Editor NEW
49.0 39.0 14.0 1.03 MB

Official Mux API wrapper for ruby projects, supporting both Mux Data and Mux Video.

License: MIT License

Ruby 95.16% Shell 0.02% Makefile 0.04% Mustache 4.78%
mux video video-streaming video-processing video-analytics ruby

mux-ruby's Introduction

Mux Ruby Banner

RubyGems | Mux Docs | Mux API Reference

Mux Ruby

Official Mux API wrapper for ruby projects, supporting both Mux Data and Mux Video.

Mux Video is an API-first platform, powered by data and designed by video experts to make beautiful video possible for every development team.

Mux Data is a platform for monitoring your video streaming performance with just a few lines of code. Get in-depth quality of service analytics on web, mobile, and OTT devices.

Not familiar with Mux? Check out https://mux.com/ for more information.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • Package version: 3.15.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit https://docs.mux.com

Installation

Build a gem

To build the Ruby code into a gem:

gem build mux_ruby.gemspec

Then either install the gem locally:

gem install ./mux_ruby-3.15.0.gem

(for development, run gem install --dev ./mux_ruby-3.15.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'mux_ruby', '~> 3.15.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'mux_ruby', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Overview

Mux Ruby is a code generated lightweight wrapper around the Mux REST API and reflects them accurately. This has a few consequences you should watch out for:

  1. For almost all API responses, the object you're looking for will be in the data field on the API response object, as in the example below. This is because we designed our APIs with similar concepts to the JSON:API standard. This means we'll be able to return more metadata from our API calls (such as related entities) without the need to make breaking changes to our APIs. We've decided not to hide that in this library.

  2. We don't use a lot of object orientation. For example API calls that happen on a single asset don't exist in the asset class, but are API calls in the AssetsApi which require an asset ID.

Authentication

To use the Mux API, you'll need an access token and a secret. Details on obtaining these can be found here in the Mux documentation.

Its up to you to manage your token and secret. In our examples, we read them from MUX_TOKEN_ID and MUX_TOKEN_SECRET in your environment.

Example Usage

Below is a quick example of using Mux Ruby to list the Video assets stored in your Mux account.

Be sure to also checkout the exmples directory:

There's also example usage of every API call (also used for testing):

#!/usr/bin/env ruby

require 'mux_ruby'

# Auth Setup
openapi = MuxRuby.configure do |config|
  config.username = ENV['MUX_TOKEN_ID']
  config.password = ENV['MUX_TOKEN_SECRET']
end

# API Client Init
assets_api = MuxRuby::AssetsApi.new

# List Assets
puts "Listing Assets in account:\n\n"

assets = assets_api.list_assets()
assets.data.each do | asset |
  puts "Asset ID: #{asset.id}"
  puts "Status: #{asset.status}"
  puts "Duration: #{asset.duration.to_s}\n\n"
end

Exceptions & Error Handling

All errors inherit from ApiError, you can catch it or you can catch one of the more specific Errors below.

NotFoundError

NotFoundError is thrown when a resource is not found. This is useful when trying to get an entity by its ID, for example get_asset("some-id-here") in the AssetsApi.

UnauthorizedError

UnauthorizedError is thrown when Mux cannot authenticate your request. You should check you have configured your credentials correctly.

ServiceError

ServiceError is thrown when Mux returns a HTTP 5XX Status Code. If you encounter this reproducibly, please get in touch with [email protected].

Documentation

Be sure to check out the documentation in the docs directory.

Issues

If you run into problems, please raise a GitHub issue, filling in the issue template. We'll take a look as soon as possible.

Contributing

We now accept PRs against this package! Please make your modifications to the templates in gen/templates, not the code itself, or please open an issue.

License

MIT License. Copyright 2019 Mux, Inc.

mux-ruby's People

Contributors

alexdechaves avatar aminamos avatar dependabot[bot] avatar dylanjha avatar eropple avatar jaredsmith avatar jsanford8 avatar philcluff avatar sailor avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mux-ruby's Issues

Can't get response of VideoViewsAPI

I am trying to fetch the video view list and event track by following
openapi = MuxRuby.configure do |config|
config.username = ENV['MUX_TOKEN_ID']
config.password = ENV['MUX_TOKEN_SECRET']
end

API Client Initialization

api_instance = MuxRuby::VideoViewsApi.new
result = api_instance.get_video_view(id)

incidents_api = MuxRuby::IncidentsApi.new
incidents = incidents_api.list_incidents

Its returning

ETHON: performed EASY effective_url=https://api.mux.com/data/v1/incidents response_code=404 return_code=ok total_time=1.112898 MuxRuby::NotFoundError: HTTP status code: 404 Response headers: {"cache-control"=>"max-age=0, private, must-revalidate", "content-type"=>"application/json; charset=utf-8", "date"=>"Wed, 20 Oct 2021 10:54:08 GMT", "server"=>"Mux API Server v1.135.0", "x-request-id"=>"Fq-3xWmMCuVyTiwATTQK", "content-length"=>"121"} Response body: {"error":{"type":"not_found","messages":["The requested resource either doesn't exist or you don't have access to it."]}}

Can anyone help me?

cannot run rails console on in production environments when mux_ruby is installed

After deploying our mux_ruby implementation I can no longer run rails console. Removing the mux_ruby gem resolves this, so I'm thinking it has something to do with this gem.

Any ideas?

Here is the error output:

Traceback (most recent call last):
        92: from /workspace/bin/rails:4:in `<main>'
        91: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        90: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        89: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        88: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        87: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        86: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        85: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        84: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        83: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/commands.rb:18:in `<main>'
        82: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/command.rb:50:in `invoke'
        81: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/command/base.rb:69:in `perform'
        80: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        79: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        78: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        77: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/commands/console/console_command.rb:101:in `perform'
        76: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
        75: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/railties-6.1.3.1/lib/rails/command/actions.rb:22:in `require_application!'
        74: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        73: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        72: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        71: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        70: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        69: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        68: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        67: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        66: from /workspace/config/application.rb:9:in `<main>'
        65: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler.rb:174:in `require'
        64: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `require'
        63: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:58:in `each'
        62: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `block in require'
        61: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:69:in `each'
        60: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:74:in `block (2 levels) in require'
        59: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        58: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        57: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        56: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        55: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        54: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/mux_ruby-1.9.0/lib/mux_ruby.rb:7:in `<main>'
        53: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        52: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        51: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        50: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        49: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        48: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        47: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        46: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        45: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/mux_ruby-1.9.0/lib/mux_ruby/api_client.rb:10:in `<main>'
        44: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        43: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        42: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        41: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        40: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        39: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        38: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        37: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        36: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<main>'
        35: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        34: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        33: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        32: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        31: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        30: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        29: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        28: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        27: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon.rb:16:in `<main>'
        26: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        25: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        24: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        23: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        22: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        21: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        20: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        19: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        18: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curl.rb:9:in `<main>'
        17: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curl.rb:14:in `<module:Ethon>'
        16: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curl.rb:29:in `<module:Curl>'
        15: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `require'
        14: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:299:in `load_dependency'
        13: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.3.1/lib/active_support/dependencies.rb:332:in `block in require'
        12: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        11: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        10: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
         9: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
         8: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
         7: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curls/classes.rb:2:in `<main>'
         6: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curls/classes.rb:3:in `<module:Ethon>'
         5: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curls/classes.rb:27:in `<module:Curl>'
         4: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ethon-0.14.0/lib/ethon/curls/classes.rb:37:in `<class:FDSet>'
         3: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/struct.rb:220:in `layout'
         2: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/struct_layout_builder.rb:171:in `build'
         1: from /layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/struct_layout_builder.rb:171:in `new'
/layers/heroku_ruby/gems/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/struct_layout_builder.rb:171:in `initialize': integer 4294967288 too big to convert to `int' (RangeError)

Please make use of releases

Having a git URL for fetching the code in our Gemfiles instead of releases would create problems when the code changes and we need to check the commits to check what changed and evaluate the source of the problems.

Also, deployments will take longer.

Status of dj/webhook-signatures?

I'm working on a project with this SDK and would like to verify webhook signatures. I was considering implementing signature verification per your spec, and submitting a pull request, but I came across the branch "dj/webhook-signatures", in which it looks like this was done last year but has not been merged. What is the status of this branch and is there something we can do to help it over the finish line?

Unable to create a "test" stream.

Environment

  • ruby-2.6.3
  • rails 6.0.0
  • mux_ruby-1.4.0

Current Behaviour

When working with non-production environments in our app like staging, testing etc., we want to create streams with test live streams so that we are not charged for testing purposes. According to mux docs here https://docs.mux.com/reference#create-a-live-stream we can do it by passing test: true in param while creating a live stream. Tried to do it in the following ways but none worked.

  • MuxRuby::CreateLiveStreamRequest.new(test: true)
  • client.create_live_stream(create_live_stream_request, test: true)

Expected Behavior

By any of the ways suggested above we should be able to create live streams with test: true param. These streams should have a mux logo while being watched and can not be broadcasted to, more than 5 minutes.

Activestorage integration?

Curious if the mux team has put any thought into integrating mux with activestorage. It is my understanding Mux only supports videos (no images), so probably does not make sense to build an activestorage adapter. Would be interested to hear if anyone has thought about this, and the best way to store videos in activestorage, and then mirror them to mux for fast playback.

Gem methods returning empty ({}) responses when creating/retrieving assets

Ruby Version: 2.7.4
Rails Version: 5.2.6

These assets are successfully being created and accessible within our MUX Dashboard,
The credentials are correct,
And the implementation follows some of the examples provided in this repository.

Skipping the SDK and Making direct HTTP calls using RestClient returns a valid response, with data Hash.

Current situation:

  • Gem methods returning empty ({}) responses when creating/retrieving assets

Expected result:

  • These methods should be returning valid create_asset_responses.

Web-Inputs implementation

When should we see and update to use web-inputs

     url = URI("https://api.mux.com/video/v1/web-inputs")

      https = Net::HTTP.new(url.host, url.port)
      https.use_ssl = true
      
      request = Net::HTTP::Post.new(url)
      request["Content-Type"] = "application/json"
      request["User-Agent"] = "\"Mux Ruby | 3.9.0\""
      request["Authorization"] = "Basic {key}"
      request.body = JSON.dump({
        "live_stream_id": "OoOLLGPGGMk",
        "url": "https://www.aol.com"
      })
      
     response = https.request(request)

Missing support for `max_resolution_tier` attribute

Hello, I was looking at implementing the new max_resolution_tier param as described here: https://www.mux.com/blog/more-pixels-fewer-problems-introducing-4k-support-for-mux-video#creating-4k-assets

However MuxRuby::CreateAssetRequest does not have this as an attribute, so trying to use this results in an exception:

max_resolution_tier is not a valid attribute in MuxRuby::CreateAssetRequest. Please check the name to make sure it's valid. List of attributes: [:input, :playback_policy, :per_title_encode, :passthrough, :mp4_support, :normalize_audio, :master_access, :test]

Space API endpoints include extra $ in paths when variable substitution occurs

Issue

In several of the Space API endpoints when variable substitution occurs for the SPACE_ID or BROADCAST_ID there is a $ prepended to the identifier which makes the path incorrect. As a result the API rejects the request. For example, the create a space broadcast endpoint instead of making a request to https://api.mux.com/video/v1/spaces/my_space_id/broadcasts it makes a request to https://api.mux.com/video/v1/spaces/$my_space_id/broadcasts:

The following endpoints are effected:

  • Create a space broadcast
    local_var_path = '/video/v1/spaces/${SPACE_ID}/broadcasts'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s))
  • Delete a space
    local_var_path = '/video/v1/spaces/${SPACE_ID}'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s))
  • Delete a space broadcast
    local_var_path = '/video/v1/spaces/${SPACE_ID}/broadcasts/${BROADCAST_ID}'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s)).sub('{' + 'BROADCAST_ID' + '}', CGI.escape(broadcast_id.to_s))
  • Get a space
    local_var_path = '/video/v1/spaces/${SPACE_ID}'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s))
  • Get a space broadcast
    local_var_path = '/video/v1/spaces/${SPACE_ID}/broadcasts/${BROADCAST_ID}'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s)).sub('{' + 'BROADCAST_ID' + '}', CGI.escape(broadcast_id.to_s))
  • Start a space broadcast
    local_var_path = '/video/v1/spaces/${SPACE_ID}/broadcasts/${BROADCAST_ID}/start'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s)).sub('{' + 'BROADCAST_ID' + '}', CGI.escape(broadcast_id.to_s))
  • Stop a space broadcast
    local_var_path = '/video/v1/spaces/${SPACE_ID}/broadcasts/${BROADCAST_ID}/stop'.sub('{' + 'SPACE_ID' + '}', CGI.escape(space_id.to_s)).sub('{' + 'BROADCAST_ID' + '}', CGI.escape(broadcast_id.to_s))

How to reproduce

The default spaces example for creating a broadcast should show you the error:

api_instance = MuxRuby::SpacesApi.new
space_id = 'space_id_example' # String | The space ID.
create_broadcast_request = MuxRuby::CreateBroadcastRequest.new({live_stream_id: 'live_stream_id_example'}) # CreateBroadcastRequest | 

begin
  # Create a space broadcast
  result = api_instance.create_space_broadcast(space_id, create_broadcast_request)
  p result
rescue MuxRuby::ApiError => e
  puts "Error when calling SpacesApi->create_space_broadcast: #{e}"
end

You should get API response something like this (redacted the space_id):

ETHON: performed EASY effective_url=https://api.mux.com/video/v1/spaces/$redacted_space_id/broadcasts response_code=400 return_code=ok total_time=0.563622
Error when calling SpacesApi->create_space_broadcast:
HTTP status code: 400
Response headers: {"cache-control"=>"max-age=0, private, must-revalidate", "content-type"=>"application/json; charset=utf-8", "date"=>"Mon, 13 Jun 2022 16:04:47 GMT", "server"=>"Mux API Server v1.157.23", "x-request-id"=>"Fvg5rxBASuUuMp8DfAMF", "content-length"=>"88"}
Response body: {"error":{"type":"invalid_parameters","messages":["Invalid space id, failed to parse"]}}

Expected behaviour

When variable substitution occurs in the API paths $ is not prepended to identifiers and API requests are not rejected.

Actual behaviour

When variable substitution occurs in the API paths $ is prepended to identifiers and API requests are rejected.

Add a CHANGELOG or similar

Hi Mux! Love your product ❤️

Could you please add a CHANGELOG or HISTORY or something similar to this project? Not knowing what changed between releases makes upgrading a bit cumbersome.

Generated subtitles error

After updating from 1.9.0 to 3.9.0 I'm getting an error on get_asset with a generated subtitles track

Relevant code:

create_asset_request = MuxRuby::CreateAssetRequest.new
create_asset_request.input = [
  {
    url: [the_source],
    generated_subtitles: [
      {
        language_code: 'en',
        name: 'English CC',
      }
    ]
  },
]
create_response = assets_api.create_asset(create_asset_request)
asset_id = create_response.data.id
...
asset = assets_api.get_asset(asset_id)
ArgumentError (invalid value for "text_source", must be one of ["uploaded", "embedded", "generated_live", "generated_live_final"].):

In the mux web admin I can see the asset was created and has a subtitles track with "text_source": "generated_vod"

{
  "type": "text",
  "text_type": "subtitles",
  "text_source": "generated_vod",
  "status": "ready",
  "name": "English CC",
  "language_code": "en",
  "id": [track_id]
}

Downgrading to 1.9.0 makes everything work perfectly.

create_asset_request do not accept passthrough

Hi,

When creating a live_stream, I set a passthrough, it's work correctly except that asset created do not have the passthrough (even if the doc say so).

But when specify passthrough in create_asset_request like

MuxRuby::CreateAssetRequest.new({
  playback_policy: [MuxRuby::PlaybackPolicy::PUBLIC],
  passthrough: @passthrough
})

and also specify it in CreateLiveStreamRequest

MuxRuby::CreateLiveStreamRequest.new({
  playback_policy: [MuxRuby::PlaybackPolicy::PUBLIC], 
  new_asset_settings: new_asset_settings,
  passthrough: @passthrough
})

I got the following error message:
"The field "new_asset_settings.passthrough" should be provided as "passthrough" and will returned for both the live stream and its assets."

So how I can get passthrough in asset produced by a live_stream ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.