mux_ruby 1.3.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +37 -35
  4. data/README.md +6 -1
  5. data/docs/Asset.md +3 -1
  6. data/docs/AssetNonStandardInputReasons.md +16 -0
  7. data/docs/AssetRecordingTimes.md +9 -0
  8. data/docs/AssetsApi.md +54 -0
  9. data/docs/CreateAssetRequest.md +1 -1
  10. data/docs/CreateLiveStreamRequest.md +2 -0
  11. data/docs/CreateUploadRequest.md +1 -0
  12. data/docs/DisableLiveStreamResponse.md +8 -0
  13. data/docs/EnableLiveStreamResponse.md +8 -0
  14. data/docs/LiveStream.md +2 -1
  15. data/docs/LiveStreamsApi.md +104 -0
  16. data/docs/UpdateAssetMasterAccessRequest.md +8 -0
  17. data/docs/Upload.md +1 -0
  18. data/docs/VideoView.md +16 -14
  19. data/examples/data/exercise-errors.rb +1 -1
  20. data/examples/video/exercise-assets.rb +10 -0
  21. data/examples/video/exercise-live-streams.rb +22 -0
  22. data/lib/mux_ruby.rb +5 -0
  23. data/lib/mux_ruby/api/assets_api.rb +61 -0
  24. data/lib/mux_ruby/api/live_streams_api.rb +106 -0
  25. data/lib/mux_ruby/api_client.rb +1 -1
  26. data/lib/mux_ruby/configuration.rb +1 -4
  27. data/lib/mux_ruby/models/asset.rb +34 -13
  28. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +335 -0
  29. data/lib/mux_ruby/models/asset_recording_times.rb +195 -0
  30. data/lib/mux_ruby/models/asset_static_renditions_files.rb +4 -4
  31. data/lib/mux_ruby/models/create_asset_request.rb +13 -13
  32. data/lib/mux_ruby/models/create_live_stream_request.rb +24 -4
  33. data/lib/mux_ruby/models/create_upload_request.rb +13 -4
  34. data/lib/mux_ruby/models/disable_live_stream_response.rb +184 -0
  35. data/lib/mux_ruby/models/enable_live_stream_response.rb +184 -0
  36. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +46 -0
  37. data/lib/mux_ruby/models/live_stream.rb +14 -5
  38. data/lib/mux_ruby/models/update_asset_master_access_request.rb +219 -0
  39. data/lib/mux_ruby/models/upload.rb +13 -4
  40. data/lib/mux_ruby/models/video_view.rb +36 -18
  41. data/lib/mux_ruby/version.rb +1 -1
  42. data/spec/api/assets_api_spec.rb +13 -0
  43. data/spec/api/live_streams_api_spec.rb +24 -0
  44. data/spec/models/asset_non_standard_input_reasons_spec.rb +98 -0
  45. data/spec/models/asset_recording_times_spec.rb +40 -0
  46. data/spec/models/asset_spec.rb +18 -6
  47. data/spec/models/asset_static_renditions_files_spec.rb +2 -2
  48. data/spec/models/create_asset_request_spec.rb +6 -6
  49. data/spec/models/create_live_stream_request_spec.rb +12 -0
  50. data/spec/models/create_upload_request_spec.rb +6 -0
  51. data/spec/models/disable_live_stream_response_spec.rb +34 -0
  52. data/spec/models/enable_live_stream_response_spec.rb +34 -0
  53. data/spec/models/input_settings_overlay_settings_spec.rb +8 -0
  54. data/spec/models/live_stream_spec.rb +6 -0
  55. data/spec/models/update_asset_master_access_request_spec.rb +38 -0
  56. data/spec/models/upload_spec.rb +6 -0
  57. data/spec/models/video_view_spec.rb +12 -0
  58. data/test.sh +28 -0
  59. metadata +80 -60
@@ -0,0 +1,335 @@
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 AssetNonStandardInputReasons
10
+ # The video codec used on the input file
11
+ attr_accessor :video_codec
12
+
13
+ # The audio codec used on the input file
14
+ attr_accessor :audio_codec
15
+
16
+ # The video key frame Interval (also called as Group of Picture or GOP) of the input file
17
+ attr_accessor :video_gop_size
18
+
19
+ # The video frame rate of the input file
20
+ attr_accessor :video_frame_rate
21
+
22
+ # The video resolution of the input file
23
+ attr_accessor :video_resolution
24
+
25
+ # The video pixel aspect ratio of the input file
26
+ attr_accessor :pixel_aspect_ratio
27
+
28
+ # Video Edit List reason indicates that the input file's video track contains a complex Edit Decision List
29
+ attr_accessor :video_edit_list
30
+
31
+ # Audio Edit List reason indicates that the input file's audio track contains a complex Edit Decision List
32
+ attr_accessor :audio_edit_list
33
+
34
+ # A catch-all reason when the input file in created with non-standard encoding parameters
35
+ attr_accessor :unexpected_media_file_parameters
36
+
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
59
+ # Attribute mapping from ruby-style variable name to JSON key.
60
+ def self.attribute_map
61
+ {
62
+ :'video_codec' => :'video_codec',
63
+ :'audio_codec' => :'audio_codec',
64
+ :'video_gop_size' => :'video_gop_size',
65
+ :'video_frame_rate' => :'video_frame_rate',
66
+ :'video_resolution' => :'video_resolution',
67
+ :'pixel_aspect_ratio' => :'pixel_aspect_ratio',
68
+ :'video_edit_list' => :'video_edit_list',
69
+ :'audio_edit_list' => :'audio_edit_list',
70
+ :'unexpected_media_file_parameters' => :'unexpected_media_file_parameters'
71
+ }
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'video_codec' => :'String',
78
+ :'audio_codec' => :'String',
79
+ :'video_gop_size' => :'String',
80
+ :'video_frame_rate' => :'String',
81
+ :'video_resolution' => :'String',
82
+ :'pixel_aspect_ratio' => :'String',
83
+ :'video_edit_list' => :'String',
84
+ :'audio_edit_list' => :'String',
85
+ :'unexpected_media_file_parameters' => :'String'
86
+ }
87
+ end
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ def initialize(attributes = {})
92
+ return unless attributes.is_a?(Hash)
93
+
94
+ # convert string to symbol for hash key
95
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
+
97
+ if attributes.has_key?(:'video_codec')
98
+ self.video_codec = attributes[:'video_codec']
99
+ end
100
+
101
+ if attributes.has_key?(:'audio_codec')
102
+ self.audio_codec = attributes[:'audio_codec']
103
+ end
104
+
105
+ if attributes.has_key?(:'video_gop_size')
106
+ self.video_gop_size = attributes[:'video_gop_size']
107
+ end
108
+
109
+ if attributes.has_key?(:'video_frame_rate')
110
+ self.video_frame_rate = attributes[:'video_frame_rate']
111
+ end
112
+
113
+ if attributes.has_key?(:'video_resolution')
114
+ self.video_resolution = attributes[:'video_resolution']
115
+ end
116
+
117
+ if attributes.has_key?(:'pixel_aspect_ratio')
118
+ self.pixel_aspect_ratio = attributes[:'pixel_aspect_ratio']
119
+ end
120
+
121
+ if attributes.has_key?(:'video_edit_list')
122
+ self.video_edit_list = attributes[:'video_edit_list']
123
+ end
124
+
125
+ if attributes.has_key?(:'audio_edit_list')
126
+ self.audio_edit_list = attributes[:'audio_edit_list']
127
+ end
128
+
129
+ if attributes.has_key?(:'unexpected_media_file_parameters')
130
+ self.unexpected_media_file_parameters = attributes[:'unexpected_media_file_parameters']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ video_gop_size_validator = EnumAttributeValidator.new('String', ['high'])
145
+ return false unless video_gop_size_validator.valid?(@video_gop_size)
146
+ video_edit_list_validator = EnumAttributeValidator.new('String', ['non-standard'])
147
+ return false unless video_edit_list_validator.valid?(@video_edit_list)
148
+ audio_edit_list_validator = EnumAttributeValidator.new('String', ['non-standard'])
149
+ return false unless audio_edit_list_validator.valid?(@audio_edit_list)
150
+ unexpected_media_file_parameters_validator = EnumAttributeValidator.new('String', ['non-standard'])
151
+ return false unless unexpected_media_file_parameters_validator.valid?(@unexpected_media_file_parameters)
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method checking allowed values (enum).
156
+ # @param [Object] video_gop_size Object to be assigned
157
+ def video_gop_size=(video_gop_size)
158
+ validator = EnumAttributeValidator.new('String', ['high'])
159
+ unless validator.valid?(video_gop_size)
160
+ fail ArgumentError, 'invalid value for "video_gop_size", must be one of #{validator.allowable_values}.'
161
+ end
162
+ @video_gop_size = video_gop_size
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] video_edit_list Object to be assigned
167
+ def video_edit_list=(video_edit_list)
168
+ validator = EnumAttributeValidator.new('String', ['non-standard'])
169
+ unless validator.valid?(video_edit_list)
170
+ fail ArgumentError, 'invalid value for "video_edit_list", must be one of #{validator.allowable_values}.'
171
+ end
172
+ @video_edit_list = video_edit_list
173
+ end
174
+
175
+ # Custom attribute writer method checking allowed values (enum).
176
+ # @param [Object] audio_edit_list Object to be assigned
177
+ def audio_edit_list=(audio_edit_list)
178
+ validator = EnumAttributeValidator.new('String', ['non-standard'])
179
+ unless validator.valid?(audio_edit_list)
180
+ fail ArgumentError, 'invalid value for "audio_edit_list", must be one of #{validator.allowable_values}.'
181
+ end
182
+ @audio_edit_list = audio_edit_list
183
+ end
184
+
185
+ # Custom attribute writer method checking allowed values (enum).
186
+ # @param [Object] unexpected_media_file_parameters Object to be assigned
187
+ def unexpected_media_file_parameters=(unexpected_media_file_parameters)
188
+ validator = EnumAttributeValidator.new('String', ['non-standard'])
189
+ unless validator.valid?(unexpected_media_file_parameters)
190
+ fail ArgumentError, 'invalid value for "unexpected_media_file_parameters", must be one of #{validator.allowable_values}.'
191
+ end
192
+ @unexpected_media_file_parameters = unexpected_media_file_parameters
193
+ end
194
+
195
+ # Checks equality by comparing each attribute.
196
+ # @param [Object] Object to be compared
197
+ def ==(o)
198
+ return true if self.equal?(o)
199
+ self.class == o.class &&
200
+ video_codec == o.video_codec &&
201
+ audio_codec == o.audio_codec &&
202
+ video_gop_size == o.video_gop_size &&
203
+ video_frame_rate == o.video_frame_rate &&
204
+ video_resolution == o.video_resolution &&
205
+ pixel_aspect_ratio == o.pixel_aspect_ratio &&
206
+ video_edit_list == o.video_edit_list &&
207
+ audio_edit_list == o.audio_edit_list &&
208
+ unexpected_media_file_parameters == o.unexpected_media_file_parameters
209
+ end
210
+
211
+ # @see the `==` method
212
+ # @param [Object] Object to be compared
213
+ def eql?(o)
214
+ self == o
215
+ end
216
+
217
+ # Calculates hash code according to all attributes.
218
+ # @return [Fixnum] Hash code
219
+ def hash
220
+ [video_codec, audio_codec, video_gop_size, video_frame_rate, video_resolution, pixel_aspect_ratio, video_edit_list, audio_edit_list, unexpected_media_file_parameters].hash
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def self.build_from_hash(attributes)
227
+ new.build_from_hash(attributes)
228
+ end
229
+
230
+ # Builds the object from hash
231
+ # @param [Hash] attributes Model attributes in the form of hash
232
+ # @return [Object] Returns the model itself
233
+ def build_from_hash(attributes)
234
+ return nil unless attributes.is_a?(Hash)
235
+ self.class.openapi_types.each_pair do |key, type|
236
+ if type =~ /\AArray<(.*)>/i
237
+ # check to ensure the input is an array given that the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
240
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
241
+ end
242
+ elsif !attributes[self.class.attribute_map[key]].nil?
243
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
244
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
245
+ end
246
+
247
+ self
248
+ end
249
+
250
+ # Deserializes the data based on type
251
+ # @param string type Data type
252
+ # @param string value Value to be deserialized
253
+ # @return [Object] Deserialized data
254
+ def _deserialize(type, value)
255
+ case type.to_sym
256
+ when :DateTime
257
+ DateTime.parse(value)
258
+ when :Date
259
+ Date.parse(value)
260
+ when :String
261
+ value.to_s
262
+ when :Integer
263
+ value.to_i
264
+ when :Float
265
+ value.to_f
266
+ when :BOOLEAN
267
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
268
+ true
269
+ else
270
+ false
271
+ end
272
+ when :Object
273
+ # generic object (usually a Hash), return directly
274
+ value
275
+ when /\AArray<(?<inner_type>.+)>\z/
276
+ inner_type = Regexp.last_match[:inner_type]
277
+ value.map { |v| _deserialize(inner_type, v) }
278
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
279
+ k_type = Regexp.last_match[:k_type]
280
+ v_type = Regexp.last_match[:v_type]
281
+ {}.tap do |hash|
282
+ value.each do |k, v|
283
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
284
+ end
285
+ end
286
+ else # model
287
+ MuxRuby.const_get(type).build_from_hash(value)
288
+ end
289
+ end
290
+
291
+ # Returns the string representation of the object
292
+ # @return [String] String presentation of the object
293
+ def to_s
294
+ to_hash.to_s
295
+ end
296
+
297
+ # to_body is an alias to to_hash (backward compatibility)
298
+ # @return [Hash] Returns the object in the form of hash
299
+ def to_body
300
+ to_hash
301
+ end
302
+
303
+ # Returns the object in the form of hash
304
+ # @return [Hash] Returns the object in the form of hash
305
+ def to_hash
306
+ hash = {}
307
+ self.class.attribute_map.each_pair do |attr, param|
308
+ value = self.send(attr)
309
+ next if value.nil?
310
+ hash[param] = _to_hash(value)
311
+ end
312
+ hash
313
+ end
314
+
315
+ # Outputs non-array value in the form of hash
316
+ # For object, use to_hash. Otherwise, just return the value
317
+ # @param [Object] value Any valid value
318
+ # @return [Hash] Returns the value in the form of hash
319
+ def _to_hash(value)
320
+ if value.is_a?(Array)
321
+ value.compact.map { |v| _to_hash(v) }
322
+ elsif value.is_a?(Hash)
323
+ {}.tap do |hash|
324
+ value.each { |k, v| hash[k] = _to_hash(v) }
325
+ end
326
+ elsif value.respond_to? :to_hash
327
+ value.to_hash
328
+ else
329
+ value
330
+ end
331
+ end
332
+
333
+ end
334
+
335
+ end
@@ -0,0 +1,195 @@
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 AssetRecordingTimes
10
+ # The time at which the recording for the live stream started. The time value is Unix epoch time represented in ISO 8601 format
11
+ attr_accessor :started_at
12
+
13
+ # The duration of the live stream recorded. The time value is in seconds
14
+ attr_accessor :duration
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'started_at' => :'started_at',
20
+ :'duration' => :'duration'
21
+ }
22
+ end
23
+
24
+ # Attribute type mapping.
25
+ def self.openapi_types
26
+ {
27
+ :'started_at' => :'DateTime',
28
+ :'duration' => :'Float'
29
+ }
30
+ end
31
+
32
+ # Initializes the object
33
+ # @param [Hash] attributes Model attributes in the form of hash
34
+ def initialize(attributes = {})
35
+ return unless attributes.is_a?(Hash)
36
+
37
+ # convert string to symbol for hash key
38
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
39
+
40
+ if attributes.has_key?(:'started_at')
41
+ self.started_at = attributes[:'started_at']
42
+ end
43
+
44
+ if attributes.has_key?(:'duration')
45
+ self.duration = attributes[:'duration']
46
+ end
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ started_at == o.started_at &&
68
+ duration == o.duration
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [started_at, duration].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def self.build_from_hash(attributes)
87
+ new.build_from_hash(attributes)
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.openapi_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ MuxRuby.const_get(type).build_from_hash(value)
148
+ end
149
+ end
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # to_body is an alias to to_hash (backward compatibility)
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ next if value.nil?
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ # Outputs non-array value in the form of hash
176
+ # For object, use to_hash. Otherwise, just return the value
177
+ # @param [Object] value Any valid value
178
+ # @return [Hash] Returns the value in the form of hash
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map { |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ end
194
+
195
+ end