mux_ruby 1.0.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +37 -35
  4. data/README.md +5 -0
  5. data/docs/Asset.md +2 -1
  6. data/docs/AssetsApi.md +157 -0
  7. data/docs/CreateAssetRequest.md +3 -1
  8. data/docs/CreateLiveStreamRequest.md +4 -0
  9. data/docs/CreateSimulcastTargetRequest.md +10 -0
  10. data/docs/CreateTrackRequest.md +14 -0
  11. data/docs/CreateTrackResponse.md +8 -0
  12. data/docs/CreateUploadRequest.md +1 -0
  13. data/docs/DeliveryReport.md +14 -0
  14. data/docs/DeliveryUsageApi.md +68 -0
  15. data/docs/GetMetricTimeseriesDataResponse.md +1 -1
  16. data/docs/GetOverallValuesResponse.md +1 -1
  17. data/docs/InputSettings.md +6 -1
  18. data/docs/InputTrack.md +0 -2
  19. data/docs/Insight.md +2 -2
  20. data/docs/ListAllMetricValuesResponse.md +1 -1
  21. data/docs/ListBreakdownValuesResponse.md +1 -1
  22. data/docs/ListDeliveryUsageResponse.md +11 -0
  23. data/docs/ListErrorsResponse.md +1 -1
  24. data/docs/ListExportsResponse.md +1 -1
  25. data/docs/ListFilterValuesResponse.md +1 -1
  26. data/docs/ListFiltersResponse.md +1 -1
  27. data/docs/ListInsightsResponse.md +1 -1
  28. data/docs/ListVideoViewsResponse.md +1 -1
  29. data/docs/LiveStream.md +3 -0
  30. data/docs/LiveStreamsApi.md +161 -0
  31. data/docs/SigningKeyResponse.md +1 -1
  32. data/docs/SimulcastTarget.md +12 -0
  33. data/docs/SimulcastTargetResponse.md +8 -0
  34. data/docs/Track.md +5 -2
  35. data/docs/UpdateAssetMasterAccessRequest.md +8 -0
  36. data/docs/Upload.md +1 -0
  37. data/docs/VideoViewResponse.md +1 -1
  38. data/examples/data/exercise-errors.rb +1 -1
  39. data/examples/data/exercise-metrics.rb +0 -7
  40. data/examples/video/exercise-assets.rb +27 -1
  41. data/examples/video/exercise-delivery-usage.rb +23 -0
  42. data/examples/video/exercise-live-streams.rb +28 -1
  43. data/lib/mux_ruby.rb +9 -0
  44. data/lib/mux_ruby/api/assets_api.rb +174 -0
  45. data/lib/mux_ruby/api/delivery_usage_api.rb +75 -0
  46. data/lib/mux_ruby/api/live_streams_api.rb +176 -0
  47. data/lib/mux_ruby/api_client.rb +7 -2
  48. data/lib/mux_ruby/api_error.rb +3 -0
  49. data/lib/mux_ruby/configuration.rb +1 -4
  50. data/lib/mux_ruby/models/asset.rb +24 -13
  51. data/lib/mux_ruby/models/create_asset_request.rb +46 -13
  52. data/lib/mux_ruby/models/create_live_stream_request.rb +66 -4
  53. data/lib/mux_ruby/models/create_simulcast_target_request.rb +210 -0
  54. data/lib/mux_ruby/models/create_track_request.rb +304 -0
  55. data/lib/mux_ruby/models/create_track_response.rb +184 -0
  56. data/lib/mux_ruby/models/create_upload_request.rb +13 -4
  57. data/lib/mux_ruby/models/delivery_report.rb +238 -0
  58. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +1 -1
  59. data/lib/mux_ruby/models/get_overall_values_response.rb +1 -1
  60. data/lib/mux_ruby/models/input_settings.rb +104 -13
  61. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +46 -0
  62. data/lib/mux_ruby/models/input_track.rb +4 -22
  63. data/lib/mux_ruby/models/insight.rb +2 -2
  64. data/lib/mux_ruby/models/list_all_metric_values_response.rb +1 -1
  65. data/lib/mux_ruby/models/list_breakdown_values_response.rb +1 -1
  66. data/lib/mux_ruby/models/list_delivery_usage_response.rb +216 -0
  67. data/lib/mux_ruby/models/list_errors_response.rb +1 -1
  68. data/lib/mux_ruby/models/list_exports_response.rb +1 -1
  69. data/lib/mux_ruby/models/list_filter_values_response.rb +1 -1
  70. data/lib/mux_ruby/models/list_filters_response.rb +1 -1
  71. data/lib/mux_ruby/models/list_insights_response.rb +1 -1
  72. data/lib/mux_ruby/models/list_video_views_response.rb +1 -1
  73. data/lib/mux_ruby/models/live_stream.rb +33 -4
  74. data/lib/mux_ruby/models/simulcast_target.rb +259 -0
  75. data/lib/mux_ruby/models/simulcast_target_response.rb +184 -0
  76. data/lib/mux_ruby/models/track.rb +86 -13
  77. data/lib/mux_ruby/models/update_asset_master_access_request.rb +219 -0
  78. data/lib/mux_ruby/models/upload.rb +13 -4
  79. data/lib/mux_ruby/models/video_view_response.rb +1 -1
  80. data/lib/mux_ruby/version.rb +1 -1
  81. data/spec/api/assets_api_spec.rb +37 -0
  82. data/spec/api/delivery_usage_api_spec.rb +43 -0
  83. data/spec/api/live_streams_api_spec.rb +39 -0
  84. data/spec/models/asset_spec.rb +12 -6
  85. data/spec/models/create_asset_request_spec.rb +22 -6
  86. data/spec/models/create_live_stream_request_spec.rb +24 -0
  87. data/spec/models/create_simulcast_target_request_spec.rb +46 -0
  88. data/spec/models/create_track_request_spec.rb +78 -0
  89. data/spec/models/create_track_response_spec.rb +34 -0
  90. data/spec/models/create_upload_request_spec.rb +6 -0
  91. data/spec/models/delivery_report_spec.rb +70 -0
  92. data/spec/models/input_settings_overlay_settings_spec.rb +8 -0
  93. data/spec/models/input_settings_spec.rb +40 -2
  94. data/spec/models/input_track_spec.rb +0 -12
  95. data/spec/models/list_delivery_usage_response_spec.rb +52 -0
  96. data/spec/models/live_stream_spec.rb +18 -0
  97. data/spec/models/simulcast_target_response_spec.rb +34 -0
  98. data/spec/models/simulcast_target_spec.rb +62 -0
  99. data/spec/models/track_spec.rb +28 -2
  100. data/spec/models/update_asset_master_access_request_spec.rb +38 -0
  101. data/spec/models/upload_spec.rb +6 -0
  102. data/test.sh +28 -0
  103. metadata +91 -54
@@ -0,0 +1,304 @@
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 CreateTrackRequest
10
+ attr_accessor :url
11
+
12
+ attr_accessor :type
13
+
14
+ attr_accessor :text_type
15
+
16
+ attr_accessor :language_code
17
+
18
+ attr_accessor :name
19
+
20
+ attr_accessor :closed_captions
21
+
22
+ attr_accessor :passthrough
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'url' => :'url',
50
+ :'type' => :'type',
51
+ :'text_type' => :'text_type',
52
+ :'language_code' => :'language_code',
53
+ :'name' => :'name',
54
+ :'closed_captions' => :'closed_captions',
55
+ :'passthrough' => :'passthrough'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'url' => :'String',
63
+ :'type' => :'String',
64
+ :'text_type' => :'String',
65
+ :'language_code' => :'String',
66
+ :'name' => :'String',
67
+ :'closed_captions' => :'BOOLEAN',
68
+ :'passthrough' => :'String'
69
+ }
70
+ end
71
+
72
+ # Initializes the object
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ def initialize(attributes = {})
75
+ return unless attributes.is_a?(Hash)
76
+
77
+ # convert string to symbol for hash key
78
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
79
+
80
+ if attributes.has_key?(:'url')
81
+ self.url = attributes[:'url']
82
+ end
83
+
84
+ if attributes.has_key?(:'type')
85
+ self.type = attributes[:'type']
86
+ end
87
+
88
+ if attributes.has_key?(:'text_type')
89
+ self.text_type = attributes[:'text_type']
90
+ end
91
+
92
+ if attributes.has_key?(:'language_code')
93
+ self.language_code = attributes[:'language_code']
94
+ end
95
+
96
+ if attributes.has_key?(:'name')
97
+ self.name = attributes[:'name']
98
+ end
99
+
100
+ if attributes.has_key?(:'closed_captions')
101
+ self.closed_captions = attributes[:'closed_captions']
102
+ end
103
+
104
+ if attributes.has_key?(:'passthrough')
105
+ self.passthrough = attributes[:'passthrough']
106
+ end
107
+ end
108
+
109
+ # Show invalid properties with the reasons. Usually used together with valid?
110
+ # @return Array for valid properties with the reasons
111
+ def list_invalid_properties
112
+ invalid_properties = Array.new
113
+ if @url.nil?
114
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
115
+ end
116
+
117
+ if @type.nil?
118
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
119
+ end
120
+
121
+ if @text_type.nil?
122
+ invalid_properties.push('invalid value for "text_type", text_type cannot be nil.')
123
+ end
124
+
125
+ if @language_code.nil?
126
+ invalid_properties.push('invalid value for "language_code", language_code cannot be nil.')
127
+ end
128
+
129
+ invalid_properties
130
+ end
131
+
132
+ # Check to see if the all the properties in the model are valid
133
+ # @return true if the model is valid
134
+ def valid?
135
+ return false if @url.nil?
136
+ return false if @type.nil?
137
+ type_validator = EnumAttributeValidator.new('String', ['text'])
138
+ return false unless type_validator.valid?(@type)
139
+ return false if @text_type.nil?
140
+ text_type_validator = EnumAttributeValidator.new('String', ['subtitles'])
141
+ return false unless text_type_validator.valid?(@text_type)
142
+ return false if @language_code.nil?
143
+ true
144
+ end
145
+
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] type Object to be assigned
148
+ def type=(type)
149
+ validator = EnumAttributeValidator.new('String', ['text'])
150
+ unless validator.valid?(type)
151
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
152
+ end
153
+ @type = type
154
+ end
155
+
156
+ # Custom attribute writer method checking allowed values (enum).
157
+ # @param [Object] text_type Object to be assigned
158
+ def text_type=(text_type)
159
+ validator = EnumAttributeValidator.new('String', ['subtitles'])
160
+ unless validator.valid?(text_type)
161
+ fail ArgumentError, 'invalid value for "text_type", must be one of #{validator.allowable_values}.'
162
+ end
163
+ @text_type = text_type
164
+ end
165
+
166
+ # Checks equality by comparing each attribute.
167
+ # @param [Object] Object to be compared
168
+ def ==(o)
169
+ return true if self.equal?(o)
170
+ self.class == o.class &&
171
+ url == o.url &&
172
+ type == o.type &&
173
+ text_type == o.text_type &&
174
+ language_code == o.language_code &&
175
+ name == o.name &&
176
+ closed_captions == o.closed_captions &&
177
+ passthrough == o.passthrough
178
+ end
179
+
180
+ # @see the `==` method
181
+ # @param [Object] Object to be compared
182
+ def eql?(o)
183
+ self == o
184
+ end
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Fixnum] Hash code
188
+ def hash
189
+ [url, type, text_type, language_code, name, closed_captions, passthrough].hash
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def self.build_from_hash(attributes)
196
+ new.build_from_hash(attributes)
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ self.class.openapi_types.each_pair do |key, type|
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :BOOLEAN
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ MuxRuby.const_get(type).build_from_hash(value)
257
+ end
258
+ end
259
+
260
+ # Returns the string representation of the object
261
+ # @return [String] String presentation of the object
262
+ def to_s
263
+ to_hash.to_s
264
+ end
265
+
266
+ # to_body is an alias to to_hash (backward compatibility)
267
+ # @return [Hash] Returns the object in the form of hash
268
+ def to_body
269
+ to_hash
270
+ end
271
+
272
+ # Returns the object in the form of hash
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_hash
275
+ hash = {}
276
+ self.class.attribute_map.each_pair do |attr, param|
277
+ value = self.send(attr)
278
+ next if value.nil?
279
+ hash[param] = _to_hash(value)
280
+ end
281
+ hash
282
+ end
283
+
284
+ # Outputs non-array value in the form of hash
285
+ # For object, use to_hash. Otherwise, just return the value
286
+ # @param [Object] value Any valid value
287
+ # @return [Hash] Returns the value in the form of hash
288
+ def _to_hash(value)
289
+ if value.is_a?(Array)
290
+ value.compact.map { |v| _to_hash(v) }
291
+ elsif value.is_a?(Hash)
292
+ {}.tap do |hash|
293
+ value.each { |k, v| hash[k] = _to_hash(v) }
294
+ end
295
+ elsif value.respond_to? :to_hash
296
+ value.to_hash
297
+ else
298
+ value
299
+ end
300
+ end
301
+
302
+ end
303
+
304
+ end
@@ -0,0 +1,184 @@
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 CreateTrackResponse
10
+ attr_accessor :data
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :'data' => :'data'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'data' => :'Track'
23
+ }
24
+ end
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ return unless attributes.is_a?(Hash)
30
+
31
+ # convert string to symbol for hash key
32
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
33
+
34
+ if attributes.has_key?(:'data')
35
+ self.data = attributes[:'data']
36
+ end
37
+ end
38
+
39
+ # Show invalid properties with the reasons. Usually used together with valid?
40
+ # @return Array for valid properties with the reasons
41
+ def list_invalid_properties
42
+ invalid_properties = Array.new
43
+ invalid_properties
44
+ end
45
+
46
+ # Check to see if the all the properties in the model are valid
47
+ # @return true if the model is valid
48
+ def valid?
49
+ true
50
+ end
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] Object to be compared
54
+ def ==(o)
55
+ return true if self.equal?(o)
56
+ self.class == o.class &&
57
+ data == o.data
58
+ end
59
+
60
+ # @see the `==` method
61
+ # @param [Object] Object to be compared
62
+ def eql?(o)
63
+ self == o
64
+ end
65
+
66
+ # Calculates hash code according to all attributes.
67
+ # @return [Fixnum] Hash code
68
+ def hash
69
+ [data].hash
70
+ end
71
+
72
+ # Builds the object from hash
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ # @return [Object] Returns the model itself
75
+ def self.build_from_hash(attributes)
76
+ new.build_from_hash(attributes)
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ self.class.openapi_types.each_pair do |key, type|
85
+ if type =~ /\AArray<(.*)>/i
86
+ # check to ensure the input is an array given that the attribute
87
+ # is documented as an array but the input is not
88
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
89
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
90
+ end
91
+ elsif !attributes[self.class.attribute_map[key]].nil?
92
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
93
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ # Deserializes the data based on type
100
+ # @param string type Data type
101
+ # @param string value Value to be deserialized
102
+ # @return [Object] Deserialized data
103
+ def _deserialize(type, value)
104
+ case type.to_sym
105
+ when :DateTime
106
+ DateTime.parse(value)
107
+ when :Date
108
+ Date.parse(value)
109
+ when :String
110
+ value.to_s
111
+ when :Integer
112
+ value.to_i
113
+ when :Float
114
+ value.to_f
115
+ when :BOOLEAN
116
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
117
+ true
118
+ else
119
+ false
120
+ end
121
+ when :Object
122
+ # generic object (usually a Hash), return directly
123
+ value
124
+ when /\AArray<(?<inner_type>.+)>\z/
125
+ inner_type = Regexp.last_match[:inner_type]
126
+ value.map { |v| _deserialize(inner_type, v) }
127
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
128
+ k_type = Regexp.last_match[:k_type]
129
+ v_type = Regexp.last_match[:v_type]
130
+ {}.tap do |hash|
131
+ value.each do |k, v|
132
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
133
+ end
134
+ end
135
+ else # model
136
+ MuxRuby.const_get(type).build_from_hash(value)
137
+ end
138
+ end
139
+
140
+ # Returns the string representation of the object
141
+ # @return [String] String presentation of the object
142
+ def to_s
143
+ to_hash.to_s
144
+ end
145
+
146
+ # to_body is an alias to to_hash (backward compatibility)
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_body
149
+ to_hash
150
+ end
151
+
152
+ # Returns the object in the form of hash
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_hash
155
+ hash = {}
156
+ self.class.attribute_map.each_pair do |attr, param|
157
+ value = self.send(attr)
158
+ next if value.nil?
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ # Outputs non-array value in the form of hash
165
+ # For object, use to_hash. Otherwise, just return the value
166
+ # @param [Object] value Any valid value
167
+ # @return [Hash] Returns the value in the form of hash
168
+ def _to_hash(value)
169
+ if value.is_a?(Array)
170
+ value.compact.map { |v| _to_hash(v) }
171
+ elsif value.is_a?(Hash)
172
+ {}.tap do |hash|
173
+ value.each { |k, v| hash[k] = _to_hash(v) }
174
+ end
175
+ elsif value.respond_to? :to_hash
176
+ value.to_hash
177
+ else
178
+ value
179
+ end
180
+ end
181
+
182
+ end
183
+
184
+ end