mux_ruby 3.3.1 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +13 -7
  4. data/docs/Asset.md +1 -1
  5. data/docs/AssetNonStandardInputReasons.md +2 -2
  6. data/docs/AssetResponse.md +1 -1
  7. data/docs/AssetsApi.md +8 -0
  8. data/docs/Broadcast.md +30 -0
  9. data/docs/BroadcastLayout.md +15 -0
  10. data/docs/BroadcastResolution.md +15 -0
  11. data/docs/BroadcastResponse.md +18 -0
  12. data/docs/BroadcastStatus.md +15 -0
  13. data/docs/CreateBroadcastRequest.md +26 -0
  14. data/docs/CreateLiveStreamRequest.md +3 -1
  15. data/docs/CreatePlaybackIDResponse.md +1 -1
  16. data/docs/CreatePlaybackRestrictionRequest.md +1 -1
  17. data/docs/CreateSimulcastTargetRequest.md +1 -1
  18. data/docs/CreateSpaceRequest.md +22 -0
  19. data/docs/CreateTrackResponse.md +1 -1
  20. data/docs/DirectUploadsApi.md +6 -0
  21. data/docs/GetAssetPlaybackIDResponse.md +1 -1
  22. data/docs/GetLiveStreamPlaybackIDResponse.md +1 -1
  23. data/docs/IncidentResponse.md +1 -1
  24. data/docs/InputSettings.md +3 -3
  25. data/docs/ListSpacesResponse.md +18 -0
  26. data/docs/LiveStream.md +3 -1
  27. data/docs/LiveStreamResponse.md +1 -1
  28. data/docs/LiveStreamsApi.md +16 -4
  29. data/docs/MetricsApi.md +3 -3
  30. data/docs/PlaybackRestrictionResponse.md +1 -1
  31. data/docs/PlaybackRestrictionsApi.md +6 -6
  32. data/docs/RealTimeApi.md +2 -2
  33. data/docs/SigningKeyResponse.md +1 -1
  34. data/docs/SimulcastTargetResponse.md +1 -1
  35. data/docs/Space.md +30 -0
  36. data/docs/SpaceResponse.md +18 -0
  37. data/docs/SpaceStatus.md +15 -0
  38. data/docs/SpaceType.md +15 -0
  39. data/docs/SpacesApi.md +658 -0
  40. data/docs/StartSpaceBroadcastResponse.md +18 -0
  41. data/docs/StopSpaceBroadcastResponse.md +18 -0
  42. data/docs/Track.md +9 -7
  43. data/docs/UpdateLiveStreamRequest.md +3 -1
  44. data/docs/UpdateReferrerDomainRestrictionRequest.md +37 -5
  45. data/docs/UploadResponse.md +1 -1
  46. data/docs/VideoViewResponse.md +1 -1
  47. data/gen/generator-config.json +1 -1
  48. data/gen/templates/README.mustache +9 -3
  49. data/lib/mux_ruby/api/assets_api.rb +8 -0
  50. data/lib/mux_ruby/api/direct_uploads_api.rb +6 -0
  51. data/lib/mux_ruby/api/live_streams_api.rb +14 -2
  52. data/lib/mux_ruby/api/metrics_api.rb +5 -5
  53. data/lib/mux_ruby/api/playback_restrictions_api.rb +9 -9
  54. data/lib/mux_ruby/api/real_time_api.rb +2 -2
  55. data/lib/mux_ruby/api/spaces_api.rb +619 -0
  56. data/lib/mux_ruby/models/abridged_video_view.rb +7 -0
  57. data/lib/mux_ruby/models/asset.rb +1 -1
  58. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +2 -2
  59. data/lib/mux_ruby/models/broadcast.rb +305 -0
  60. data/lib/mux_ruby/models/broadcast_layout.rb +37 -0
  61. data/lib/mux_ruby/models/broadcast_resolution.rb +41 -0
  62. data/lib/mux_ruby/models/broadcast_response.rb +223 -0
  63. data/lib/mux_ruby/models/broadcast_status.rb +37 -0
  64. data/lib/mux_ruby/models/create_broadcast_request.rb +266 -0
  65. data/lib/mux_ruby/models/create_live_stream_request.rb +40 -4
  66. data/lib/mux_ruby/models/create_simulcast_target_request.rb +1 -1
  67. data/lib/mux_ruby/models/create_space_request.rb +242 -0
  68. data/lib/mux_ruby/models/input_settings.rb +3 -3
  69. data/lib/mux_ruby/models/list_spaces_response.rb +225 -0
  70. data/lib/mux_ruby/models/live_stream.rb +40 -4
  71. data/lib/mux_ruby/models/space.rb +301 -0
  72. data/lib/mux_ruby/models/space_response.rb +223 -0
  73. data/lib/mux_ruby/models/space_status.rb +37 -0
  74. data/lib/mux_ruby/models/space_type.rb +36 -0
  75. data/lib/mux_ruby/models/start_space_broadcast_response.rb +218 -0
  76. data/lib/mux_ruby/models/stop_space_broadcast_response.rb +218 -0
  77. data/lib/mux_ruby/models/track.rb +32 -10
  78. data/lib/mux_ruby/models/update_live_stream_request.rb +40 -4
  79. data/lib/mux_ruby/models/update_referrer_domain_restriction_request.rb +74 -179
  80. data/lib/mux_ruby/models/video_view.rb +103 -0
  81. data/lib/mux_ruby/version.rb +1 -1
  82. data/lib/mux_ruby.rb +15 -0
  83. data/spec/api/spaces_api_spec.rb +149 -0
  84. data/spec/models/broadcast_layout_spec.rb +28 -0
  85. data/spec/models/broadcast_resolution_spec.rb +28 -0
  86. data/spec/models/broadcast_response_spec.rb +34 -0
  87. data/spec/models/broadcast_spec.rb +70 -0
  88. data/spec/models/broadcast_status_spec.rb +28 -0
  89. data/spec/models/create_broadcast_request_spec.rb +58 -0
  90. data/spec/models/create_space_request_spec.rb +46 -0
  91. data/spec/models/list_spaces_response_spec.rb +34 -0
  92. data/spec/models/space_response_spec.rb +34 -0
  93. data/spec/models/space_spec.rb +70 -0
  94. data/spec/models/space_status_spec.rb +28 -0
  95. data/spec/models/space_type_spec.rb +28 -0
  96. data/spec/models/start_space_broadcast_response_spec.rb +34 -0
  97. data/spec/models/stop_space_broadcast_response_spec.rb +34 -0
  98. metadata +159 -99
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ class CreateBroadcastRequest
18
+ # Arbitrary user-supplied metadata that will be included in the broadcast details and related webhooks. Max: 255 characters.
19
+ attr_accessor :passthrough
20
+
21
+ # The ID of the live stream that you want to broadcast to.
22
+ attr_accessor :live_stream_id
23
+
24
+ attr_accessor :layout
25
+
26
+ # URL of an image to display as the background of the broadcast. Its dimensions should match the provided resolution.
27
+ attr_accessor :background
28
+
29
+ attr_accessor :resolution
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'passthrough' => :'passthrough',
35
+ :'live_stream_id' => :'live_stream_id',
36
+ :'layout' => :'layout',
37
+ :'background' => :'background',
38
+ :'resolution' => :'resolution'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'passthrough' => :'String',
51
+ :'live_stream_id' => :'String',
52
+ :'layout' => :'BroadcastLayout',
53
+ :'background' => :'String',
54
+ :'resolution' => :'BroadcastResolution'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::CreateBroadcastRequest` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::CreateBroadcastRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'passthrough')
80
+ self.passthrough = attributes[:'passthrough']
81
+ end
82
+
83
+ if attributes.key?(:'live_stream_id')
84
+ self.live_stream_id = attributes[:'live_stream_id']
85
+ end
86
+
87
+ if attributes.key?(:'layout')
88
+ self.layout = attributes[:'layout']
89
+ else
90
+ self.layout = 'gallery'
91
+ end
92
+
93
+ if attributes.key?(:'background')
94
+ self.background = attributes[:'background']
95
+ end
96
+
97
+ if attributes.key?(:'resolution')
98
+ self.resolution = attributes[:'resolution']
99
+ else
100
+ self.resolution = '1920x1080'
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @live_stream_id.nil?
109
+ invalid_properties.push('invalid value for "live_stream_id", live_stream_id cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if @live_stream_id.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ passthrough == o.passthrough &&
128
+ live_stream_id == o.live_stream_id &&
129
+ layout == o.layout &&
130
+ background == o.background &&
131
+ resolution == o.resolution
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [passthrough, live_stream_id, layout, background, resolution].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = MuxRuby.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -44,6 +44,9 @@ module MuxRuby
44
44
 
45
45
  attr_accessor :simulcast_targets
46
46
 
47
+ # The time in seconds a live stream may be continuously active before being disconnected. Defaults to 12 hours.
48
+ attr_accessor :max_continuous_duration
49
+
47
50
  class EnumAttributeValidator
48
51
  attr_reader :datatype
49
52
  attr_reader :allowable_values
@@ -79,7 +82,8 @@ module MuxRuby
79
82
  :'low_latency' => :'low_latency',
80
83
  :'latency_mode' => :'latency_mode',
81
84
  :'test' => :'test',
82
- :'simulcast_targets' => :'simulcast_targets'
85
+ :'simulcast_targets' => :'simulcast_targets',
86
+ :'max_continuous_duration' => :'max_continuous_duration'
83
87
  }
84
88
  end
85
89
 
@@ -101,7 +105,8 @@ module MuxRuby
101
105
  :'low_latency' => :'Boolean',
102
106
  :'latency_mode' => :'String',
103
107
  :'test' => :'Boolean',
104
- :'simulcast_targets' => :'Array<CreateSimulcastTargetRequest>'
108
+ :'simulcast_targets' => :'Array<CreateSimulcastTargetRequest>',
109
+ :'max_continuous_duration' => :'Integer'
105
110
  }
106
111
  end
107
112
 
@@ -175,6 +180,12 @@ module MuxRuby
175
180
  self.simulcast_targets = value
176
181
  end
177
182
  end
183
+
184
+ if attributes.key?(:'max_continuous_duration')
185
+ self.max_continuous_duration = attributes[:'max_continuous_duration']
186
+ else
187
+ self.max_continuous_duration = 43200
188
+ end
178
189
  end
179
190
 
180
191
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -189,6 +200,14 @@ module MuxRuby
189
200
  invalid_properties.push('invalid value for "reconnect_window", must be greater than or equal to 0.1.')
190
201
  end
191
202
 
203
+ if !@max_continuous_duration.nil? && @max_continuous_duration > 43200
204
+ invalid_properties.push('invalid value for "max_continuous_duration", must be smaller than or equal to 43200.')
205
+ end
206
+
207
+ if !@max_continuous_duration.nil? && @max_continuous_duration < 60
208
+ invalid_properties.push('invalid value for "max_continuous_duration", must be greater than or equal to 60.')
209
+ end
210
+
192
211
  invalid_properties
193
212
  end
194
213
 
@@ -199,6 +218,8 @@ module MuxRuby
199
218
  return false if !@reconnect_window.nil? && @reconnect_window < 0.1
200
219
  latency_mode_validator = EnumAttributeValidator.new('String', ["low", "reduced", "standard"])
201
220
  return false unless latency_mode_validator.valid?(@latency_mode)
221
+ return false if !@max_continuous_duration.nil? && @max_continuous_duration > 43200
222
+ return false if !@max_continuous_duration.nil? && @max_continuous_duration < 60
202
223
  true
203
224
  end
204
225
 
@@ -226,6 +247,20 @@ module MuxRuby
226
247
  @latency_mode = latency_mode
227
248
  end
228
249
 
250
+ # Custom attribute writer method with validation
251
+ # @param [Object] max_continuous_duration Value to be assigned
252
+ def max_continuous_duration=(max_continuous_duration)
253
+ if !max_continuous_duration.nil? && max_continuous_duration > 43200
254
+ fail ArgumentError, 'invalid value for "max_continuous_duration", must be smaller than or equal to 43200.'
255
+ end
256
+
257
+ if !max_continuous_duration.nil? && max_continuous_duration < 60
258
+ fail ArgumentError, 'invalid value for "max_continuous_duration", must be greater than or equal to 60.'
259
+ end
260
+
261
+ @max_continuous_duration = max_continuous_duration
262
+ end
263
+
229
264
  # Checks equality by comparing each attribute.
230
265
  # @param [Object] Object to be compared
231
266
  def ==(o)
@@ -241,7 +276,8 @@ module MuxRuby
241
276
  low_latency == o.low_latency &&
242
277
  latency_mode == o.latency_mode &&
243
278
  test == o.test &&
244
- simulcast_targets == o.simulcast_targets
279
+ simulcast_targets == o.simulcast_targets &&
280
+ max_continuous_duration == o.max_continuous_duration
245
281
  end
246
282
 
247
283
  # @see the `==` method
@@ -253,7 +289,7 @@ module MuxRuby
253
289
  # Calculates hash code according to all attributes.
254
290
  # @return [Integer] Hash code
255
291
  def hash
256
- [playback_policy, new_asset_settings, reconnect_window, passthrough, audio_only, embedded_subtitles, reduced_latency, low_latency, latency_mode, test, simulcast_targets].hash
292
+ [playback_policy, new_asset_settings, reconnect_window, passthrough, audio_only, embedded_subtitles, reduced_latency, low_latency, latency_mode, test, simulcast_targets, max_continuous_duration].hash
257
293
  end
258
294
 
259
295
  # Builds the object from hash
@@ -21,7 +21,7 @@ module MuxRuby
21
21
  # Stream Key represents a stream identifier on the third party live streaming service to send the parent live stream to.
22
22
  attr_accessor :stream_key
23
23
 
24
- # RTMP hostname including application name for the third party live streaming service. Example: 'rtmp://live.example.com/app'.
24
+ # RTMP hostname including application name for the third party live streaming service. Example: `rtmp://live.example.com/app`.
25
25
  attr_accessor :url
26
26
 
27
27
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,242 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ class CreateSpaceRequest
18
+ attr_accessor :type
19
+
20
+ # Arbitrary user-supplied metadata that will be included in the space details and related webhooks. Max: 255 characters.
21
+ attr_accessor :passthrough
22
+
23
+ # An array of broadcast destinations you want to stream the space to. **Note:** By default only a single broadcast destination can be specified. Contact Mux support if you need more.
24
+ attr_accessor :broadcasts
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'type' => :'type',
30
+ :'passthrough' => :'passthrough',
31
+ :'broadcasts' => :'broadcasts'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'type' => :'SpaceType',
44
+ :'passthrough' => :'String',
45
+ :'broadcasts' => :'Array<CreateBroadcastRequest>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::CreateSpaceRequest` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::CreateSpaceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'type')
71
+ self.type = attributes[:'type']
72
+ else
73
+ self.type = 'server'
74
+ end
75
+
76
+ if attributes.key?(:'passthrough')
77
+ self.passthrough = attributes[:'passthrough']
78
+ end
79
+
80
+ if attributes.key?(:'broadcasts')
81
+ if (value = attributes[:'broadcasts']).is_a?(Array)
82
+ self.broadcasts = value
83
+ end
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
+ type == o.type &&
106
+ passthrough == o.passthrough &&
107
+ broadcasts == o.broadcasts
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [type, passthrough, broadcasts].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ new.build_from_hash(attributes)
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
+ self.send("#{key}=", nil)
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = MuxRuby.const_get(type)
190
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end
@@ -27,16 +27,16 @@ module MuxRuby
27
27
  # The time offset in seconds from the beginning of the video, indicating the clip's ending marker. The default value is the duration of the video when not included. This parameter is only applicable for creating clips when `input.url` has `mux://assets/{asset_id}` format.
28
28
  attr_accessor :end_time
29
29
 
30
- # This parameter is required for the `text` track type.
30
+ # This parameter is required for `text` type tracks.
31
31
  attr_accessor :type
32
32
 
33
- # Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, [see this blog post](https://mux.com/blog/subtitles-captions-webvtt-hls-and-those-magic-flags/). This parameter is required for `text` track type.
33
+ # Type of text track. This parameter only supports subtitles value. For more information on Subtitles / Closed Captions, [see this blog post](https://mux.com/blog/subtitles-captions-webvtt-hls-and-those-magic-flags/). This parameter is required for `text` type tracks.
34
34
  attr_accessor :text_type
35
35
 
36
36
  # The language code value must be a valid [BCP 47](https://tools.ietf.org/html/bcp47) specification compliant value. For example, en for English or en-US for the US version of English. This parameter is required for text type and subtitles text type track.
37
37
  attr_accessor :language_code
38
38
 
39
- # The name of the track containing a human-readable description. This value must be unique across all text type and subtitles `text` type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be \"English\" for subtitles text track with language_code as en. This optional parameter should be used only for `text` type and subtitles `text` type track. If this parameter is not included, Mux will auto-populate based on the `input[].language_code` value.
39
+ # The name of the track containing a human-readable description. This value must be unique across all text type and subtitles `text` type tracks. The hls manifest will associate a subtitle text track with this value. For example, the value should be \"English\" for subtitles text track with language_code as en. This optional parameter should be used only for `text` type and subtitles `text` type tracks. If this parameter is not included, Mux will auto-populate based on the `input[].language_code` value.
40
40
  attr_accessor :name
41
41
 
42
42
  # Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This optional parameter should be used for `text` type and subtitles `text` type tracks.