Class: MuxRuby::Asset
- Inherits:
-
Object
- Object
- MuxRuby::Asset
- Defined in:
- lib/mux_ruby/models/asset.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#aspect_ratio ⇒ Object
The aspect ratio of the asset in the form of
width:height, for example16:9. -
#created_at ⇒ Object
Time the Asset was created, defined as a Unix timestamp (seconds since epoch).
-
#duration ⇒ Object
The duration of the asset in seconds (max duration for a single asset is 12 hours).
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#id ⇒ Object
Unique identifier for the Asset.
-
#is_live ⇒ Object
Whether the asset is created from a live stream and the live stream is currently
activeand not inidlestate. -
#live_stream_id ⇒ Object
Unique identifier for the live stream.
-
#master ⇒ Object
Returns the value of attribute master.
-
#master_access ⇒ Object
Returns the value of attribute master_access.
-
#max_stored_frame_rate ⇒ Object
The maximum frame rate that has been stored for the asset.
-
#max_stored_resolution ⇒ Object
The maximum resolution that has been stored for the asset.
-
#mp4_support ⇒ Object
Returns the value of attribute mp4_support.
-
#non_standard_input_reasons ⇒ Object
Returns the value of attribute non_standard_input_reasons.
-
#normalize_audio ⇒ Object
Normalize the audio track loudness level.
-
#passthrough ⇒ Object
Arbitrary metadata set for the asset.
-
#per_title_encode ⇒ Object
Returns the value of attribute per_title_encode.
-
#playback_ids ⇒ Object
An array of Playback ID objects.
-
#recording_times ⇒ Object
An array of individual live stream recording sessions.
-
#source_asset_id ⇒ Object
Asset Identifier of the video used as the source for creating the clip.
-
#static_renditions ⇒ Object
Returns the value of attribute static_renditions.
-
#status ⇒ Object
The status of the asset.
-
#test ⇒ Object
True means this live stream is a test asset.
-
#tracks ⇒ Object
The individual media tracks that make up an asset.
-
#upload_id ⇒ Object
Unique identifier for the Direct Upload.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Asset
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ Asset
Initializes the object
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/mux_ruby/models/asset.rb', line 178 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::Asset` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::Asset`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'status') self.status = attributes[:'status'] end if attributes.key?(:'duration') self.duration = attributes[:'duration'] end if attributes.key?(:'max_stored_resolution') self.max_stored_resolution = attributes[:'max_stored_resolution'] end if attributes.key?(:'max_stored_frame_rate') self.max_stored_frame_rate = attributes[:'max_stored_frame_rate'] end if attributes.key?(:'aspect_ratio') self.aspect_ratio = attributes[:'aspect_ratio'] end if attributes.key?(:'playback_ids') if (value = attributes[:'playback_ids']).is_a?(Array) self.playback_ids = value end end if attributes.key?(:'tracks') if (value = attributes[:'tracks']).is_a?(Array) self.tracks = value end end if attributes.key?(:'errors') self.errors = attributes[:'errors'] end if attributes.key?(:'per_title_encode') self.per_title_encode = attributes[:'per_title_encode'] end if attributes.key?(:'upload_id') self.upload_id = attributes[:'upload_id'] end if attributes.key?(:'is_live') self.is_live = attributes[:'is_live'] end if attributes.key?(:'passthrough') self.passthrough = attributes[:'passthrough'] end if attributes.key?(:'live_stream_id') self.live_stream_id = attributes[:'live_stream_id'] end if attributes.key?(:'master') self.master = attributes[:'master'] end if attributes.key?(:'master_access') self.master_access = attributes[:'master_access'] else self.master_access = 'none' end if attributes.key?(:'mp4_support') self.mp4_support = attributes[:'mp4_support'] else self.mp4_support = 'none' end if attributes.key?(:'source_asset_id') self.source_asset_id = attributes[:'source_asset_id'] end if attributes.key?(:'normalize_audio') self.normalize_audio = attributes[:'normalize_audio'] else self.normalize_audio = false end if attributes.key?(:'static_renditions') self.static_renditions = attributes[:'static_renditions'] end if attributes.key?(:'recording_times') if (value = attributes[:'recording_times']).is_a?(Array) self.recording_times = value end end if attributes.key?(:'non_standard_input_reasons') self.non_standard_input_reasons = attributes[:'non_standard_input_reasons'] end if attributes.key?(:'test') self.test = attributes[:'test'] end end |
Instance Attribute Details
#aspect_ratio ⇒ Object
The aspect ratio of the asset in the form of width:height, for example 16:9.
37 38 39 |
# File 'lib/mux_ruby/models/asset.rb', line 37 def aspect_ratio @aspect_ratio end |
#created_at ⇒ Object
Time the Asset was created, defined as a Unix timestamp (seconds since epoch).
22 23 24 |
# File 'lib/mux_ruby/models/asset.rb', line 22 def created_at @created_at end |
#duration ⇒ Object
The duration of the asset in seconds (max duration for a single asset is 12 hours).
28 29 30 |
# File 'lib/mux_ruby/models/asset.rb', line 28 def duration @duration end |
#errors ⇒ Object
Returns the value of attribute errors.
45 46 47 |
# File 'lib/mux_ruby/models/asset.rb', line 45 def errors @errors end |
#id ⇒ Object
Unique identifier for the Asset. Max 255 characters.
19 20 21 |
# File 'lib/mux_ruby/models/asset.rb', line 19 def id @id end |
#is_live ⇒ Object
Whether the asset is created from a live stream and the live stream is currently active and not in idle state.
53 54 55 |
# File 'lib/mux_ruby/models/asset.rb', line 53 def is_live @is_live end |
#live_stream_id ⇒ Object
Unique identifier for the live stream. This is an optional parameter added when the asset is created from a live stream.
59 60 61 |
# File 'lib/mux_ruby/models/asset.rb', line 59 def live_stream_id @live_stream_id end |
#master ⇒ Object
Returns the value of attribute master.
61 62 63 |
# File 'lib/mux_ruby/models/asset.rb', line 61 def master @master end |
#master_access ⇒ Object
Returns the value of attribute master_access.
63 64 65 |
# File 'lib/mux_ruby/models/asset.rb', line 63 def master_access @master_access end |
#max_stored_frame_rate ⇒ Object
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.
34 35 36 |
# File 'lib/mux_ruby/models/asset.rb', line 34 def max_stored_frame_rate @max_stored_frame_rate end |
#max_stored_resolution ⇒ Object
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.
31 32 33 |
# File 'lib/mux_ruby/models/asset.rb', line 31 def max_stored_resolution @max_stored_resolution end |
#mp4_support ⇒ Object
Returns the value of attribute mp4_support.
65 66 67 |
# File 'lib/mux_ruby/models/asset.rb', line 65 def mp4_support @mp4_support end |
#non_standard_input_reasons ⇒ Object
Returns the value of attribute non_standard_input_reasons.
78 79 80 |
# File 'lib/mux_ruby/models/asset.rb', line 78 def non_standard_input_reasons @non_standard_input_reasons end |
#normalize_audio ⇒ Object
Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
71 72 73 |
# File 'lib/mux_ruby/models/asset.rb', line 71 def normalize_audio @normalize_audio end |
#passthrough ⇒ Object
Arbitrary metadata set for the asset. Max 255 characters.
56 57 58 |
# File 'lib/mux_ruby/models/asset.rb', line 56 def passthrough @passthrough end |
#per_title_encode ⇒ Object
Returns the value of attribute per_title_encode.
47 48 49 |
# File 'lib/mux_ruby/models/asset.rb', line 47 def per_title_encode @per_title_encode end |
#playback_ids ⇒ Object
An array of Playback ID objects. Use these to create HLS playback URLs. See [Play your videos](docs.mux.com/guides/video/play-your-videos) for more details.
40 41 42 |
# File 'lib/mux_ruby/models/asset.rb', line 40 def playback_ids @playback_ids end |
#recording_times ⇒ Object
An array of individual live stream recording sessions. A recording session is created on each encoder connection during the live stream
76 77 78 |
# File 'lib/mux_ruby/models/asset.rb', line 76 def recording_times @recording_times end |
#source_asset_id ⇒ Object
Asset Identifier of the video used as the source for creating the clip.
68 69 70 |
# File 'lib/mux_ruby/models/asset.rb', line 68 def source_asset_id @source_asset_id end |
#static_renditions ⇒ Object
Returns the value of attribute static_renditions.
73 74 75 |
# File 'lib/mux_ruby/models/asset.rb', line 73 def static_renditions @static_renditions end |
#status ⇒ Object
The status of the asset.
25 26 27 |
# File 'lib/mux_ruby/models/asset.rb', line 25 def status @status end |
#test ⇒ Object
True means this live stream is a test asset. 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.
81 82 83 |
# File 'lib/mux_ruby/models/asset.rb', line 81 def test @test end |
#tracks ⇒ Object
The individual media tracks that make up an asset.
43 44 45 |
# File 'lib/mux_ruby/models/asset.rb', line 43 def tracks @tracks end |
#upload_id ⇒ Object
Unique identifier for the Direct Upload. This is an optional parameter added when the asset is created from a direct upload.
50 51 52 |
# File 'lib/mux_ruby/models/asset.rb', line 50 def upload_id @upload_id end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
136 137 138 |
# File 'lib/mux_ruby/models/asset.rb', line 136 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/mux_ruby/models/asset.rb', line 106 def self.attribute_map { :'id' => :'id', :'created_at' => :'created_at', :'status' => :'status', :'duration' => :'duration', :'max_stored_resolution' => :'max_stored_resolution', :'max_stored_frame_rate' => :'max_stored_frame_rate', :'aspect_ratio' => :'aspect_ratio', :'playback_ids' => :'playback_ids', :'tracks' => :'tracks', :'errors' => :'errors', :'per_title_encode' => :'per_title_encode', :'upload_id' => :'upload_id', :'is_live' => :'is_live', :'passthrough' => :'passthrough', :'live_stream_id' => :'live_stream_id', :'master' => :'master', :'master_access' => :'master_access', :'mp4_support' => :'mp4_support', :'source_asset_id' => :'source_asset_id', :'normalize_audio' => :'normalize_audio', :'static_renditions' => :'static_renditions', :'recording_times' => :'recording_times', :'non_standard_input_reasons' => :'non_standard_input_reasons', :'test' => :'test' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
407 408 409 |
# File 'lib/mux_ruby/models/asset.rb', line 407 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
171 172 173 174 |
# File 'lib/mux_ruby/models/asset.rb', line 171 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/mux_ruby/models/asset.rb', line 141 def self.openapi_types { :'id' => :'String', :'created_at' => :'String', :'status' => :'String', :'duration' => :'Float', :'max_stored_resolution' => :'String', :'max_stored_frame_rate' => :'Float', :'aspect_ratio' => :'String', :'playback_ids' => :'Array<PlaybackID>', :'tracks' => :'Array<Track>', :'errors' => :'AssetErrors', :'per_title_encode' => :'Boolean', :'upload_id' => :'String', :'is_live' => :'Boolean', :'passthrough' => :'String', :'live_stream_id' => :'String', :'master' => :'AssetMaster', :'master_access' => :'String', :'mp4_support' => :'String', :'source_asset_id' => :'String', :'normalize_audio' => :'Boolean', :'static_renditions' => :'AssetStaticRenditions', :'recording_times' => :'Array<AssetRecordingTimes>', :'non_standard_input_reasons' => :'AssetNonStandardInputReasons', :'test' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
# File 'lib/mux_ruby/models/asset.rb', line 363 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && created_at == o.created_at && status == o.status && duration == o.duration && max_stored_resolution == o.max_stored_resolution && max_stored_frame_rate == o.max_stored_frame_rate && aspect_ratio == o.aspect_ratio && playback_ids == o.playback_ids && tracks == o.tracks && errors == o.errors && per_title_encode == o.per_title_encode && upload_id == o.upload_id && is_live == o.is_live && passthrough == o.passthrough && live_stream_id == o.live_stream_id && master == o.master && master_access == o.master_access && mp4_support == o.mp4_support && source_asset_id == o.source_asset_id && normalize_audio == o.normalize_audio && static_renditions == o.static_renditions && recording_times == o.recording_times && non_standard_input_reasons == o.non_standard_input_reasons && test == o.test end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/mux_ruby/models/asset.rb', line 437 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = MuxRuby.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/mux_ruby/models/asset.rb', line 508 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 |
# File 'lib/mux_ruby/models/asset.rb', line 414 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
394 395 396 |
# File 'lib/mux_ruby/models/asset.rb', line 394 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
400 401 402 |
# File 'lib/mux_ruby/models/asset.rb', line 400 def hash [id, created_at, status, duration, max_stored_resolution, max_stored_frame_rate, aspect_ratio, playback_ids, tracks, errors, per_title_encode, upload_id, 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 end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
302 303 304 305 |
# File 'lib/mux_ruby/models/asset.rb', line 302 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
484 485 486 |
# File 'lib/mux_ruby/models/asset.rb', line 484 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/mux_ruby/models/asset.rb', line 490 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
478 479 480 |
# File 'lib/mux_ruby/models/asset.rb', line 478 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/mux_ruby/models/asset.rb', line 309 def valid? status_validator = EnumAttributeValidator.new('String', ["preparing", "ready", "errored"]) return false unless status_validator.valid?(@status) max_stored_resolution_validator = EnumAttributeValidator.new('String', ["Audio only", "SD", "HD", "FHD", "UHD"]) return false unless max_stored_resolution_validator.valid?(@max_stored_resolution) master_access_validator = EnumAttributeValidator.new('String', ["temporary", "none"]) return false unless master_access_validator.valid?(@master_access) mp4_support_validator = EnumAttributeValidator.new('String', ["standard", "none"]) return false unless mp4_support_validator.valid?(@mp4_support) true end |