Sha256: eaf08c8ccb814914eac81facf0ac880d6771ed5045677f578cc6f5178afe72e5

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

#!/usr/bin/env ruby

require 'mux_ruby'
require 'solid_assert'

SolidAssert.enable_assertions

# Exercises all asset operations:
#   list-breakdown-values
#   get-overall-values
#   list-insights
#   get-metric-timeseries-data
#   list-all-metric-values

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

# API Client Initialization
metrics_api = MuxRuby::MetricsApi.new

# ========== list-breakdown-values ==========
breakdown = metrics_api.list_breakdown_values('video_startup_time', {:group_by => 'browser', :timeframe => ['7:days']})
assert breakdown != nil
assert breakdown.data != nil
puts "list-breakdown-values OK ✅"

# ========== get-overall-values ==========
overall = metrics_api.get_overall_values('video_startup_time', {:timeframe => ['7:days']})
assert overall != nil
assert overall.data != nil
puts "get-overall-values OK ✅"

# ========== list-insights ==========
insights = metrics_api.list_insights('video_startup_time', {:timeframe => ['7:days']})
assert insights != nil
assert insights.data != nil
puts "list-insights OK ✅"

# ========== get-metric-timeseries-data ==========
timeseries = metrics_api.get_metric_timeseries_data('video_startup_time', {:timeframe => ['7:days']})
assert timeseries != nil
assert timeseries.data != nil
puts "get-metric-timeseries-data OK ✅"

# ========== list-all-metric-values ==========
values = metrics_api.list_all_metric_values()
assert values != nil
assert values.data != nil
puts "list-all-metric-values OK ✅"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mux_ruby-1.0.0 examples/data/exercise-metrics.rb