mux_ruby 1.7.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/docs/DimensionValue.md +9 -0
  4. data/docs/DimensionsApi.md +118 -0
  5. data/docs/FiltersApi.md +2 -2
  6. data/docs/GetRealTimeBreakdownResponse.md +10 -0
  7. data/docs/GetRealTimeHistogramTimeseriesResponse.md +11 -0
  8. data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +8 -0
  9. data/docs/GetRealTimeTimeseriesResponse.md +10 -0
  10. data/docs/Incident.md +28 -0
  11. data/docs/IncidentBreakdown.md +10 -0
  12. data/docs/IncidentNotification.md +10 -0
  13. data/docs/IncidentNotificationRule.md +12 -0
  14. data/docs/IncidentResponse.md +9 -0
  15. data/docs/IncidentsApi.md +186 -0
  16. data/docs/ListDimensionValuesResponse.md +10 -0
  17. data/docs/ListDimensionsResponse.md +10 -0
  18. data/docs/ListIncidentsResponse.md +10 -0
  19. data/docs/ListRealTimeDimensionsResponse.md +10 -0
  20. data/docs/ListRealTimeDimensionsResponseData.md +9 -0
  21. data/docs/ListRealTimeMetricsResponse.md +10 -0
  22. data/docs/ListRelatedIncidentsResponse.md +10 -0
  23. data/docs/NotificationRule.md +10 -0
  24. data/docs/RealTimeApi.md +280 -0
  25. data/docs/RealTimeBreakdownValue.md +12 -0
  26. data/docs/RealTimeHistogramTimeseriesBucket.md +9 -0
  27. data/docs/RealTimeHistogramTimeseriesBucketValues.md +9 -0
  28. data/docs/RealTimeHistogramTimeseriesDatapoint.md +14 -0
  29. data/docs/RealTimeTimeseriesDatapoint.md +10 -0
  30. data/examples/data/exercise-dimensions.rb +29 -0
  31. data/examples/data/exercise-incidents.rb +29 -0
  32. data/examples/data/exercise-realtime.rb +60 -0
  33. data/lib/mux_ruby.rb +26 -0
  34. data/lib/mux_ruby/api/dimensions_api.rb +128 -0
  35. data/lib/mux_ruby/api/filters_api.rb +4 -4
  36. data/lib/mux_ruby/api/incidents_api.rb +217 -0
  37. data/lib/mux_ruby/api/real_time_api.rb +311 -0
  38. data/lib/mux_ruby/models/asset.rb +12 -0
  39. data/lib/mux_ruby/models/dimension_value.rb +193 -0
  40. data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +206 -0
  41. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +215 -0
  42. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +186 -0
  43. data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +206 -0
  44. data/lib/mux_ruby/models/incident.rb +370 -0
  45. data/lib/mux_ruby/models/incident_breakdown.rb +202 -0
  46. data/lib/mux_ruby/models/incident_notification.rb +202 -0
  47. data/lib/mux_ruby/models/incident_notification_rule.rb +222 -0
  48. data/lib/mux_ruby/models/incident_response.rb +195 -0
  49. data/lib/mux_ruby/models/list_dimension_values_response.rb +206 -0
  50. data/lib/mux_ruby/models/list_dimensions_response.rb +204 -0
  51. data/lib/mux_ruby/models/list_incidents_response.rb +206 -0
  52. data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +206 -0
  53. data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +193 -0
  54. data/lib/mux_ruby/models/list_real_time_metrics_response.rb +206 -0
  55. data/lib/mux_ruby/models/list_related_incidents_response.rb +206 -0
  56. data/lib/mux_ruby/models/notification_rule.rb +202 -0
  57. data/lib/mux_ruby/models/real_time_breakdown_value.rb +220 -0
  58. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +193 -0
  59. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +193 -0
  60. data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +240 -0
  61. data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +202 -0
  62. data/lib/mux_ruby/version.rb +1 -1
  63. data/spec/api/dimensions_api_spec.rb +55 -0
  64. data/spec/api/filters_api_spec.rb +2 -2
  65. data/spec/api/incidents_api_spec.rb +73 -0
  66. data/spec/api/real_time_api_spec.rb +93 -0
  67. data/spec/models/asset_spec.rb +4 -0
  68. data/spec/models/dimension_value_spec.rb +40 -0
  69. data/spec/models/get_real_time_breakdown_response_spec.rb +46 -0
  70. data/spec/models/get_real_time_histogram_timeseries_response_meta_spec.rb +34 -0
  71. data/spec/models/get_real_time_histogram_timeseries_response_spec.rb +52 -0
  72. data/spec/models/get_real_time_timeseries_response_spec.rb +46 -0
  73. data/spec/models/incident_breakdown_spec.rb +46 -0
  74. data/spec/models/incident_notification_rule_spec.rb +58 -0
  75. data/spec/models/incident_notification_spec.rb +46 -0
  76. data/spec/models/incident_response_spec.rb +40 -0
  77. data/spec/models/incident_spec.rb +154 -0
  78. data/spec/models/list_dimension_values_response_spec.rb +46 -0
  79. data/spec/models/list_dimensions_response_spec.rb +46 -0
  80. data/spec/models/list_incidents_response_spec.rb +46 -0
  81. data/spec/models/list_real_time_dimensions_response_data_spec.rb +40 -0
  82. data/spec/models/list_real_time_dimensions_response_spec.rb +46 -0
  83. data/spec/models/list_real_time_metrics_response_spec.rb +46 -0
  84. data/spec/models/list_related_incidents_response_spec.rb +46 -0
  85. data/spec/models/notification_rule_spec.rb +46 -0
  86. data/spec/models/real_time_breakdown_value_spec.rb +58 -0
  87. data/spec/models/real_time_histogram_timeseries_bucket_spec.rb +40 -0
  88. data/spec/models/real_time_histogram_timeseries_bucket_values_spec.rb +40 -0
  89. data/spec/models/real_time_histogram_timeseries_datapoint_spec.rb +70 -0
  90. data/spec/models/real_time_timeseries_datapoint_spec.rb +46 -0
  91. metadata +171 -64
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mux_ruby'
4
+ require 'solid_assert'
5
+
6
+ SolidAssert.enable_assertions
7
+
8
+ # Authentication Setup
9
+ openapi = MuxRuby.configure do |config|
10
+ config.username = ENV['MUX_TOKEN_ID']
11
+ config.password = ENV['MUX_TOKEN_SECRET']
12
+ end
13
+
14
+ # API Client Initialization
15
+ incidents_api = MuxRuby::IncidentsApi.new
16
+
17
+ # Test coverage here is poor due to not knowning if the account we're testing against has any incidents.
18
+
19
+ # ========== list-incidents ==========
20
+ incidents = incidents_api.list_incidents
21
+ assert incidents != nil
22
+ assert incidents.data != nil
23
+ puts "list-incidents OK ✅"
24
+
25
+ # ========== get-incident ==========
26
+ puts "get-incident SKIP ⚠️"
27
+
28
+ # ========== list-related-incidents ==========
29
+ puts "list-related-incidents SKIP ⚠️"
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mux_ruby'
4
+ require 'solid_assert'
5
+
6
+ SolidAssert.enable_assertions
7
+
8
+ # Authentication Setup
9
+ openapi = MuxRuby.configure do |config|
10
+ config.username = ENV['MUX_TOKEN_ID']
11
+ config.password = ENV['MUX_TOKEN_SECRET']
12
+ end
13
+
14
+ # API Client Initialization
15
+ rt_api = MuxRuby::RealTimeApi.new
16
+
17
+ # Test coverage here isn't fantastic due to not knowning if the account we're testing against has
18
+ # any real-time data. The behaviour has been manually verified against real-world data.
19
+
20
+ # ========== list-realtime-dimensions ==========
21
+ dimensions = rt_api.list_realtime_dimensions
22
+ assert dimensions != nil
23
+ assert dimensions.data != nil
24
+ assert dimensions.data.length > 0
25
+ assert dimensions.data.first.name != ''
26
+ assert dimensions.data.first.display_name != ''
27
+ puts "list-realtime-dimensions OK ✅"
28
+
29
+ # ========== list-realtime-metrics ==========
30
+ metrics = rt_api.list_realtime_metrics
31
+ assert metrics != nil
32
+ assert metrics.data != nil
33
+ assert metrics.data.length > 0
34
+ assert metrics.data.first.name != ''
35
+ assert metrics.data.first.display_name != ''
36
+ puts "list-realtime-metrics OK ✅"
37
+
38
+ # ========== get-realtime-breakdown ==========
39
+ breakdown = rt_api.get_realtime_breakdown('current-rebuffering-percentage', {:dimension => 'asn'})
40
+ assert breakdown != nil
41
+ assert breakdown.data != nil
42
+ puts "get-realtime-breakdown OK ✅"
43
+
44
+ # ========== get-realtime-histogram-timeseries ==========
45
+ histogram_timeseries = rt_api.get_realtime_histogram_timeseries('video-startup-time')
46
+ assert histogram_timeseries != nil
47
+ assert histogram_timeseries.meta != nil
48
+ assert histogram_timeseries.meta.buckets != nil
49
+ assert histogram_timeseries.meta.buckets.length > 0
50
+ assert histogram_timeseries.data != nil
51
+ assert histogram_timeseries.data.length > 0
52
+ puts "get-realtime-histogram-timeseries OK ✅"
53
+
54
+ # ========== get-realtime-timeseries ==========
55
+ timeseries = rt_api.get_realtime_timeseries('current-rebuffering-percentage')
56
+ assert timeseries != nil
57
+ assert timeseries.data != nil
58
+ assert timeseries.data.length > 0
59
+ assert timeseries.data.first.date != ''
60
+ puts "get-realtime-timeseries OK ✅"
@@ -29,6 +29,7 @@ require 'mux_ruby/models/create_track_request'
29
29
  require 'mux_ruby/models/create_track_response'
30
30
  require 'mux_ruby/models/create_upload_request'
31
31
  require 'mux_ruby/models/delivery_report'
32
+ require 'mux_ruby/models/dimension_value'
32
33
  require 'mux_ruby/models/disable_live_stream_response'
33
34
  require 'mux_ruby/models/enable_live_stream_response'
34
35
  require 'mux_ruby/models/error'
@@ -37,6 +38,15 @@ require 'mux_ruby/models/get_asset_input_info_response'
37
38
  require 'mux_ruby/models/get_asset_playback_id_response'
38
39
  require 'mux_ruby/models/get_metric_timeseries_data_response'
39
40
  require 'mux_ruby/models/get_overall_values_response'
41
+ require 'mux_ruby/models/get_real_time_breakdown_response'
42
+ require 'mux_ruby/models/get_real_time_histogram_timeseries_response'
43
+ require 'mux_ruby/models/get_real_time_histogram_timeseries_response_meta'
44
+ require 'mux_ruby/models/get_real_time_timeseries_response'
45
+ require 'mux_ruby/models/incident'
46
+ require 'mux_ruby/models/incident_breakdown'
47
+ require 'mux_ruby/models/incident_notification'
48
+ require 'mux_ruby/models/incident_notification_rule'
49
+ require 'mux_ruby/models/incident_response'
40
50
  require 'mux_ruby/models/input_file'
41
51
  require 'mux_ruby/models/input_info'
42
52
  require 'mux_ruby/models/input_settings'
@@ -47,22 +57,35 @@ require 'mux_ruby/models/list_all_metric_values_response'
47
57
  require 'mux_ruby/models/list_assets_response'
48
58
  require 'mux_ruby/models/list_breakdown_values_response'
49
59
  require 'mux_ruby/models/list_delivery_usage_response'
60
+ require 'mux_ruby/models/list_dimension_values_response'
61
+ require 'mux_ruby/models/list_dimensions_response'
50
62
  require 'mux_ruby/models/list_errors_response'
51
63
  require 'mux_ruby/models/list_exports_response'
52
64
  require 'mux_ruby/models/list_filter_values_response'
53
65
  require 'mux_ruby/models/list_filters_response'
54
66
  require 'mux_ruby/models/list_filters_response_data'
67
+ require 'mux_ruby/models/list_incidents_response'
55
68
  require 'mux_ruby/models/list_insights_response'
56
69
  require 'mux_ruby/models/list_live_streams_response'
70
+ require 'mux_ruby/models/list_real_time_dimensions_response'
71
+ require 'mux_ruby/models/list_real_time_dimensions_response_data'
72
+ require 'mux_ruby/models/list_real_time_metrics_response'
73
+ require 'mux_ruby/models/list_related_incidents_response'
57
74
  require 'mux_ruby/models/list_signing_keys_response'
58
75
  require 'mux_ruby/models/list_uploads_response'
59
76
  require 'mux_ruby/models/list_video_views_response'
60
77
  require 'mux_ruby/models/live_stream'
61
78
  require 'mux_ruby/models/live_stream_response'
62
79
  require 'mux_ruby/models/metric'
80
+ require 'mux_ruby/models/notification_rule'
63
81
  require 'mux_ruby/models/overall_values'
64
82
  require 'mux_ruby/models/playback_id'
65
83
  require 'mux_ruby/models/playback_policy'
84
+ require 'mux_ruby/models/real_time_breakdown_value'
85
+ require 'mux_ruby/models/real_time_histogram_timeseries_bucket'
86
+ require 'mux_ruby/models/real_time_histogram_timeseries_bucket_values'
87
+ require 'mux_ruby/models/real_time_histogram_timeseries_datapoint'
88
+ require 'mux_ruby/models/real_time_timeseries_datapoint'
66
89
  require 'mux_ruby/models/score'
67
90
  require 'mux_ruby/models/signal_live_stream_complete_response'
68
91
  require 'mux_ruby/models/signing_key'
@@ -82,12 +105,15 @@ require 'mux_ruby/models/video_view_response'
82
105
  # APIs
83
106
  require 'mux_ruby/api/assets_api'
84
107
  require 'mux_ruby/api/delivery_usage_api'
108
+ require 'mux_ruby/api/dimensions_api'
85
109
  require 'mux_ruby/api/direct_uploads_api'
86
110
  require 'mux_ruby/api/errors_api'
87
111
  require 'mux_ruby/api/exports_api'
88
112
  require 'mux_ruby/api/filters_api'
113
+ require 'mux_ruby/api/incidents_api'
89
114
  require 'mux_ruby/api/live_streams_api'
90
115
  require 'mux_ruby/api/metrics_api'
116
+ require 'mux_ruby/api/real_time_api'
91
117
  require 'mux_ruby/api/url_signing_keys_api'
92
118
  require 'mux_ruby/api/video_views_api'
93
119
 
@@ -0,0 +1,128 @@
1
+ =begin
2
+ # Mux Ruby - Copyright 2019 Mux Inc.
3
+ # NOTE: This file is auto generated. Do not edit this file manually.
4
+ =end
5
+
6
+ require 'uri'
7
+
8
+ module MuxRuby
9
+ class DimensionsApi
10
+ attr_accessor :api_client
11
+
12
+ def initialize(api_client = ApiClient.default)
13
+ @api_client = api_client
14
+ end
15
+ # Lists the values for a specific dimension
16
+ # Lists the values for a dimension along with a total count of related views. Note: This API replaces the list-filter-values API call.
17
+ # @param dimension_id ID of the Dimension
18
+ # @param [Hash] opts the optional parameters
19
+ # @option opts [Integer] :limit Number of items to include in the response (default to 25)
20
+ # @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1)
21
+ # @option opts [Array<String>] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]&#x3D;operating_system:windows&amp;filters[]&#x3D;country:US). Possible filter names are the same as returned by the List Filters endpoint.
22
+ # @option opts [Array<String>] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]&#x3D;). Accepted formats are... * array of epoch timestamps e.g. timeframe[]&#x3D;1498867200&amp;timeframe[]&#x3D;1498953600 * duration string e.g. timeframe[]&#x3D;24:hours or timeframe[]&#x3D;7:days.
23
+ # @return [ListDimensionValuesResponse]
24
+ def list_dimension_values(dimension_id, opts = {})
25
+ data, _status_code, _headers = list_dimension_values_with_http_info(dimension_id, opts)
26
+ data
27
+ end
28
+
29
+ # Lists the values for a specific dimension
30
+ # Lists the values for a dimension along with a total count of related views. Note: This API replaces the list-filter-values API call.
31
+ # @param dimension_id ID of the Dimension
32
+ # @param [Hash] opts the optional parameters
33
+ # @option opts [Integer] :limit Number of items to include in the response
34
+ # @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60;
35
+ # @option opts [Array<String>] :filters Filter key:value pairs. Must be provided as an array query string parameter (e.g. filters[]&#x3D;operating_system:windows&amp;filters[]&#x3D;country:US). Possible filter names are the same as returned by the List Filters endpoint.
36
+ # @option opts [Array<String>] :timeframe Timeframe window to limit results by. Must be provided as an array query string parameter (e.g. timeframe[]&#x3D;). Accepted formats are... * array of epoch timestamps e.g. timeframe[]&#x3D;1498867200&amp;timeframe[]&#x3D;1498953600 * duration string e.g. timeframe[]&#x3D;24:hours or timeframe[]&#x3D;7:days.
37
+ # @return [Array<(ListDimensionValuesResponse, Fixnum, Hash)>] ListDimensionValuesResponse data, response status code and response headers
38
+ def list_dimension_values_with_http_info(dimension_id, opts = {})
39
+ if @api_client.config.debugging
40
+ @api_client.config.logger.debug 'Calling API: DimensionsApi.list_dimension_values ...'
41
+ end
42
+ # verify the required parameter 'dimension_id' is set
43
+ if @api_client.config.client_side_validation && dimension_id.nil?
44
+ fail ArgumentError, "Missing the required parameter 'dimension_id' when calling DimensionsApi.list_dimension_values"
45
+ end
46
+ # resource path
47
+ local_var_path = '/data/v1/dimensions/{DIMENSION_ID}'.sub('{' + 'DIMENSION_ID' + '}', dimension_id.to_s)
48
+
49
+ # query parameters
50
+ query_params = {}
51
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
52
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
53
+ query_params[:'filters[]'] = @api_client.build_collection_param(opts[:'filters'], :multi) if !opts[:'filters'].nil?
54
+ query_params[:'timeframe[]'] = @api_client.build_collection_param(opts[:'timeframe'], :multi) if !opts[:'timeframe'].nil?
55
+
56
+ # header parameters
57
+ header_params = {}
58
+ # HTTP header 'Accept' (if needed)
59
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
60
+
61
+ # form parameters
62
+ form_params = {}
63
+
64
+ # http body (model)
65
+ post_body = nil
66
+ auth_names = ['accessToken']
67
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => 'ListDimensionValuesResponse')
74
+ if @api_client.config.debugging
75
+ @api_client.config.logger.debug "API called: DimensionsApi#list_dimension_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ end
77
+ return data, status_code, headers
78
+ end
79
+
80
+ # List Dimensions
81
+ # List all available dimensions. Note: This API replaces the list-filters API call.
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [ListDimensionsResponse]
84
+ def list_dimensions(opts = {})
85
+ data, _status_code, _headers = list_dimensions_with_http_info(opts)
86
+ data
87
+ end
88
+
89
+ # List Dimensions
90
+ # List all available dimensions. Note: This API replaces the list-filters API call.
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [Array<(ListDimensionsResponse, Fixnum, Hash)>] ListDimensionsResponse data, response status code and response headers
93
+ def list_dimensions_with_http_info(opts = {})
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug 'Calling API: DimensionsApi.list_dimensions ...'
96
+ end
97
+ # resource path
98
+ local_var_path = '/data/v1/dimensions'
99
+
100
+ # query parameters
101
+ query_params = {}
102
+
103
+ # header parameters
104
+ header_params = {}
105
+ # HTTP header 'Accept' (if needed)
106
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
107
+
108
+ # form parameters
109
+ form_params = {}
110
+
111
+ # http body (model)
112
+ post_body = nil
113
+ auth_names = ['accessToken']
114
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
115
+ :header_params => header_params,
116
+ :query_params => query_params,
117
+ :form_params => form_params,
118
+ :body => post_body,
119
+ :auth_names => auth_names,
120
+ :return_type => 'ListDimensionsResponse')
121
+ if @api_client.config.debugging
122
+ @api_client.config.logger.debug "API called: DimensionsApi#list_dimensions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
123
+ end
124
+ return data, status_code, headers
125
+ end
126
+
127
+ end
128
+ end
@@ -13,7 +13,7 @@ module MuxRuby
13
13
  @api_client = api_client
14
14
  end
15
15
  # Lists values for a specific filter
16
- # Lists the values for a filter along with a total count of related views
16
+ # Deprecated: The API has been replaced by the list-dimension-values API call. Lists the values for a filter along with a total count of related views.
17
17
  # @param filter_id ID of the Filter
18
18
  # @param [Hash] opts the optional parameters
19
19
  # @option opts [Integer] :limit Number of items to include in the response (default to 25)
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  end
28
28
 
29
29
  # Lists values for a specific filter
30
- # Lists the values for a filter along with a total count of related views
30
+ # Deprecated: The API has been replaced by the list-dimension-values API call. Lists the values for a filter along with a total count of related views.
31
31
  # @param filter_id ID of the Filter
32
32
  # @param [Hash] opts the optional parameters
33
33
  # @option opts [Integer] :limit Number of items to include in the response
@@ -78,7 +78,7 @@ module MuxRuby
78
78
  end
79
79
 
80
80
  # List Filters
81
- # Lists all the filters broken out into basic and advanced
81
+ # Deprecated: The API has been replaced by the list-dimensions API call. Lists all the filters broken out into basic and advanced.
82
82
  # @param [Hash] opts the optional parameters
83
83
  # @return [ListFiltersResponse]
84
84
  def list_filters(opts = {})
@@ -87,7 +87,7 @@ module MuxRuby
87
87
  end
88
88
 
89
89
  # List Filters
90
- # Lists all the filters broken out into basic and advanced
90
+ # Deprecated: The API has been replaced by the list-dimensions API call. Lists all the filters broken out into basic and advanced.
91
91
  # @param [Hash] opts the optional parameters
92
92
  # @return [Array<(ListFiltersResponse, Fixnum, Hash)>] ListFiltersResponse data, response status code and response headers
93
93
  def list_filters_with_http_info(opts = {})
@@ -0,0 +1,217 @@
1
+ =begin
2
+ # Mux Ruby - Copyright 2019 Mux Inc.
3
+ # NOTE: This file is auto generated. Do not edit this file manually.
4
+ =end
5
+
6
+ require 'uri'
7
+
8
+ module MuxRuby
9
+ class IncidentsApi
10
+ attr_accessor :api_client
11
+
12
+ def initialize(api_client = ApiClient.default)
13
+ @api_client = api_client
14
+ end
15
+ # Get an Incident
16
+ # Returns the details of an incident
17
+ # @param incident_id ID of the Incident
18
+ # @param [Hash] opts the optional parameters
19
+ # @return [IncidentResponse]
20
+ def get_incident(incident_id, opts = {})
21
+ data, _status_code, _headers = get_incident_with_http_info(incident_id, opts)
22
+ data
23
+ end
24
+
25
+ # Get an Incident
26
+ # Returns the details of an incident
27
+ # @param incident_id ID of the Incident
28
+ # @param [Hash] opts the optional parameters
29
+ # @return [Array<(IncidentResponse, Fixnum, Hash)>] IncidentResponse data, response status code and response headers
30
+ def get_incident_with_http_info(incident_id, opts = {})
31
+ if @api_client.config.debugging
32
+ @api_client.config.logger.debug 'Calling API: IncidentsApi.get_incident ...'
33
+ end
34
+ # verify the required parameter 'incident_id' is set
35
+ if @api_client.config.client_side_validation && incident_id.nil?
36
+ fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.get_incident"
37
+ end
38
+ # resource path
39
+ local_var_path = '/data/v1/incidents/{INCIDENT_ID}'.sub('{' + 'INCIDENT_ID' + '}', incident_id.to_s)
40
+
41
+ # query parameters
42
+ query_params = {}
43
+
44
+ # header parameters
45
+ header_params = {}
46
+ # HTTP header 'Accept' (if needed)
47
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
48
+
49
+ # form parameters
50
+ form_params = {}
51
+
52
+ # http body (model)
53
+ post_body = nil
54
+ auth_names = ['accessToken']
55
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
56
+ :header_params => header_params,
57
+ :query_params => query_params,
58
+ :form_params => form_params,
59
+ :body => post_body,
60
+ :auth_names => auth_names,
61
+ :return_type => 'IncidentResponse')
62
+ if @api_client.config.debugging
63
+ @api_client.config.logger.debug "API called: IncidentsApi#get_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
64
+ end
65
+ return data, status_code, headers
66
+ end
67
+
68
+ # List Incidents
69
+ # Returns a list of incidents
70
+ # @param [Hash] opts the optional parameters
71
+ # @option opts [Integer] :limit Number of items to include in the response (default to 25)
72
+ # @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60; (default to 1)
73
+ # @option opts [String] :order_by Value to order the results by
74
+ # @option opts [String] :order_direction Sort order.
75
+ # @option opts [String] :status Status to filter incidents by
76
+ # @option opts [String] :severity Severity to filter incidents by
77
+ # @return [ListIncidentsResponse]
78
+ def list_incidents(opts = {})
79
+ data, _status_code, _headers = list_incidents_with_http_info(opts)
80
+ data
81
+ end
82
+
83
+ # List Incidents
84
+ # Returns a list of incidents
85
+ # @param [Hash] opts the optional parameters
86
+ # @option opts [Integer] :limit Number of items to include in the response
87
+ # @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60;
88
+ # @option opts [String] :order_by Value to order the results by
89
+ # @option opts [String] :order_direction Sort order.
90
+ # @option opts [String] :status Status to filter incidents by
91
+ # @option opts [String] :severity Severity to filter incidents by
92
+ # @return [Array<(ListIncidentsResponse, Fixnum, Hash)>] ListIncidentsResponse data, response status code and response headers
93
+ def list_incidents_with_http_info(opts = {})
94
+ if @api_client.config.debugging
95
+ @api_client.config.logger.debug 'Calling API: IncidentsApi.list_incidents ...'
96
+ end
97
+ if @api_client.config.client_side_validation && opts[:'order_by'] && !['negative_impact', 'value', 'views', 'field'].include?(opts[:'order_by'])
98
+ fail ArgumentError, 'invalid value for "order_by", must be one of negative_impact, value, views, field'
99
+ end
100
+ if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
101
+ fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
102
+ end
103
+ if @api_client.config.client_side_validation && opts[:'status'] && !['open', 'closed', 'expired'].include?(opts[:'status'])
104
+ fail ArgumentError, 'invalid value for "status", must be one of open, closed, expired'
105
+ end
106
+ if @api_client.config.client_side_validation && opts[:'severity'] && !['warning', 'alert'].include?(opts[:'severity'])
107
+ fail ArgumentError, 'invalid value for "severity", must be one of warning, alert'
108
+ end
109
+ # resource path
110
+ local_var_path = '/data/v1/incidents'
111
+
112
+ # query parameters
113
+ query_params = {}
114
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
115
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
116
+ query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
117
+ query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
118
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
119
+ query_params[:'severity'] = opts[:'severity'] if !opts[:'severity'].nil?
120
+
121
+ # header parameters
122
+ header_params = {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+
126
+ # form parameters
127
+ form_params = {}
128
+
129
+ # http body (model)
130
+ post_body = nil
131
+ auth_names = ['accessToken']
132
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
133
+ :header_params => header_params,
134
+ :query_params => query_params,
135
+ :form_params => form_params,
136
+ :body => post_body,
137
+ :auth_names => auth_names,
138
+ :return_type => 'ListIncidentsResponse')
139
+ if @api_client.config.debugging
140
+ @api_client.config.logger.debug "API called: IncidentsApi#list_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
141
+ end
142
+ return data, status_code, headers
143
+ end
144
+
145
+ # List Related Incidents
146
+ # Returns all the incidents that seem related to a specific incident
147
+ # @param incident_id ID of the Incident
148
+ # @param [Hash] opts the optional parameters
149
+ # @option opts [Integer] :limit Number of items to include in the response (default to 25)
150
+ # @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60; (default to 1)
151
+ # @option opts [String] :order_by Value to order the results by
152
+ # @option opts [String] :order_direction Sort order.
153
+ # @return [ListRelatedIncidentsResponse]
154
+ def list_related_incidents(incident_id, opts = {})
155
+ data, _status_code, _headers = list_related_incidents_with_http_info(incident_id, opts)
156
+ data
157
+ end
158
+
159
+ # List Related Incidents
160
+ # Returns all the incidents that seem related to a specific incident
161
+ # @param incident_id ID of the Incident
162
+ # @param [Hash] opts the optional parameters
163
+ # @option opts [Integer] :limit Number of items to include in the response
164
+ # @option opts [Integer] :page Offset by this many pages, of the size of &#x60;limit&#x60;
165
+ # @option opts [String] :order_by Value to order the results by
166
+ # @option opts [String] :order_direction Sort order.
167
+ # @return [Array<(ListRelatedIncidentsResponse, Fixnum, Hash)>] ListRelatedIncidentsResponse data, response status code and response headers
168
+ def list_related_incidents_with_http_info(incident_id, opts = {})
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug 'Calling API: IncidentsApi.list_related_incidents ...'
171
+ end
172
+ # verify the required parameter 'incident_id' is set
173
+ if @api_client.config.client_side_validation && incident_id.nil?
174
+ fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.list_related_incidents"
175
+ end
176
+ if @api_client.config.client_side_validation && opts[:'order_by'] && !['negative_impact', 'value', 'views', 'field'].include?(opts[:'order_by'])
177
+ fail ArgumentError, 'invalid value for "order_by", must be one of negative_impact, value, views, field'
178
+ end
179
+ if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
180
+ fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
181
+ end
182
+ # resource path
183
+ local_var_path = '/data/v1/incidents/{INCIDENT_ID}/related'.sub('{' + 'INCIDENT_ID' + '}', incident_id.to_s)
184
+
185
+ # query parameters
186
+ query_params = {}
187
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
188
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
189
+ query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
190
+ query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
191
+
192
+ # header parameters
193
+ header_params = {}
194
+ # HTTP header 'Accept' (if needed)
195
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
196
+
197
+ # form parameters
198
+ form_params = {}
199
+
200
+ # http body (model)
201
+ post_body = nil
202
+ auth_names = ['accessToken']
203
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
204
+ :header_params => header_params,
205
+ :query_params => query_params,
206
+ :form_params => form_params,
207
+ :body => post_body,
208
+ :auth_names => auth_names,
209
+ :return_type => 'ListRelatedIncidentsResponse')
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug "API called: IncidentsApi#list_related_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
212
+ end
213
+ return data, status_code, headers
214
+ end
215
+
216
+ end
217
+ end