mux_ruby 1.5.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +4 -1
  4. data/docs/Asset.md +15 -12
  5. data/docs/AssetErrors.md +2 -2
  6. data/docs/AssetNonStandardInputReasons.md +16 -0
  7. data/docs/AssetRecordingTimes.md +9 -0
  8. data/docs/AssetStaticRenditions.md +1 -1
  9. data/docs/AssetsApi.md +4 -0
  10. data/docs/CreateAssetRequest.md +6 -6
  11. data/docs/CreateLiveStreamRequest.md +1 -0
  12. data/docs/CreateTrackRequest.md +4 -4
  13. data/docs/DimensionValue.md +9 -0
  14. data/docs/DimensionsApi.md +118 -0
  15. data/docs/DisableLiveStreamResponse.md +8 -0
  16. data/docs/EnableLiveStreamResponse.md +8 -0
  17. data/docs/FiltersApi.md +2 -2
  18. data/docs/GetAssetOrLiveStreamIdResponse.md +8 -0
  19. data/docs/GetAssetOrLiveStreamIdResponseData.md +10 -0
  20. data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +9 -0
  21. data/docs/GetRealTimeBreakdownResponse.md +10 -0
  22. data/docs/GetRealTimeHistogramTimeseriesResponse.md +11 -0
  23. data/docs/GetRealTimeHistogramTimeseriesResponseMeta.md +8 -0
  24. data/docs/GetRealTimeTimeseriesResponse.md +10 -0
  25. data/docs/Incident.md +28 -0
  26. data/docs/IncidentBreakdown.md +10 -0
  27. data/docs/IncidentNotification.md +10 -0
  28. data/docs/IncidentNotificationRule.md +12 -0
  29. data/docs/IncidentResponse.md +9 -0
  30. data/docs/IncidentsApi.md +186 -0
  31. data/docs/InputSettings.md +9 -7
  32. data/docs/InputSettingsOverlaySettings.md +7 -7
  33. data/docs/ListDimensionValuesResponse.md +10 -0
  34. data/docs/ListDimensionsResponse.md +10 -0
  35. data/docs/ListIncidentsResponse.md +10 -0
  36. data/docs/ListRealTimeDimensionsResponse.md +10 -0
  37. data/docs/ListRealTimeDimensionsResponseData.md +9 -0
  38. data/docs/ListRealTimeMetricsResponse.md +10 -0
  39. data/docs/ListRelatedIncidentsResponse.md +10 -0
  40. data/docs/LiveStream.md +1 -1
  41. data/docs/LiveStreamsApi.md +104 -0
  42. data/docs/NotificationRule.md +10 -0
  43. data/docs/PlaybackID.md +1 -1
  44. data/docs/PlaybackIDApi.md +60 -0
  45. data/docs/RealTimeApi.md +280 -0
  46. data/docs/RealTimeBreakdownValue.md +12 -0
  47. data/docs/RealTimeHistogramTimeseriesBucket.md +9 -0
  48. data/docs/RealTimeHistogramTimeseriesBucketValues.md +9 -0
  49. data/docs/RealTimeHistogramTimeseriesDatapoint.md +14 -0
  50. data/docs/RealTimeTimeseriesDatapoint.md +10 -0
  51. data/docs/Track.md +13 -13
  52. data/docs/VideoView.md +16 -14
  53. data/examples/data/exercise-dimensions.rb +29 -0
  54. data/examples/data/exercise-incidents.rb +29 -0
  55. data/examples/data/exercise-realtime.rb +60 -0
  56. data/examples/video/exercise-assets.rb +21 -0
  57. data/examples/video/exercise-live-streams.rb +30 -0
  58. data/lib/mux_ruby.rb +34 -0
  59. data/lib/mux_ruby/api/assets_api.rb +4 -0
  60. data/lib/mux_ruby/api/dimensions_api.rb +128 -0
  61. data/lib/mux_ruby/api/filters_api.rb +4 -4
  62. data/lib/mux_ruby/api/incidents_api.rb +217 -0
  63. data/lib/mux_ruby/api/live_streams_api.rb +106 -0
  64. data/lib/mux_ruby/api/playback_id_api.rb +69 -0
  65. data/lib/mux_ruby/api/real_time_api.rb +311 -0
  66. data/lib/mux_ruby/api_client.rb +13 -13
  67. data/lib/mux_ruby/configuration.rb +1 -4
  68. data/lib/mux_ruby/models/asset.rb +70 -3
  69. data/lib/mux_ruby/models/asset_errors.rb +2 -0
  70. data/lib/mux_ruby/models/asset_master.rb +35 -0
  71. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +335 -0
  72. data/lib/mux_ruby/models/asset_recording_times.rb +195 -0
  73. data/lib/mux_ruby/models/asset_static_renditions.rb +2 -2
  74. data/lib/mux_ruby/models/asset_static_renditions_files.rb +6 -6
  75. data/lib/mux_ruby/models/create_asset_request.rb +8 -2
  76. data/lib/mux_ruby/models/create_live_stream_request.rb +15 -4
  77. data/lib/mux_ruby/models/create_track_request.rb +6 -2
  78. data/lib/mux_ruby/models/dimension_value.rb +193 -0
  79. data/lib/mux_ruby/models/disable_live_stream_response.rb +184 -0
  80. data/lib/mux_ruby/models/enable_live_stream_response.rb +184 -0
  81. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response.rb +184 -0
  82. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +203 -0
  83. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +230 -0
  84. data/lib/mux_ruby/models/get_real_time_breakdown_response.rb +206 -0
  85. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response.rb +215 -0
  86. data/lib/mux_ruby/models/get_real_time_histogram_timeseries_response_meta.rb +186 -0
  87. data/lib/mux_ruby/models/get_real_time_timeseries_response.rb +206 -0
  88. data/lib/mux_ruby/models/incident.rb +370 -0
  89. data/lib/mux_ruby/models/incident_breakdown.rb +202 -0
  90. data/lib/mux_ruby/models/incident_notification.rb +202 -0
  91. data/lib/mux_ruby/models/incident_notification_rule.rb +222 -0
  92. data/lib/mux_ruby/models/incident_response.rb +195 -0
  93. data/lib/mux_ruby/models/input_settings.rb +31 -4
  94. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +10 -2
  95. data/lib/mux_ruby/models/list_dimension_values_response.rb +206 -0
  96. data/lib/mux_ruby/models/list_dimensions_response.rb +204 -0
  97. data/lib/mux_ruby/models/list_incidents_response.rb +206 -0
  98. data/lib/mux_ruby/models/list_real_time_dimensions_response.rb +206 -0
  99. data/lib/mux_ruby/models/list_real_time_dimensions_response_data.rb +193 -0
  100. data/lib/mux_ruby/models/list_real_time_metrics_response.rb +206 -0
  101. data/lib/mux_ruby/models/list_related_incidents_response.rb +206 -0
  102. data/lib/mux_ruby/models/live_stream.rb +1 -1
  103. data/lib/mux_ruby/models/notification_rule.rb +202 -0
  104. data/lib/mux_ruby/models/playback_id.rb +1 -0
  105. data/lib/mux_ruby/models/real_time_breakdown_value.rb +220 -0
  106. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket.rb +193 -0
  107. data/lib/mux_ruby/models/real_time_histogram_timeseries_bucket_values.rb +193 -0
  108. data/lib/mux_ruby/models/real_time_histogram_timeseries_datapoint.rb +240 -0
  109. data/lib/mux_ruby/models/real_time_timeseries_datapoint.rb +202 -0
  110. data/lib/mux_ruby/models/simulcast_target.rb +1 -1
  111. data/lib/mux_ruby/models/track.rb +27 -2
  112. data/lib/mux_ruby/models/update_asset_master_access_request.rb +1 -1
  113. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +1 -1
  114. data/lib/mux_ruby/models/upload.rb +1 -1
  115. data/lib/mux_ruby/models/video_view.rb +36 -18
  116. data/lib/mux_ruby/version.rb +1 -1
  117. data/mux_ruby.gemspec +2 -0
  118. data/spec/api/assets_api_spec.rb +2 -0
  119. data/spec/api/dimensions_api_spec.rb +55 -0
  120. data/spec/api/filters_api_spec.rb +2 -2
  121. data/spec/api/incidents_api_spec.rb +73 -0
  122. data/spec/api/live_streams_api_spec.rb +24 -0
  123. data/spec/api/playback_id_api_spec.rb +40 -0
  124. data/spec/api/real_time_api_spec.rb +93 -0
  125. data/spec/models/asset_master_spec.rb +4 -0
  126. data/spec/models/asset_non_standard_input_reasons_spec.rb +98 -0
  127. data/spec/models/asset_recording_times_spec.rb +40 -0
  128. data/spec/models/asset_spec.rb +26 -0
  129. data/spec/models/asset_static_renditions_files_spec.rb +2 -2
  130. data/spec/models/create_live_stream_request_spec.rb +6 -0
  131. data/spec/models/dimension_value_spec.rb +40 -0
  132. data/spec/models/disable_live_stream_response_spec.rb +34 -0
  133. data/spec/models/enable_live_stream_response_spec.rb +34 -0
  134. data/spec/models/get_asset_or_live_stream_id_response_data_object_spec.rb +44 -0
  135. data/spec/models/get_asset_or_live_stream_id_response_data_spec.rb +46 -0
  136. data/spec/models/get_asset_or_live_stream_id_response_spec.rb +34 -0
  137. data/spec/models/get_real_time_breakdown_response_spec.rb +46 -0
  138. data/spec/models/get_real_time_histogram_timeseries_response_meta_spec.rb +34 -0
  139. data/spec/models/get_real_time_histogram_timeseries_response_spec.rb +52 -0
  140. data/spec/models/get_real_time_timeseries_response_spec.rb +46 -0
  141. data/spec/models/incident_breakdown_spec.rb +46 -0
  142. data/spec/models/incident_notification_rule_spec.rb +58 -0
  143. data/spec/models/incident_notification_spec.rb +46 -0
  144. data/spec/models/incident_response_spec.rb +40 -0
  145. data/spec/models/incident_spec.rb +154 -0
  146. data/spec/models/input_settings_spec.rb +12 -0
  147. data/spec/models/list_dimension_values_response_spec.rb +46 -0
  148. data/spec/models/list_dimensions_response_spec.rb +46 -0
  149. data/spec/models/list_incidents_response_spec.rb +46 -0
  150. data/spec/models/list_real_time_dimensions_response_data_spec.rb +40 -0
  151. data/spec/models/list_real_time_dimensions_response_spec.rb +46 -0
  152. data/spec/models/list_real_time_metrics_response_spec.rb +46 -0
  153. data/spec/models/list_related_incidents_response_spec.rb +46 -0
  154. data/spec/models/notification_rule_spec.rb +46 -0
  155. data/spec/models/real_time_breakdown_value_spec.rb +58 -0
  156. data/spec/models/real_time_histogram_timeseries_bucket_spec.rb +40 -0
  157. data/spec/models/real_time_histogram_timeseries_bucket_values_spec.rb +40 -0
  158. data/spec/models/real_time_histogram_timeseries_datapoint_spec.rb +70 -0
  159. data/spec/models/real_time_timeseries_datapoint_spec.rb +46 -0
  160. data/spec/models/track_spec.rb +4 -0
  161. data/spec/models/video_view_spec.rb +12 -0
  162. metadata +200 -60
@@ -57,33 +57,33 @@ module MuxRuby
57
57
  elsif response.code == 401
58
58
  fail UnauthorizedError.new(:code => response.code,
59
59
  :response_headers => response.headers,
60
- :response_body => response.body),
61
- response.status_message
60
+ :response_body => response.body,
61
+ :message => response.status_message)
62
62
  elsif response.code == 403
63
63
  fail ForbiddenError.new(:code => response.code,
64
64
  :response_headers => response.headers,
65
- :response_body => response.body),
66
- response.status_message
65
+ :response_body => response.body,
66
+ :message => response.status_message)
67
67
  elsif response.code == 404
68
68
  fail NotFoundError.new(:code => response.code,
69
69
  :response_headers => response.headers,
70
- :response_body => response.body),
71
- response.status_message
70
+ :response_body => response.body,
71
+ :message => response.status_message)
72
72
  elsif response.code == 429
73
73
  fail TooManyRequestsError.new(:code => response.code,
74
74
  :response_headers => response.headers,
75
- :response_body => response.body),
76
- response.status_message
75
+ :response_body => response.body,
76
+ :message => response.status_message)
77
77
  elsif response.code.between?(500, 599)
78
78
  fail ServiceError.new(:code => response.code,
79
79
  :response_headers => response.headers,
80
- :response_body => response.body),
81
- response.status_message
80
+ :response_body => response.body,
81
+ :message => response.status_message)
82
82
  else
83
83
  fail ApiError.new(:code => response.code,
84
84
  :response_headers => response.headers,
85
- :response_body => response.body),
86
- response.status_message
85
+ :response_body => response.body,
86
+ :message => response.status_message)
87
87
  end
88
88
  end
89
89
 
@@ -280,7 +280,7 @@ module MuxRuby
280
280
  def build_request_url(path)
281
281
  # Add leading and trailing slashes to path
282
282
  path = "/#{path}".gsub(/\/+/, '/')
283
- URI.encode(@config.base_url + path)
283
+ "#{@config.base_url}#{path}"
284
284
  end
285
285
 
286
286
  # Builds the HTTP request body
@@ -3,8 +3,6 @@
3
3
  # NOTE: This file is auto generated. Do not edit this file manually.
4
4
  =end
5
5
 
6
- require 'uri'
7
-
8
6
  module MuxRuby
9
7
  class Configuration
10
8
  # Defines url scheme
@@ -167,8 +165,7 @@ module MuxRuby
167
165
  end
168
166
 
169
167
  def base_url
170
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
171
- URI.encode(url)
168
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
172
169
  end
173
170
 
174
171
  # Gets API key (with prefix if set).
@@ -7,20 +7,27 @@ require 'date'
7
7
 
8
8
  module MuxRuby
9
9
  class Asset
10
+ # Unique identifier for the Asset.
10
11
  attr_accessor :id
11
12
 
13
+ # Time at which the object was created. Measured in seconds since the Unix epoch.
12
14
  attr_accessor :created_at
13
15
 
14
16
  attr_accessor :deleted_at
15
17
 
18
+ # The status of the asset.
16
19
  attr_accessor :status
17
20
 
21
+ # The duration of the asset in seconds (max duration for a single asset is 24 hours).
18
22
  attr_accessor :duration
19
23
 
24
+ # The maximum resolution that has been stored for the asset. The asset may be delivered at lower resolutions depending on the device and bandwidth, however it cannot be delivered at a higher value than is stored.
20
25
  attr_accessor :max_stored_resolution
21
26
 
27
+ # The maximum frame rate that has been stored for the asset. The asset may be delivered at lower frame rates depending on the device and bandwidth, however it cannot be delivered at a higher value than is stored. This field may return -1 if the frame rate of the input cannot be reliably determined.
22
28
  attr_accessor :max_stored_frame_rate
23
29
 
30
+ # The aspect ratio of the asset in the form of `width:height`, for example `16:9`.
24
31
  attr_accessor :aspect_ratio
25
32
 
26
33
  attr_accessor :playback_ids
@@ -31,10 +38,13 @@ module MuxRuby
31
38
 
32
39
  attr_accessor :per_title_encode
33
40
 
41
+ # Whether the asset is created from a live stream and the live stream is currently `active` and not in `idle` state.
34
42
  attr_accessor :is_live
35
43
 
44
+ # Arbitrary metadata set for the asset. Max 255 characters.
36
45
  attr_accessor :passthrough
37
46
 
47
+ # Unique identifier for the live stream. This is an optional parameter added when the asset is created from a live stream.
38
48
  attr_accessor :live_stream_id
39
49
 
40
50
  attr_accessor :master
@@ -43,10 +53,20 @@ module MuxRuby
43
53
 
44
54
  attr_accessor :mp4_support
45
55
 
56
+ # Asset Identifier of the video used as the source for creating the clip.
57
+ attr_accessor :source_asset_id
58
+
59
+ # Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
46
60
  attr_accessor :normalize_audio
47
61
 
48
62
  attr_accessor :static_renditions
49
63
 
64
+ # An array of individual live stream recording sessions. A recording session is created on each encoder connection during the live stream
65
+ attr_accessor :recording_times
66
+
67
+ attr_accessor :non_standard_input_reasons
68
+
69
+ # Indicates this asset is a test asset if the value is `true`. A Test asset can help evaluate the Mux Video APIs without incurring any cost. There is no limit on number of test assets created. Test assets are watermarked with the Mux logo, limited to 10 seconds, and deleted after 24 hrs.
50
70
  attr_accessor :test
51
71
 
52
72
  class EnumAttributeValidator
@@ -92,8 +112,11 @@ module MuxRuby
92
112
  :'master' => :'master',
93
113
  :'master_access' => :'master_access',
94
114
  :'mp4_support' => :'mp4_support',
115
+ :'source_asset_id' => :'source_asset_id',
95
116
  :'normalize_audio' => :'normalize_audio',
96
117
  :'static_renditions' => :'static_renditions',
118
+ :'recording_times' => :'recording_times',
119
+ :'non_standard_input_reasons' => :'non_standard_input_reasons',
97
120
  :'test' => :'test'
98
121
  }
99
122
  end
@@ -119,8 +142,11 @@ module MuxRuby
119
142
  :'master' => :'AssetMaster',
120
143
  :'master_access' => :'String',
121
144
  :'mp4_support' => :'String',
145
+ :'source_asset_id' => :'String',
122
146
  :'normalize_audio' => :'BOOLEAN',
123
147
  :'static_renditions' => :'AssetStaticRenditions',
148
+ :'recording_times' => :'Array<AssetRecordingTimes>',
149
+ :'non_standard_input_reasons' => :'AssetNonStandardInputReasons',
124
150
  :'test' => :'BOOLEAN'
125
151
  }
126
152
  end
@@ -213,6 +239,10 @@ module MuxRuby
213
239
  self.mp4_support = 'none'
214
240
  end
215
241
 
242
+ if attributes.has_key?(:'source_asset_id')
243
+ self.source_asset_id = attributes[:'source_asset_id']
244
+ end
245
+
216
246
  if attributes.has_key?(:'normalize_audio')
217
247
  self.normalize_audio = attributes[:'normalize_audio']
218
248
  else
@@ -223,6 +253,16 @@ module MuxRuby
223
253
  self.static_renditions = attributes[:'static_renditions']
224
254
  end
225
255
 
256
+ if attributes.has_key?(:'recording_times')
257
+ if (value = attributes[:'recording_times']).is_a?(Array)
258
+ self.recording_times = value
259
+ end
260
+ end
261
+
262
+ if attributes.has_key?(:'non_standard_input_reasons')
263
+ self.non_standard_input_reasons = attributes[:'non_standard_input_reasons']
264
+ end
265
+
226
266
  if attributes.has_key?(:'test')
227
267
  self.test = attributes[:'test']
228
268
  end
@@ -238,6 +278,10 @@ module MuxRuby
238
278
  # Check to see if the all the properties in the model are valid
239
279
  # @return true if the model is valid
240
280
  def valid?
281
+ status_validator = EnumAttributeValidator.new('String', ['preparing', 'ready', 'errored'])
282
+ return false unless status_validator.valid?(@status)
283
+ max_stored_resolution_validator = EnumAttributeValidator.new('String', ['Audio only', 'SD', 'HD', 'FHD', 'UHD'])
284
+ return false unless max_stored_resolution_validator.valid?(@max_stored_resolution)
241
285
  master_access_validator = EnumAttributeValidator.new('String', ['temporary', 'none'])
242
286
  return false unless master_access_validator.valid?(@master_access)
243
287
  mp4_support_validator = EnumAttributeValidator.new('String', ['standard', 'none'])
@@ -245,12 +289,32 @@ module MuxRuby
245
289
  true
246
290
  end
247
291
 
292
+ # Custom attribute writer method checking allowed values (enum).
293
+ # @param [Object] status Object to be assigned
294
+ def status=(status)
295
+ validator = EnumAttributeValidator.new('String', ['preparing', 'ready', 'errored'])
296
+ unless validator.valid?(status)
297
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
298
+ end
299
+ @status = status
300
+ end
301
+
302
+ # Custom attribute writer method checking allowed values (enum).
303
+ # @param [Object] max_stored_resolution Object to be assigned
304
+ def max_stored_resolution=(max_stored_resolution)
305
+ validator = EnumAttributeValidator.new('String', ['Audio only', 'SD', 'HD', 'FHD', 'UHD'])
306
+ unless validator.valid?(max_stored_resolution)
307
+ fail ArgumentError, "invalid value for \"max_stored_resolution\", must be one of #{validator.allowable_values}."
308
+ end
309
+ @max_stored_resolution = max_stored_resolution
310
+ end
311
+
248
312
  # Custom attribute writer method checking allowed values (enum).
249
313
  # @param [Object] master_access Object to be assigned
250
314
  def master_access=(master_access)
251
315
  validator = EnumAttributeValidator.new('String', ['temporary', 'none'])
252
316
  unless validator.valid?(master_access)
253
- fail ArgumentError, 'invalid value for "master_access", must be one of #{validator.allowable_values}.'
317
+ fail ArgumentError, "invalid value for \"master_access\", must be one of #{validator.allowable_values}."
254
318
  end
255
319
  @master_access = master_access
256
320
  end
@@ -260,7 +324,7 @@ module MuxRuby
260
324
  def mp4_support=(mp4_support)
261
325
  validator = EnumAttributeValidator.new('String', ['standard', 'none'])
262
326
  unless validator.valid?(mp4_support)
263
- fail ArgumentError, 'invalid value for "mp4_support", must be one of #{validator.allowable_values}.'
327
+ fail ArgumentError, "invalid value for \"mp4_support\", must be one of #{validator.allowable_values}."
264
328
  end
265
329
  @mp4_support = mp4_support
266
330
  end
@@ -288,8 +352,11 @@ module MuxRuby
288
352
  master == o.master &&
289
353
  master_access == o.master_access &&
290
354
  mp4_support == o.mp4_support &&
355
+ source_asset_id == o.source_asset_id &&
291
356
  normalize_audio == o.normalize_audio &&
292
357
  static_renditions == o.static_renditions &&
358
+ recording_times == o.recording_times &&
359
+ non_standard_input_reasons == o.non_standard_input_reasons &&
293
360
  test == o.test
294
361
  end
295
362
 
@@ -302,7 +369,7 @@ module MuxRuby
302
369
  # Calculates hash code according to all attributes.
303
370
  # @return [Fixnum] Hash code
304
371
  def hash
305
- [id, created_at, deleted_at, status, duration, max_stored_resolution, max_stored_frame_rate, aspect_ratio, playback_ids, tracks, errors, per_title_encode, is_live, passthrough, live_stream_id, master, master_access, mp4_support, normalize_audio, static_renditions, test].hash
372
+ [id, created_at, deleted_at, status, duration, max_stored_resolution, max_stored_frame_rate, aspect_ratio, playback_ids, tracks, errors, per_title_encode, is_live, passthrough, live_stream_id, master, master_access, mp4_support, source_asset_id, normalize_audio, static_renditions, recording_times, non_standard_input_reasons, test].hash
306
373
  end
307
374
 
308
375
  # Builds the object from hash
@@ -7,8 +7,10 @@ require 'date'
7
7
 
8
8
  module MuxRuby
9
9
  class AssetErrors
10
+ # The type of error that occurred for this asset.
10
11
  attr_accessor :type
11
12
 
13
+ # Error messages with more details.
12
14
  attr_accessor :messages
13
15
 
14
16
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -6,11 +6,34 @@
6
6
  require 'date'
7
7
 
8
8
  module MuxRuby
9
+ # An object containing the current status of Master Access and the link to the Master MP4 file when ready. This object does not exist if `master_acess` is set to `none` and when the temporary URL expires.
9
10
  class AssetMaster
10
11
  attr_accessor :status
11
12
 
12
13
  attr_accessor :url
13
14
 
15
+ class EnumAttributeValidator
16
+ attr_reader :datatype
17
+ attr_reader :allowable_values
18
+
19
+ def initialize(datatype, allowable_values)
20
+ @allowable_values = allowable_values.map do |value|
21
+ case datatype.to_s
22
+ when /Integer/i
23
+ value.to_i
24
+ when /Float/i
25
+ value.to_f
26
+ else
27
+ value
28
+ end
29
+ end
30
+ end
31
+
32
+ def valid?(value)
33
+ !value || allowable_values.include?(value)
34
+ end
35
+ end
36
+
14
37
  # Attribute mapping from ruby-style variable name to JSON key.
15
38
  def self.attribute_map
16
39
  {
@@ -54,9 +77,21 @@ module MuxRuby
54
77
  # Check to see if the all the properties in the model are valid
55
78
  # @return true if the model is valid
56
79
  def valid?
80
+ status_validator = EnumAttributeValidator.new('String', ['ready', 'preparing', 'errored'])
81
+ return false unless status_validator.valid?(@status)
57
82
  true
58
83
  end
59
84
 
85
+ # Custom attribute writer method checking allowed values (enum).
86
+ # @param [Object] status Object to be assigned
87
+ def status=(status)
88
+ validator = EnumAttributeValidator.new('String', ['ready', 'preparing', 'errored'])
89
+ unless validator.valid?(status)
90
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
91
+ end
92
+ @status = status
93
+ end
94
+
60
95
  # Checks equality by comparing each attribute.
61
96
  # @param [Object] Object to be compared
62
97
  def ==(o)
@@ -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