mux_ruby 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +3 -0
  4. data/docs/Asset.md +1 -0
  5. data/docs/AssetsApi.md +103 -0
  6. data/docs/CreateAssetRequest.md +2 -0
  7. data/docs/CreateLiveStreamRequest.md +3 -0
  8. data/docs/CreateSimulcastTargetRequest.md +10 -0
  9. data/docs/CreateTrackRequest.md +14 -0
  10. data/docs/CreateTrackResponse.md +8 -0
  11. data/docs/DeliveryReport.md +14 -0
  12. data/docs/DeliveryUsageApi.md +68 -0
  13. data/docs/GetMetricTimeseriesDataResponse.md +1 -1
  14. data/docs/GetOverallValuesResponse.md +1 -1
  15. data/docs/InputSettings.md +6 -1
  16. data/docs/InputTrack.md +0 -2
  17. data/docs/Insight.md +2 -2
  18. data/docs/ListAllMetricValuesResponse.md +1 -1
  19. data/docs/ListBreakdownValuesResponse.md +1 -1
  20. data/docs/ListDeliveryUsageResponse.md +11 -0
  21. data/docs/ListErrorsResponse.md +1 -1
  22. data/docs/ListExportsResponse.md +1 -1
  23. data/docs/ListFilterValuesResponse.md +1 -1
  24. data/docs/ListFiltersResponse.md +1 -1
  25. data/docs/ListInsightsResponse.md +1 -1
  26. data/docs/ListVideoViewsResponse.md +1 -1
  27. data/docs/LiveStream.md +2 -0
  28. data/docs/LiveStreamsApi.md +161 -0
  29. data/docs/SigningKeyResponse.md +1 -1
  30. data/docs/SimulcastTarget.md +12 -0
  31. data/docs/SimulcastTargetResponse.md +8 -0
  32. data/docs/Track.md +5 -2
  33. data/docs/VideoViewResponse.md +1 -1
  34. data/examples/data/exercise-errors.rb +1 -1
  35. data/examples/data/exercise-metrics.rb +0 -7
  36. data/examples/video/exercise-assets.rb +17 -1
  37. data/examples/video/exercise-delivery-usage.rb +23 -0
  38. data/examples/video/exercise-live-streams.rb +28 -1
  39. data/lib/mux_ruby/api/assets_api.rb +113 -0
  40. data/lib/mux_ruby/api/delivery_usage_api.rb +75 -0
  41. data/lib/mux_ruby/api/live_streams_api.rb +176 -0
  42. data/lib/mux_ruby/api_client.rb +1 -1
  43. data/lib/mux_ruby/models/asset.rb +12 -1
  44. data/lib/mux_ruby/models/create_asset_request.rb +37 -4
  45. data/lib/mux_ruby/models/create_live_stream_request.rb +57 -4
  46. data/lib/mux_ruby/models/create_simulcast_target_request.rb +210 -0
  47. data/lib/mux_ruby/models/create_track_request.rb +304 -0
  48. data/lib/mux_ruby/models/create_track_response.rb +184 -0
  49. data/lib/mux_ruby/models/delivery_report.rb +238 -0
  50. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +1 -1
  51. data/lib/mux_ruby/models/get_overall_values_response.rb +1 -1
  52. data/lib/mux_ruby/models/input_settings.rb +104 -13
  53. data/lib/mux_ruby/models/input_track.rb +4 -22
  54. data/lib/mux_ruby/models/insight.rb +2 -2
  55. data/lib/mux_ruby/models/list_all_metric_values_response.rb +1 -1
  56. data/lib/mux_ruby/models/list_breakdown_values_response.rb +1 -1
  57. data/lib/mux_ruby/models/list_delivery_usage_response.rb +216 -0
  58. data/lib/mux_ruby/models/list_errors_response.rb +1 -1
  59. data/lib/mux_ruby/models/list_exports_response.rb +1 -1
  60. data/lib/mux_ruby/models/list_filter_values_response.rb +1 -1
  61. data/lib/mux_ruby/models/list_filters_response.rb +1 -1
  62. data/lib/mux_ruby/models/list_insights_response.rb +1 -1
  63. data/lib/mux_ruby/models/list_video_views_response.rb +1 -1
  64. data/lib/mux_ruby/models/live_stream.rb +24 -4
  65. data/lib/mux_ruby/models/simulcast_target.rb +259 -0
  66. data/lib/mux_ruby/models/simulcast_target_response.rb +184 -0
  67. data/lib/mux_ruby/models/track.rb +86 -13
  68. data/lib/mux_ruby/models/video_view_response.rb +1 -1
  69. data/lib/mux_ruby/version.rb +1 -1
  70. data/lib/mux_ruby.rb +8 -0
  71. data/spec/api/assets_api_spec.rb +24 -0
  72. data/spec/api/delivery_usage_api_spec.rb +43 -0
  73. data/spec/api/live_streams_api_spec.rb +39 -0
  74. data/spec/models/asset_spec.rb +6 -0
  75. data/spec/models/create_asset_request_spec.rb +16 -0
  76. data/spec/models/create_live_stream_request_spec.rb +18 -0
  77. data/spec/models/create_simulcast_target_request_spec.rb +46 -0
  78. data/spec/models/create_track_request_spec.rb +78 -0
  79. data/spec/models/create_track_response_spec.rb +34 -0
  80. data/spec/models/delivery_report_spec.rb +70 -0
  81. data/spec/models/input_settings_spec.rb +40 -2
  82. data/spec/models/input_track_spec.rb +0 -12
  83. data/spec/models/list_delivery_usage_response_spec.rb +52 -0
  84. data/spec/models/live_stream_spec.rb +12 -0
  85. data/spec/models/simulcast_target_response_spec.rb +34 -0
  86. data/spec/models/simulcast_target_spec.rb +62 -0
  87. data/spec/models/track_spec.rb +28 -2
  88. metadata +36 -3
@@ -0,0 +1,238 @@
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 'date'
7
+
8
+ module MuxRuby
9
+ class DeliveryReport
10
+ attr_accessor :live_stream_id
11
+
12
+ attr_accessor :asset_id
13
+
14
+ attr_accessor :passthrough
15
+
16
+ attr_accessor :created_at
17
+
18
+ attr_accessor :asset_state
19
+
20
+ attr_accessor :asset_duration
21
+
22
+ attr_accessor :delivered_seconds
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'live_stream_id' => :'live_stream_id',
28
+ :'asset_id' => :'asset_id',
29
+ :'passthrough' => :'passthrough',
30
+ :'created_at' => :'created_at',
31
+ :'asset_state' => :'asset_state',
32
+ :'asset_duration' => :'asset_duration',
33
+ :'delivered_seconds' => :'delivered_seconds'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'live_stream_id' => :'String',
41
+ :'asset_id' => :'String',
42
+ :'passthrough' => :'String',
43
+ :'created_at' => :'String',
44
+ :'asset_state' => :'String',
45
+ :'asset_duration' => :'Float',
46
+ :'delivered_seconds' => :'Float'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'live_stream_id')
59
+ self.live_stream_id = attributes[:'live_stream_id']
60
+ end
61
+
62
+ if attributes.has_key?(:'asset_id')
63
+ self.asset_id = attributes[:'asset_id']
64
+ end
65
+
66
+ if attributes.has_key?(:'passthrough')
67
+ self.passthrough = attributes[:'passthrough']
68
+ end
69
+
70
+ if attributes.has_key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.has_key?(:'asset_state')
75
+ self.asset_state = attributes[:'asset_state']
76
+ end
77
+
78
+ if attributes.has_key?(:'asset_duration')
79
+ self.asset_duration = attributes[:'asset_duration']
80
+ end
81
+
82
+ if attributes.has_key?(:'delivered_seconds')
83
+ self.delivered_seconds = attributes[:'delivered_seconds']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ live_stream_id == o.live_stream_id &&
106
+ asset_id == o.asset_id &&
107
+ passthrough == o.passthrough &&
108
+ created_at == o.created_at &&
109
+ asset_state == o.asset_state &&
110
+ asset_duration == o.asset_duration &&
111
+ delivered_seconds == o.delivered_seconds
112
+ end
113
+
114
+ # @see the `==` method
115
+ # @param [Object] Object to be compared
116
+ def eql?(o)
117
+ self == o
118
+ end
119
+
120
+ # Calculates hash code according to all attributes.
121
+ # @return [Fixnum] Hash code
122
+ def hash
123
+ [live_stream_id, asset_id, passthrough, created_at, asset_state, asset_duration, delivered_seconds].hash
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def self.build_from_hash(attributes)
130
+ new.build_from_hash(attributes)
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ self.class.openapi_types.each_pair do |key, type|
139
+ if type =~ /\AArray<(.*)>/i
140
+ # check to ensure the input is an array given that the attribute
141
+ # is documented as an array but the input is not
142
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
143
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
144
+ end
145
+ elsif !attributes[self.class.attribute_map[key]].nil?
146
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
147
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
148
+ end
149
+
150
+ self
151
+ end
152
+
153
+ # Deserializes the data based on type
154
+ # @param string type Data type
155
+ # @param string value Value to be deserialized
156
+ # @return [Object] Deserialized data
157
+ def _deserialize(type, value)
158
+ case type.to_sym
159
+ when :DateTime
160
+ DateTime.parse(value)
161
+ when :Date
162
+ Date.parse(value)
163
+ when :String
164
+ value.to_s
165
+ when :Integer
166
+ value.to_i
167
+ when :Float
168
+ value.to_f
169
+ when :BOOLEAN
170
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
171
+ true
172
+ else
173
+ false
174
+ end
175
+ when :Object
176
+ # generic object (usually a Hash), return directly
177
+ value
178
+ when /\AArray<(?<inner_type>.+)>\z/
179
+ inner_type = Regexp.last_match[:inner_type]
180
+ value.map { |v| _deserialize(inner_type, v) }
181
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
182
+ k_type = Regexp.last_match[:k_type]
183
+ v_type = Regexp.last_match[:v_type]
184
+ {}.tap do |hash|
185
+ value.each do |k, v|
186
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
187
+ end
188
+ end
189
+ else # model
190
+ MuxRuby.const_get(type).build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ next if value.nil?
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'Array<Array<String>>',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33
 
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'OverallValues',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33
 
@@ -10,16 +10,53 @@ module MuxRuby
10
10
  class InputSettings
11
11
  attr_accessor :url
12
12
 
13
- attr_accessor :language
14
-
15
13
  attr_accessor :overlay_settings
16
14
 
15
+ attr_accessor :type
16
+
17
+ attr_accessor :text_type
18
+
19
+ attr_accessor :language_code
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :closed_captions
24
+
25
+ attr_accessor :passthrough
26
+
27
+ class EnumAttributeValidator
28
+ attr_reader :datatype
29
+ attr_reader :allowable_values
30
+
31
+ def initialize(datatype, allowable_values)
32
+ @allowable_values = allowable_values.map do |value|
33
+ case datatype.to_s
34
+ when /Integer/i
35
+ value.to_i
36
+ when /Float/i
37
+ value.to_f
38
+ else
39
+ value
40
+ end
41
+ end
42
+ end
43
+
44
+ def valid?(value)
45
+ !value || allowable_values.include?(value)
46
+ end
47
+ end
48
+
17
49
  # Attribute mapping from ruby-style variable name to JSON key.
18
50
  def self.attribute_map
19
51
  {
20
52
  :'url' => :'url',
21
- :'language' => :'language',
22
- :'overlay_settings' => :'overlay_settings'
53
+ :'overlay_settings' => :'overlay_settings',
54
+ :'type' => :'type',
55
+ :'text_type' => :'text_type',
56
+ :'language_code' => :'language_code',
57
+ :'name' => :'name',
58
+ :'closed_captions' => :'closed_captions',
59
+ :'passthrough' => :'passthrough'
23
60
  }
24
61
  end
25
62
 
@@ -27,8 +64,13 @@ module MuxRuby
27
64
  def self.openapi_types
28
65
  {
29
66
  :'url' => :'String',
30
- :'language' => :'String',
31
- :'overlay_settings' => :'InputSettingsOverlaySettings'
67
+ :'overlay_settings' => :'InputSettingsOverlaySettings',
68
+ :'type' => :'String',
69
+ :'text_type' => :'String',
70
+ :'language_code' => :'String',
71
+ :'name' => :'String',
72
+ :'closed_captions' => :'BOOLEAN',
73
+ :'passthrough' => :'String'
32
74
  }
33
75
  end
34
76
 
@@ -44,13 +86,33 @@ module MuxRuby
44
86
  self.url = attributes[:'url']
45
87
  end
46
88
 
47
- if attributes.has_key?(:'language')
48
- self.language = attributes[:'language']
49
- end
50
-
51
89
  if attributes.has_key?(:'overlay_settings')
52
90
  self.overlay_settings = attributes[:'overlay_settings']
53
91
  end
92
+
93
+ if attributes.has_key?(:'type')
94
+ self.type = attributes[:'type']
95
+ end
96
+
97
+ if attributes.has_key?(:'text_type')
98
+ self.text_type = attributes[:'text_type']
99
+ end
100
+
101
+ if attributes.has_key?(:'language_code')
102
+ self.language_code = attributes[:'language_code']
103
+ end
104
+
105
+ if attributes.has_key?(:'name')
106
+ self.name = attributes[:'name']
107
+ end
108
+
109
+ if attributes.has_key?(:'closed_captions')
110
+ self.closed_captions = attributes[:'closed_captions']
111
+ end
112
+
113
+ if attributes.has_key?(:'passthrough')
114
+ self.passthrough = attributes[:'passthrough']
115
+ end
54
116
  end
55
117
 
56
118
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -63,17 +125,46 @@ module MuxRuby
63
125
  # Check to see if the all the properties in the model are valid
64
126
  # @return true if the model is valid
65
127
  def valid?
128
+ type_validator = EnumAttributeValidator.new('String', ['video', 'audio', 'text'])
129
+ return false unless type_validator.valid?(@type)
130
+ text_type_validator = EnumAttributeValidator.new('String', ['subtitles'])
131
+ return false unless text_type_validator.valid?(@text_type)
66
132
  true
67
133
  end
68
134
 
135
+ # Custom attribute writer method checking allowed values (enum).
136
+ # @param [Object] type Object to be assigned
137
+ def type=(type)
138
+ validator = EnumAttributeValidator.new('String', ['video', 'audio', 'text'])
139
+ unless validator.valid?(type)
140
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
141
+ end
142
+ @type = type
143
+ end
144
+
145
+ # Custom attribute writer method checking allowed values (enum).
146
+ # @param [Object] text_type Object to be assigned
147
+ def text_type=(text_type)
148
+ validator = EnumAttributeValidator.new('String', ['subtitles'])
149
+ unless validator.valid?(text_type)
150
+ fail ArgumentError, 'invalid value for "text_type", must be one of #{validator.allowable_values}.'
151
+ end
152
+ @text_type = text_type
153
+ end
154
+
69
155
  # Checks equality by comparing each attribute.
70
156
  # @param [Object] Object to be compared
71
157
  def ==(o)
72
158
  return true if self.equal?(o)
73
159
  self.class == o.class &&
74
160
  url == o.url &&
75
- language == o.language &&
76
- overlay_settings == o.overlay_settings
161
+ overlay_settings == o.overlay_settings &&
162
+ type == o.type &&
163
+ text_type == o.text_type &&
164
+ language_code == o.language_code &&
165
+ name == o.name &&
166
+ closed_captions == o.closed_captions &&
167
+ passthrough == o.passthrough
77
168
  end
78
169
 
79
170
  # @see the `==` method
@@ -85,7 +176,7 @@ module MuxRuby
85
176
  # Calculates hash code according to all attributes.
86
177
  # @return [Fixnum] Hash code
87
178
  def hash
88
- [url, language, overlay_settings].hash
179
+ [url, overlay_settings, type, text_type, language_code, name, closed_captions, passthrough].hash
89
180
  end
90
181
 
91
182
  # Builds the object from hash
@@ -25,10 +25,6 @@ module MuxRuby
25
25
 
26
26
  attr_accessor :channels
27
27
 
28
- attr_accessor :text_track_type
29
-
30
- attr_accessor :language
31
-
32
28
  # Attribute mapping from ruby-style variable name to JSON key.
33
29
  def self.attribute_map
34
30
  {
@@ -40,9 +36,7 @@ module MuxRuby
40
36
  :'frame_rate' => :'frame_rate',
41
37
  :'sample_rate' => :'sample_rate',
42
38
  :'sample_size' => :'sample_size',
43
- :'channels' => :'channels',
44
- :'text_track_type' => :'text_track_type',
45
- :'language' => :'language'
39
+ :'channels' => :'channels'
46
40
  }
47
41
  end
48
42
 
@@ -57,9 +51,7 @@ module MuxRuby
57
51
  :'frame_rate' => :'Float',
58
52
  :'sample_rate' => :'Integer',
59
53
  :'sample_size' => :'Integer',
60
- :'channels' => :'Integer',
61
- :'text_track_type' => :'String',
62
- :'language' => :'String'
54
+ :'channels' => :'Integer'
63
55
  }
64
56
  end
65
57
 
@@ -106,14 +98,6 @@ module MuxRuby
106
98
  if attributes.has_key?(:'channels')
107
99
  self.channels = attributes[:'channels']
108
100
  end
109
-
110
- if attributes.has_key?(:'text_track_type')
111
- self.text_track_type = attributes[:'text_track_type']
112
- end
113
-
114
- if attributes.has_key?(:'language')
115
- self.language = attributes[:'language']
116
- end
117
101
  end
118
102
 
119
103
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -142,9 +126,7 @@ module MuxRuby
142
126
  frame_rate == o.frame_rate &&
143
127
  sample_rate == o.sample_rate &&
144
128
  sample_size == o.sample_size &&
145
- channels == o.channels &&
146
- text_track_type == o.text_track_type &&
147
- language == o.language
129
+ channels == o.channels
148
130
  end
149
131
 
150
132
  # @see the `==` method
@@ -156,7 +138,7 @@ module MuxRuby
156
138
  # Calculates hash code according to all attributes.
157
139
  # @return [Fixnum] Hash code
158
140
  def hash
159
- [type, duration, encoding, width, height, frame_rate, sample_rate, sample_size, channels, text_track_type, language].hash
141
+ [type, duration, encoding, width, height, frame_rate, sample_rate, sample_size, channels].hash
160
142
  end
161
143
 
162
144
  # Builds the object from hash
@@ -36,8 +36,8 @@ module MuxRuby
36
36
  {
37
37
  :'total_watch_time' => :'Integer',
38
38
  :'total_views' => :'Integer',
39
- :'negative_impact_score' => :'Integer',
40
- :'metric' => :'Integer',
39
+ :'negative_impact_score' => :'Float',
40
+ :'metric' => :'Float',
41
41
  :'filter_value' => :'String',
42
42
  :'filter_column' => :'String'
43
43
  }
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'Array<Score>',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33
 
@@ -27,7 +27,7 @@ module MuxRuby
27
27
  {
28
28
  :'data' => :'Array<BreakdownValue>',
29
29
  :'total_row_count' => :'Integer',
30
- :'timeframe' => :'Array<String>'
30
+ :'timeframe' => :'Array<Integer>'
31
31
  }
32
32
  end
33
33