mux_ruby 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -4
- data/docs/AssetNonStandardInputReasons.md +2 -2
- data/docs/AssetResponse.md +1 -1
- data/docs/AssetsApi.md +8 -0
- data/docs/CreateLiveStreamRequest.md +3 -1
- data/docs/CreatePlaybackIDResponse.md +1 -1
- data/docs/CreatePlaybackRestrictionRequest.md +1 -1
- data/docs/CreateTrackResponse.md +1 -1
- data/docs/DirectUploadsApi.md +6 -0
- data/docs/GetAssetPlaybackIDResponse.md +1 -1
- data/docs/GetLiveStreamPlaybackIDResponse.md +1 -1
- data/docs/IncidentResponse.md +1 -1
- data/docs/InputSettings.md +3 -3
- data/docs/LiveStream.md +3 -1
- data/docs/LiveStreamResponse.md +1 -1
- data/docs/LiveStreamsApi.md +16 -4
- data/docs/MetricsApi.md +2 -2
- data/docs/PlaybackRestrictionResponse.md +1 -1
- data/docs/PlaybackRestrictionsApi.md +6 -6
- data/docs/SigningKeyResponse.md +1 -1
- data/docs/SimulcastTargetResponse.md +1 -1
- data/docs/Track.md +9 -7
- data/docs/UpdateLiveStreamRequest.md +3 -1
- data/docs/UpdateReferrerDomainRestrictionRequest.md +37 -5
- data/docs/UploadResponse.md +1 -1
- data/docs/VideoViewResponse.md +1 -1
- data/gen/generator-config.json +1 -1
- data/lib/mux_ruby/api/assets_api.rb +8 -0
- data/lib/mux_ruby/api/direct_uploads_api.rb +6 -0
- data/lib/mux_ruby/api/live_streams_api.rb +14 -2
- data/lib/mux_ruby/api/metrics_api.rb +3 -3
- data/lib/mux_ruby/api/playback_restrictions_api.rb +9 -9
- data/lib/mux_ruby/models/abridged_video_view.rb +7 -0
- data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +2 -2
- data/lib/mux_ruby/models/create_live_stream_request.rb +40 -4
- data/lib/mux_ruby/models/input_settings.rb +3 -3
- data/lib/mux_ruby/models/live_stream.rb +40 -4
- data/lib/mux_ruby/models/track.rb +32 -10
- data/lib/mux_ruby/models/update_live_stream_request.rb +40 -4
- data/lib/mux_ruby/models/update_referrer_domain_restriction_request.rb +74 -179
- data/lib/mux_ruby/models/video_view.rb +103 -0
- data/lib/mux_ruby/version.rb +1 -1
- metadata +102 -102
@@ -21,7 +21,7 @@ module MuxRuby
|
|
21
21
|
# The type of track
|
22
22
|
attr_accessor :type
|
23
23
|
|
24
|
-
# The duration in seconds of the track media. This parameter is not set for
|
24
|
+
# The duration in seconds of the track media. This parameter is not set for `text` type tracks. This field is optional and may not be set. The top level `duration` field of an asset will always be set.
|
25
25
|
attr_accessor :duration
|
26
26
|
|
27
27
|
# The maximum width in pixels available for the track. Only set for the `video` type track.
|
@@ -39,21 +39,24 @@ module MuxRuby
|
|
39
39
|
# Only set for the `audio` type track.
|
40
40
|
attr_accessor :max_channel_layout
|
41
41
|
|
42
|
-
# This parameter is set
|
42
|
+
# This parameter is only set for `text` type tracks.
|
43
43
|
attr_accessor :text_type
|
44
44
|
|
45
|
-
# The language code value represents [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 set for `text` type and `subtitles` text type
|
45
|
+
# The language code value represents [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 only set for `text` type and `subtitles` text type tracks.
|
46
46
|
attr_accessor :language_code
|
47
47
|
|
48
|
-
# The name of the track containing a human-readable description. The hls manifest will associate a subtitle text track with this value. For example, the value is \"English\" for subtitles text track for the `language_code` value of `en-US`. This parameter is set for
|
48
|
+
# The name of the track containing a human-readable description. The hls manifest will associate a subtitle text track with this value. For example, the value is \"English\" for subtitles text track for the `language_code` value of `en-US`. This parameter is only set for `text` type and `subtitles` text type tracks.
|
49
49
|
attr_accessor :name
|
50
50
|
|
51
|
-
# Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This parameter is set for
|
51
|
+
# Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH). This parameter is only set for `text` type and `subtitles` text type tracks.
|
52
52
|
attr_accessor :closed_captions
|
53
53
|
|
54
|
-
# Arbitrary user-supplied metadata set for the track either when creating the asset or track. This parameter is set for `text` type
|
54
|
+
# Arbitrary user-supplied metadata set for the track either when creating the asset or track. This parameter is only set for `text` type tracks. Max 255 characters.
|
55
55
|
attr_accessor :passthrough
|
56
56
|
|
57
|
+
# The status of the track. This parameter is only set for `text` type tracks.
|
58
|
+
attr_accessor :status
|
59
|
+
|
57
60
|
class EnumAttributeValidator
|
58
61
|
attr_reader :datatype
|
59
62
|
attr_reader :allowable_values
|
@@ -91,7 +94,8 @@ module MuxRuby
|
|
91
94
|
:'language_code' => :'language_code',
|
92
95
|
:'name' => :'name',
|
93
96
|
:'closed_captions' => :'closed_captions',
|
94
|
-
:'passthrough' => :'passthrough'
|
97
|
+
:'passthrough' => :'passthrough',
|
98
|
+
:'status' => :'status'
|
95
99
|
}
|
96
100
|
end
|
97
101
|
|
@@ -115,7 +119,8 @@ module MuxRuby
|
|
115
119
|
:'language_code' => :'String',
|
116
120
|
:'name' => :'String',
|
117
121
|
:'closed_captions' => :'Boolean',
|
118
|
-
:'passthrough' => :'String'
|
122
|
+
:'passthrough' => :'String',
|
123
|
+
:'status' => :'String'
|
119
124
|
}
|
120
125
|
end
|
121
126
|
|
@@ -191,6 +196,10 @@ module MuxRuby
|
|
191
196
|
if attributes.key?(:'passthrough')
|
192
197
|
self.passthrough = attributes[:'passthrough']
|
193
198
|
end
|
199
|
+
|
200
|
+
if attributes.key?(:'status')
|
201
|
+
self.status = attributes[:'status']
|
202
|
+
end
|
194
203
|
end
|
195
204
|
|
196
205
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -207,6 +216,8 @@ module MuxRuby
|
|
207
216
|
return false unless type_validator.valid?(@type)
|
208
217
|
text_type_validator = EnumAttributeValidator.new('String', ["subtitles"])
|
209
218
|
return false unless text_type_validator.valid?(@text_type)
|
219
|
+
status_validator = EnumAttributeValidator.new('String', ["preparing", "ready", "errored"])
|
220
|
+
return false unless status_validator.valid?(@status)
|
210
221
|
true
|
211
222
|
end
|
212
223
|
|
@@ -230,6 +241,16 @@ module MuxRuby
|
|
230
241
|
@text_type = text_type
|
231
242
|
end
|
232
243
|
|
244
|
+
# Custom attribute writer method checking allowed values (enum).
|
245
|
+
# @param [Object] status Object to be assigned
|
246
|
+
def status=(status)
|
247
|
+
validator = EnumAttributeValidator.new('String', ["preparing", "ready", "errored"])
|
248
|
+
unless validator.valid?(status)
|
249
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
250
|
+
end
|
251
|
+
@status = status
|
252
|
+
end
|
253
|
+
|
233
254
|
# Checks equality by comparing each attribute.
|
234
255
|
# @param [Object] Object to be compared
|
235
256
|
def ==(o)
|
@@ -247,7 +268,8 @@ module MuxRuby
|
|
247
268
|
language_code == o.language_code &&
|
248
269
|
name == o.name &&
|
249
270
|
closed_captions == o.closed_captions &&
|
250
|
-
passthrough == o.passthrough
|
271
|
+
passthrough == o.passthrough &&
|
272
|
+
status == o.status
|
251
273
|
end
|
252
274
|
|
253
275
|
# @see the `==` method
|
@@ -259,7 +281,7 @@ module MuxRuby
|
|
259
281
|
# Calculates hash code according to all attributes.
|
260
282
|
# @return [Integer] Hash code
|
261
283
|
def hash
|
262
|
-
[id, type, duration, max_width, max_height, max_frame_rate, max_channels, max_channel_layout, text_type, language_code, name, closed_captions, passthrough].hash
|
284
|
+
[id, type, duration, max_width, max_height, max_frame_rate, max_channels, max_channel_layout, text_type, language_code, name, closed_captions, passthrough, status].hash
|
263
285
|
end
|
264
286
|
|
265
287
|
# Builds the object from hash
|
@@ -24,6 +24,9 @@ module MuxRuby
|
|
24
24
|
# When live streaming software disconnects from Mux, either intentionally or due to a drop in the network, the Reconnect Window is the time in seconds that Mux should wait for the streaming software to reconnect before considering the live stream finished and completing the recorded asset.
|
25
25
|
attr_accessor :reconnect_window
|
26
26
|
|
27
|
+
# The time in seconds a live stream may be continuously active before being disconnected. Defaults to 12 hours.
|
28
|
+
attr_accessor :max_continuous_duration
|
29
|
+
|
27
30
|
class EnumAttributeValidator
|
28
31
|
attr_reader :datatype
|
29
32
|
attr_reader :allowable_values
|
@@ -51,7 +54,8 @@ module MuxRuby
|
|
51
54
|
{
|
52
55
|
:'passthrough' => :'passthrough',
|
53
56
|
:'latency_mode' => :'latency_mode',
|
54
|
-
:'reconnect_window' => :'reconnect_window'
|
57
|
+
:'reconnect_window' => :'reconnect_window',
|
58
|
+
:'max_continuous_duration' => :'max_continuous_duration'
|
55
59
|
}
|
56
60
|
end
|
57
61
|
|
@@ -65,7 +69,8 @@ module MuxRuby
|
|
65
69
|
{
|
66
70
|
:'passthrough' => :'String',
|
67
71
|
:'latency_mode' => :'String',
|
68
|
-
:'reconnect_window' => :'Float'
|
72
|
+
:'reconnect_window' => :'Float',
|
73
|
+
:'max_continuous_duration' => :'Integer'
|
69
74
|
}
|
70
75
|
end
|
71
76
|
|
@@ -101,6 +106,12 @@ module MuxRuby
|
|
101
106
|
if attributes.key?(:'reconnect_window')
|
102
107
|
self.reconnect_window = attributes[:'reconnect_window']
|
103
108
|
end
|
109
|
+
|
110
|
+
if attributes.key?(:'max_continuous_duration')
|
111
|
+
self.max_continuous_duration = attributes[:'max_continuous_duration']
|
112
|
+
else
|
113
|
+
self.max_continuous_duration = 43200
|
114
|
+
end
|
104
115
|
end
|
105
116
|
|
106
117
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -115,6 +126,14 @@ module MuxRuby
|
|
115
126
|
invalid_properties.push('invalid value for "reconnect_window", must be greater than or equal to 0.1.')
|
116
127
|
end
|
117
128
|
|
129
|
+
if !@max_continuous_duration.nil? && @max_continuous_duration > 43200
|
130
|
+
invalid_properties.push('invalid value for "max_continuous_duration", must be smaller than or equal to 43200.')
|
131
|
+
end
|
132
|
+
|
133
|
+
if !@max_continuous_duration.nil? && @max_continuous_duration < 60
|
134
|
+
invalid_properties.push('invalid value for "max_continuous_duration", must be greater than or equal to 60.')
|
135
|
+
end
|
136
|
+
|
118
137
|
invalid_properties
|
119
138
|
end
|
120
139
|
|
@@ -125,6 +144,8 @@ module MuxRuby
|
|
125
144
|
return false unless latency_mode_validator.valid?(@latency_mode)
|
126
145
|
return false if !@reconnect_window.nil? && @reconnect_window > 300
|
127
146
|
return false if !@reconnect_window.nil? && @reconnect_window < 0.1
|
147
|
+
return false if !@max_continuous_duration.nil? && @max_continuous_duration > 43200
|
148
|
+
return false if !@max_continuous_duration.nil? && @max_continuous_duration < 60
|
128
149
|
true
|
129
150
|
end
|
130
151
|
|
@@ -152,6 +173,20 @@ module MuxRuby
|
|
152
173
|
@reconnect_window = reconnect_window
|
153
174
|
end
|
154
175
|
|
176
|
+
# Custom attribute writer method with validation
|
177
|
+
# @param [Object] max_continuous_duration Value to be assigned
|
178
|
+
def max_continuous_duration=(max_continuous_duration)
|
179
|
+
if !max_continuous_duration.nil? && max_continuous_duration > 43200
|
180
|
+
fail ArgumentError, 'invalid value for "max_continuous_duration", must be smaller than or equal to 43200.'
|
181
|
+
end
|
182
|
+
|
183
|
+
if !max_continuous_duration.nil? && max_continuous_duration < 60
|
184
|
+
fail ArgumentError, 'invalid value for "max_continuous_duration", must be greater than or equal to 60.'
|
185
|
+
end
|
186
|
+
|
187
|
+
@max_continuous_duration = max_continuous_duration
|
188
|
+
end
|
189
|
+
|
155
190
|
# Checks equality by comparing each attribute.
|
156
191
|
# @param [Object] Object to be compared
|
157
192
|
def ==(o)
|
@@ -159,7 +194,8 @@ module MuxRuby
|
|
159
194
|
self.class == o.class &&
|
160
195
|
passthrough == o.passthrough &&
|
161
196
|
latency_mode == o.latency_mode &&
|
162
|
-
reconnect_window == o.reconnect_window
|
197
|
+
reconnect_window == o.reconnect_window &&
|
198
|
+
max_continuous_duration == o.max_continuous_duration
|
163
199
|
end
|
164
200
|
|
165
201
|
# @see the `==` method
|
@@ -171,7 +207,7 @@ module MuxRuby
|
|
171
207
|
# Calculates hash code according to all attributes.
|
172
208
|
# @return [Integer] Hash code
|
173
209
|
def hash
|
174
|
-
[passthrough, latency_mode, reconnect_window].hash
|
210
|
+
[passthrough, latency_mode, reconnect_window, max_continuous_duration].hash
|
175
211
|
end
|
176
212
|
|
177
213
|
# Builds the object from hash
|
@@ -14,196 +14,91 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module MuxRuby
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# Returns all the JSON keys this model knows about
|
25
|
-
def self.acceptable_attributes
|
26
|
-
attribute_map.values
|
27
|
-
end
|
28
|
-
|
29
|
-
# Attribute type mapping.
|
30
|
-
def self.openapi_types
|
31
|
-
{
|
32
|
-
}
|
33
|
-
end
|
34
|
-
|
35
|
-
# List of attributes with nullable: true
|
36
|
-
def self.openapi_nullable
|
37
|
-
Set.new([
|
38
|
-
])
|
39
|
-
end
|
40
|
-
|
41
|
-
# Initializes the object
|
42
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
-
def initialize(attributes = {})
|
44
|
-
if (!attributes.is_a?(Hash))
|
45
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::UpdateReferrerDomainRestrictionRequest` initialize method"
|
17
|
+
module UpdateReferrerDomainRestrictionRequest
|
18
|
+
class << self
|
19
|
+
# List of class defined in oneOf (OpenAPI v3)
|
20
|
+
def openapi_one_of
|
21
|
+
[
|
22
|
+
:'ReferrerDomainRestriction'
|
23
|
+
]
|
46
24
|
end
|
47
25
|
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
# @return true if the model is valid
|
66
|
-
def valid?
|
67
|
-
true
|
68
|
-
end
|
69
|
-
|
70
|
-
# Checks equality by comparing each attribute.
|
71
|
-
# @param [Object] Object to be compared
|
72
|
-
def ==(o)
|
73
|
-
return true if self.equal?(o)
|
74
|
-
self.class == o.class
|
75
|
-
end
|
76
|
-
|
77
|
-
# @see the `==` method
|
78
|
-
# @param [Object] Object to be compared
|
79
|
-
def eql?(o)
|
80
|
-
self == o
|
81
|
-
end
|
82
|
-
|
83
|
-
# Calculates hash code according to all attributes.
|
84
|
-
# @return [Integer] Hash code
|
85
|
-
def hash
|
86
|
-
[].hash
|
87
|
-
end
|
88
|
-
|
89
|
-
# Builds the object from hash
|
90
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
-
# @return [Object] Returns the model itself
|
92
|
-
def self.build_from_hash(attributes)
|
93
|
-
new.build_from_hash(attributes)
|
94
|
-
end
|
95
|
-
|
96
|
-
# Builds the object from hash
|
97
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
-
# @return [Object] Returns the model itself
|
99
|
-
def build_from_hash(attributes)
|
100
|
-
return nil unless attributes.is_a?(Hash)
|
101
|
-
self.class.openapi_types.each_pair do |key, type|
|
102
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
103
|
-
self.send("#{key}=", nil)
|
104
|
-
elsif type =~ /\AArray<(.*)>/i
|
105
|
-
# check to ensure the input is an array given that the attribute
|
106
|
-
# is documented as an array but the input is not
|
107
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
108
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
26
|
+
# Builds the object
|
27
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
28
|
+
# @return [Object] Returns the model or the data itself
|
29
|
+
def build(data)
|
30
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
31
|
+
# Note:
|
32
|
+
# - We do not attempt to check whether exactly one item matches.
|
33
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
34
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
35
|
+
# - TODO: scalar values are defacto behaving as if they were nullable.
|
36
|
+
# - TODO: logging when debugging is set.
|
37
|
+
openapi_one_of.each do |klass|
|
38
|
+
begin
|
39
|
+
next if klass == :AnyType # "nullable: true"
|
40
|
+
typed_data = find_and_cast_into_type(klass, data)
|
41
|
+
return typed_data if typed_data
|
42
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
109
43
|
end
|
110
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
111
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
112
44
|
end
|
113
|
-
end
|
114
45
|
|
115
|
-
|
116
|
-
end
|
117
|
-
|
118
|
-
# Deserializes the data based on type
|
119
|
-
# @param string type Data type
|
120
|
-
# @param string value Value to be deserialized
|
121
|
-
# @return [Object] Deserialized data
|
122
|
-
def _deserialize(type, value)
|
123
|
-
case type.to_sym
|
124
|
-
when :Time
|
125
|
-
Time.parse(value)
|
126
|
-
when :Date
|
127
|
-
Date.parse(value)
|
128
|
-
when :String
|
129
|
-
value.to_s
|
130
|
-
when :Integer
|
131
|
-
value.to_i
|
132
|
-
when :Float
|
133
|
-
value.to_f
|
134
|
-
when :Boolean
|
135
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
136
|
-
true
|
137
|
-
else
|
138
|
-
false
|
139
|
-
end
|
140
|
-
when :Object
|
141
|
-
# generic object (usually a Hash), return directly
|
142
|
-
value
|
143
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
144
|
-
inner_type = Regexp.last_match[:inner_type]
|
145
|
-
value.map { |v| _deserialize(inner_type, v) }
|
146
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
147
|
-
k_type = Regexp.last_match[:k_type]
|
148
|
-
v_type = Regexp.last_match[:v_type]
|
149
|
-
{}.tap do |hash|
|
150
|
-
value.each do |k, v|
|
151
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
else # model
|
155
|
-
# models (e.g. Pet) or oneOf
|
156
|
-
klass = MuxRuby.const_get(type)
|
157
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
46
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
158
47
|
end
|
159
|
-
end
|
160
|
-
|
161
|
-
# Returns the string representation of the object
|
162
|
-
# @return [String] String presentation of the object
|
163
|
-
def to_s
|
164
|
-
to_hash.to_s
|
165
|
-
end
|
166
48
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
49
|
+
private
|
50
|
+
|
51
|
+
SchemaMismatchError = Class.new(StandardError)
|
52
|
+
|
53
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
54
|
+
def find_and_cast_into_type(klass, data)
|
55
|
+
return if data.nil?
|
56
|
+
|
57
|
+
case klass.to_s
|
58
|
+
when 'Boolean'
|
59
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
60
|
+
when 'Float'
|
61
|
+
return data if data.instance_of?(Float)
|
62
|
+
when 'Integer'
|
63
|
+
return data if data.instance_of?(Integer)
|
64
|
+
when 'Time'
|
65
|
+
return Time.parse(data)
|
66
|
+
when 'Date'
|
67
|
+
return Date.parse(data)
|
68
|
+
when 'String'
|
69
|
+
return data if data.instance_of?(String)
|
70
|
+
when 'Object' # "type: object"
|
71
|
+
return data if data.instance_of?(Hash)
|
72
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
73
|
+
if data.instance_of?(Array)
|
74
|
+
sub_type = Regexp.last_match[:sub_type]
|
75
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
76
|
+
end
|
77
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
78
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
79
|
+
sub_type = Regexp.last_match[:sub_type]
|
80
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
81
|
+
end
|
82
|
+
else # model
|
83
|
+
const = MuxRuby.const_get(klass)
|
84
|
+
if const
|
85
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
86
|
+
model = const.build(data)
|
87
|
+
return model if model
|
88
|
+
else
|
89
|
+
# raise if data contains keys that are not known to the model
|
90
|
+
raise unless (data.keys - const.acceptable_attributes).empty?
|
91
|
+
model = const.build_from_hash(data)
|
92
|
+
return model if model && model.valid?
|
93
|
+
end
|
94
|
+
end
|
182
95
|
end
|
183
96
|
|
184
|
-
|
97
|
+
raise # if no match by now, raise
|
98
|
+
rescue
|
99
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
185
100
|
end
|
186
|
-
hash
|
187
101
|
end
|
188
|
-
|
189
|
-
# Outputs non-array value in the form of hash
|
190
|
-
# For object, use to_hash. Otherwise, just return the value
|
191
|
-
# @param [Object] value Any valid value
|
192
|
-
# @return [Hash] Returns the value in the form of hash
|
193
|
-
def _to_hash(value)
|
194
|
-
if value.is_a?(Array)
|
195
|
-
value.compact.map { |v| _to_hash(v) }
|
196
|
-
elsif value.is_a?(Hash)
|
197
|
-
{}.tap do |hash|
|
198
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
199
|
-
end
|
200
|
-
elsif value.respond_to? :to_hash
|
201
|
-
value.to_hash
|
202
|
-
else
|
203
|
-
value
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
102
|
end
|
208
103
|
|
209
104
|
end
|
@@ -515,6 +515,109 @@ module MuxRuby
|
|
515
515
|
# List of attributes with nullable: true
|
516
516
|
def self.openapi_nullable
|
517
517
|
Set.new([
|
518
|
+
:'view_total_upscaling',
|
519
|
+
:'preroll_ad_asset_hostname',
|
520
|
+
:'player_source_domain',
|
521
|
+
:'region',
|
522
|
+
:'viewer_user_agent',
|
523
|
+
:'preroll_requested',
|
524
|
+
:'page_type',
|
525
|
+
:'startup_score',
|
526
|
+
:'view_seek_duration',
|
527
|
+
:'country_name',
|
528
|
+
:'player_source_height',
|
529
|
+
:'longitude',
|
530
|
+
:'buffering_count',
|
531
|
+
:'video_duration',
|
532
|
+
:'player_source_type',
|
533
|
+
:'city',
|
534
|
+
:'platform_description',
|
535
|
+
:'video_startup_preroll_request_time',
|
536
|
+
:'viewer_device_name',
|
537
|
+
:'video_series',
|
538
|
+
:'viewer_application_name',
|
539
|
+
:'view_total_content_playback_time',
|
540
|
+
:'cdn',
|
541
|
+
:'player_instance_id',
|
542
|
+
:'video_language',
|
543
|
+
:'player_source_width',
|
544
|
+
:'player_error_message',
|
545
|
+
:'player_mux_plugin_version',
|
546
|
+
:'playback_score',
|
547
|
+
:'page_url',
|
548
|
+
:'metro',
|
549
|
+
:'view_max_request_latency',
|
550
|
+
:'requests_for_first_preroll',
|
551
|
+
:'view_total_downscaling',
|
552
|
+
:'latitude',
|
553
|
+
:'player_source_host_name',
|
554
|
+
:'mux_embed_version',
|
555
|
+
:'player_language',
|
556
|
+
:'page_load_time',
|
557
|
+
:'viewer_device_category',
|
558
|
+
:'video_startup_preroll_load_time',
|
559
|
+
:'player_version',
|
560
|
+
:'watch_time',
|
561
|
+
:'player_source_stream_type',
|
562
|
+
:'preroll_ad_tag_hostname',
|
563
|
+
:'viewer_device_manufacturer',
|
564
|
+
:'rebuffering_score',
|
565
|
+
:'experiment_name',
|
566
|
+
:'viewer_os_version',
|
567
|
+
:'buffering_duration',
|
568
|
+
:'player_view_count',
|
569
|
+
:'player_software',
|
570
|
+
:'player_load_time',
|
571
|
+
:'platform_summary',
|
572
|
+
:'video_encoding_variant',
|
573
|
+
:'player_width',
|
574
|
+
:'view_seek_count',
|
575
|
+
:'viewer_experience_score',
|
576
|
+
:'view_error_id',
|
577
|
+
:'video_variant_name',
|
578
|
+
:'preroll_played',
|
579
|
+
:'viewer_application_engine',
|
580
|
+
:'viewer_os_architecture',
|
581
|
+
:'player_error_code',
|
582
|
+
:'buffering_rate',
|
583
|
+
:'player_name',
|
584
|
+
:'view_average_request_throughput',
|
585
|
+
:'video_producer',
|
586
|
+
:'error_type_id',
|
587
|
+
:'video_id',
|
588
|
+
:'continent_code',
|
589
|
+
:'video_content_type',
|
590
|
+
:'viewer_os_family',
|
591
|
+
:'player_poster',
|
592
|
+
:'view_average_request_latency',
|
593
|
+
:'video_variant_id',
|
594
|
+
:'player_source_duration',
|
595
|
+
:'player_source_url',
|
596
|
+
:'video_title',
|
597
|
+
:'rebuffer_percentage',
|
598
|
+
:'time_to_first_frame',
|
599
|
+
:'viewer_user_id',
|
600
|
+
:'video_stream_type',
|
601
|
+
:'player_startup_time',
|
602
|
+
:'viewer_application_version',
|
603
|
+
:'view_max_downscale_percentage',
|
604
|
+
:'view_max_upscale_percentage',
|
605
|
+
:'country_code',
|
606
|
+
:'isp',
|
607
|
+
:'player_height',
|
608
|
+
:'asn',
|
609
|
+
:'asn_name',
|
610
|
+
:'quality_score',
|
611
|
+
:'player_software_version',
|
612
|
+
:'player_mux_plugin_name',
|
613
|
+
:'sub_property_id',
|
614
|
+
:'player_remote_played',
|
615
|
+
:'view_max_playhead_position',
|
616
|
+
:'view_playing_time',
|
617
|
+
:'view_session_id',
|
618
|
+
:'viewer_connection_type',
|
619
|
+
:'viewer_device_model',
|
620
|
+
:'weighted_average_bitrate'
|
518
621
|
])
|
519
622
|
end
|
520
623
|
|
data/lib/mux_ruby/version.rb
CHANGED