-
Notifications
You must be signed in to change notification settings - Fork 13
/
exercise-metrics.rb
45 lines (36 loc) · 1.39 KB
/
exercise-metrics.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/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
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 ✅"