Sha256: 296d84ea94cdf27312c26164ea2f07bbd461ff1044525d71ffcc6389ff1321f2

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby 

require 'mux_ruby'
require 'solid_assert'

SolidAssert.enable_assertions

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

# API Client Initialization
keys_api = MuxRuby::URLSigningKeysApi.new

# ========== create-url-signing-key ==========
key = keys_api.create_url_signing_key()
assert key != nil
assert key.data.id != nil
assert key.data.private_key != nil
puts "create-url-signing-key OK ✅"

# ========== list-url-signing-keys ==========
keys = keys_api.list_url_signing_keys()
assert keys != nil
assert keys.data.last != nil
assert keys.data.last.id = key.data.id
assert keys.data.last.private_key == nil
puts "list-url-signing-keys OK ✅"

# ========== get-url-signing-key ==========
key_get = keys_api.get_url_signing_key(key.data.id)
assert key_get.data != nil
puts "get-url-signing-key OK ✅"

# ========== delete-url-signing-key ==========
keys_api.delete_url_signing_key(key.data.id)
begin
    sleep 60
    deleted_key = keys_api.get_url_signing_key(key.data.id)
    puts 'Should have errored here.'
    exit 255
rescue MuxRuby::NotFoundError => e
    assert e != nil
end
puts "delete-url-signing-key OK ✅"

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mux_ruby-3.20.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.19.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.18.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.17.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.15.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.14.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.13.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.12.0 examples/video/exercise-signing-keys.rb
mux_ruby-3.11.1 examples/video/exercise-signing-keys.rb
mux_ruby-3.11.0 examples/video/exercise-signing-keys.rb