mux_ruby 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/docs/Asset.md +13 -12
  4. data/docs/AssetErrors.md +2 -2
  5. data/docs/AssetNonStandardInputReasons.md +9 -9
  6. data/docs/AssetRecordingTimes.md +2 -2
  7. data/docs/AssetStaticRenditions.md +1 -1
  8. data/docs/AssetsApi.md +4 -0
  9. data/docs/CreateAssetRequest.md +6 -6
  10. data/docs/CreateTrackRequest.md +4 -4
  11. data/docs/GetAssetOrLiveStreamIdResponse.md +8 -0
  12. data/docs/GetAssetOrLiveStreamIdResponseData.md +10 -0
  13. data/docs/GetAssetOrLiveStreamIdResponseDataObject.md +9 -0
  14. data/docs/InputSettings.md +9 -7
  15. data/docs/InputSettingsOverlaySettings.md +7 -7
  16. data/docs/PlaybackID.md +1 -1
  17. data/docs/PlaybackIDApi.md +60 -0
  18. data/docs/Track.md +13 -13
  19. data/examples/video/exercise-assets.rb +21 -0
  20. data/examples/video/exercise-live-streams.rb +8 -0
  21. data/lib/mux_ruby.rb +4 -0
  22. data/lib/mux_ruby/api/assets_api.rb +4 -0
  23. data/lib/mux_ruby/api/playback_id_api.rb +69 -0
  24. data/lib/mux_ruby/api_client.rb +12 -12
  25. data/lib/mux_ruby/models/asset.rb +38 -4
  26. data/lib/mux_ruby/models/asset_errors.rb +2 -0
  27. data/lib/mux_ruby/models/asset_master.rb +35 -0
  28. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +13 -13
  29. data/lib/mux_ruby/models/asset_recording_times.rb +2 -2
  30. data/lib/mux_ruby/models/asset_static_renditions.rb +2 -2
  31. data/lib/mux_ruby/models/asset_static_renditions_files.rb +2 -2
  32. data/lib/mux_ruby/models/create_asset_request.rb +8 -2
  33. data/lib/mux_ruby/models/create_track_request.rb +6 -2
  34. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response.rb +184 -0
  35. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data.rb +203 -0
  36. data/lib/mux_ruby/models/get_asset_or_live_stream_id_response_data_object.rb +230 -0
  37. data/lib/mux_ruby/models/input_settings.rb +31 -4
  38. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +10 -2
  39. data/lib/mux_ruby/models/playback_id.rb +1 -0
  40. data/lib/mux_ruby/models/simulcast_target.rb +1 -1
  41. data/lib/mux_ruby/models/track.rb +27 -2
  42. data/lib/mux_ruby/models/update_asset_master_access_request.rb +1 -1
  43. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +1 -1
  44. data/lib/mux_ruby/models/upload.rb +1 -1
  45. data/lib/mux_ruby/version.rb +1 -1
  46. data/mux_ruby.gemspec +2 -0
  47. data/spec/api/assets_api_spec.rb +2 -0
  48. data/spec/api/playback_id_api_spec.rb +40 -0
  49. data/spec/models/asset_master_spec.rb +4 -0
  50. data/spec/models/asset_spec.rb +10 -0
  51. data/spec/models/get_asset_or_live_stream_id_response_data_object_spec.rb +44 -0
  52. data/spec/models/get_asset_or_live_stream_id_response_data_spec.rb +46 -0
  53. data/spec/models/get_asset_or_live_stream_id_response_spec.rb +34 -0
  54. data/spec/models/input_settings_spec.rb +12 -0
  55. data/spec/models/track_spec.rb +4 -0
  56. metadata +106 -89
@@ -7,7 +7,7 @@ require 'date'
7
7
 
8
8
  module MuxRuby
9
9
  class AssetStaticRenditions
10
- # * `ready`: All MP4s are downloadable * `preparing`: We are preparing the MP4s * `disabled`: MP4 support was not requested or has been removed * `errored`: There was a Mux internal error that prevented the MP4s from being created
10
+ # Indicates the status of downloadable MP4 versions of this asset.
11
11
  attr_accessor :status
12
12
 
13
13
  attr_accessor :files
@@ -91,7 +91,7 @@ module MuxRuby
91
91
  def status=(status)
92
92
  validator = EnumAttributeValidator.new('String', ['ready', 'preparing', 'disabled', 'errored'])
93
93
  unless validator.valid?(status)
94
- fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
94
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
95
95
  end
96
96
  @status = status
97
97
  end
@@ -124,7 +124,7 @@ module MuxRuby
124
124
  def name=(name)
125
125
  validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4', 'audio.m4a'])
126
126
  unless validator.valid?(name)
127
- fail ArgumentError, 'invalid value for "name", must be one of #{validator.allowable_values}.'
127
+ fail ArgumentError, "invalid value for \"name\", must be one of #{validator.allowable_values}."
128
128
  end
129
129
  @name = name
130
130
  end
@@ -134,7 +134,7 @@ module MuxRuby
134
134
  def ext=(ext)
135
135
  validator = EnumAttributeValidator.new('String', ['mp4', 'm4a'])
136
136
  unless validator.valid?(ext)
137
- fail ArgumentError, 'invalid value for "ext", must be one of #{validator.allowable_values}.'
137
+ fail ArgumentError, "invalid value for \"ext\", must be one of #{validator.allowable_values}."
138
138
  end
139
139
  @ext = ext
140
140
  end
@@ -7,21 +7,27 @@ require 'date'
7
7
 
8
8
  module MuxRuby
9
9
  class CreateAssetRequest
10
+ # An array of objects that each describe an input file to be used to create the asset. As a shortcut, input can also be a string URL for a file when only one input file is used. See `input[].url` for requirements.
10
11
  attr_accessor :input
11
12
 
13
+ # An array of playback policy names that you want applied to this asset and available through `playback_ids`. Options include: `\"public\"` (anyone with the playback URL can stream the asset). And `\"signed\"` (an additional access token is required to play the asset). If no playback_policy is set, the asset will have no playback IDs and will therefore not be playable. For simplicity, a single string name can be used in place of the array in the case of only one playback policy.
12
14
  attr_accessor :playback_policy
13
15
 
14
16
  attr_accessor :per_title_encode
15
17
 
18
+ # Arbitrary metadata that will be included in the asset details and related webhooks. Can be used to store your own ID for a video along with the asset. **Max: 255 characters**.
16
19
  attr_accessor :passthrough
17
20
 
21
+ # Specify what level (if any) of support for mp4 playback. In most cases you should use our default HLS-based streaming playback ({playback_id}.m3u8) which can automatically adjust to viewers' connection speeds, but an mp4 can be useful for some legacy devices or downloading for offline playback. See the [Download your vidoes guide](/guides/video/download-your-videos) for more information.
18
22
  attr_accessor :mp4_support
19
23
 
20
24
  # Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
21
25
  attr_accessor :normalize_audio
22
26
 
27
+ # Specify what level (if any) of support for master access. Master access can be enabled temporarily for your asset to be downloaded. See the [Download your vidoes guide](/guides/video/download-your-videos) for more information.
23
28
  attr_accessor :master_access
24
29
 
30
+ # Marks the asset as a test asset when the value is set to 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 asset are watermarked with the Mux logo, limited to 10 seconds, deleted after 24 hrs.
25
31
  attr_accessor :test
26
32
 
27
33
  class EnumAttributeValidator
@@ -143,7 +149,7 @@ module MuxRuby
143
149
  def mp4_support=(mp4_support)
144
150
  validator = EnumAttributeValidator.new('String', ['none', 'standard'])
145
151
  unless validator.valid?(mp4_support)
146
- fail ArgumentError, 'invalid value for "mp4_support", must be one of #{validator.allowable_values}.'
152
+ fail ArgumentError, "invalid value for \"mp4_support\", must be one of #{validator.allowable_values}."
147
153
  end
148
154
  @mp4_support = mp4_support
149
155
  end
@@ -153,7 +159,7 @@ module MuxRuby
153
159
  def master_access=(master_access)
154
160
  validator = EnumAttributeValidator.new('String', ['none', 'temporary'])
155
161
  unless validator.valid?(master_access)
156
- fail ArgumentError, 'invalid value for "master_access", must be one of #{validator.allowable_values}.'
162
+ fail ArgumentError, "invalid value for \"master_access\", must be one of #{validator.allowable_values}."
157
163
  end
158
164
  @master_access = master_access
159
165
  end
@@ -13,12 +13,16 @@ module MuxRuby
13
13
 
14
14
  attr_accessor :text_type
15
15
 
16
+ # The language code value must be a valid BCP 47 specification compliant value. For example, en for English or en-US for the US version of English.
16
17
  attr_accessor :language_code
17
18
 
19
+ # The name of the track containing a human-readable description. This value must be unqiue across all the text type and subtitles text type tracks. HLS manifest will associate subtitle text track with this value. For example, set the value to \"English\" for subtitles text track with language_code as en-US. If this parameter is not included, Mux will auto-populate based on the language_code value.
18
20
  attr_accessor :name
19
21
 
22
+ # Indicates the track provides Subtitles for the Deaf or Hard-of-hearing (SDH).
20
23
  attr_accessor :closed_captions
21
24
 
25
+ # Arbitrary metadata set for the track either when creating the asset or track.
22
26
  attr_accessor :passthrough
23
27
 
24
28
  class EnumAttributeValidator
@@ -148,7 +152,7 @@ module MuxRuby
148
152
  def type=(type)
149
153
  validator = EnumAttributeValidator.new('String', ['text'])
150
154
  unless validator.valid?(type)
151
- fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
155
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
152
156
  end
153
157
  @type = type
154
158
  end
@@ -158,7 +162,7 @@ module MuxRuby
158
162
  def text_type=(text_type)
159
163
  validator = EnumAttributeValidator.new('String', ['subtitles'])
160
164
  unless validator.valid?(text_type)
161
- fail ArgumentError, 'invalid value for "text_type", must be one of #{validator.allowable_values}.'
165
+ fail ArgumentError, "invalid value for \"text_type\", must be one of #{validator.allowable_values}."
162
166
  end
163
167
  @text_type = text_type
164
168
  end
@@ -0,0 +1,184 @@
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 GetAssetOrLiveStreamIdResponse
10
+ attr_accessor :data
11
+
12
+ # Attribute mapping from ruby-style variable name to JSON key.
13
+ def self.attribute_map
14
+ {
15
+ :'data' => :'data'
16
+ }
17
+ end
18
+
19
+ # Attribute type mapping.
20
+ def self.openapi_types
21
+ {
22
+ :'data' => :'GetAssetOrLiveStreamIdResponseData'
23
+ }
24
+ end
25
+
26
+ # Initializes the object
27
+ # @param [Hash] attributes Model attributes in the form of hash
28
+ def initialize(attributes = {})
29
+ return unless attributes.is_a?(Hash)
30
+
31
+ # convert string to symbol for hash key
32
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
33
+
34
+ if attributes.has_key?(:'data')
35
+ self.data = attributes[:'data']
36
+ end
37
+ end
38
+
39
+ # Show invalid properties with the reasons. Usually used together with valid?
40
+ # @return Array for valid properties with the reasons
41
+ def list_invalid_properties
42
+ invalid_properties = Array.new
43
+ invalid_properties
44
+ end
45
+
46
+ # Check to see if the all the properties in the model are valid
47
+ # @return true if the model is valid
48
+ def valid?
49
+ true
50
+ end
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] Object to be compared
54
+ def ==(o)
55
+ return true if self.equal?(o)
56
+ self.class == o.class &&
57
+ data == o.data
58
+ end
59
+
60
+ # @see the `==` method
61
+ # @param [Object] Object to be compared
62
+ def eql?(o)
63
+ self == o
64
+ end
65
+
66
+ # Calculates hash code according to all attributes.
67
+ # @return [Fixnum] Hash code
68
+ def hash
69
+ [data].hash
70
+ end
71
+
72
+ # Builds the object from hash
73
+ # @param [Hash] attributes Model attributes in the form of hash
74
+ # @return [Object] Returns the model itself
75
+ def self.build_from_hash(attributes)
76
+ new.build_from_hash(attributes)
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ self.class.openapi_types.each_pair do |key, type|
85
+ if type =~ /\AArray<(.*)>/i
86
+ # check to ensure the input is an array given that the attribute
87
+ # is documented as an array but the input is not
88
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
89
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
90
+ end
91
+ elsif !attributes[self.class.attribute_map[key]].nil?
92
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
93
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ # Deserializes the data based on type
100
+ # @param string type Data type
101
+ # @param string value Value to be deserialized
102
+ # @return [Object] Deserialized data
103
+ def _deserialize(type, value)
104
+ case type.to_sym
105
+ when :DateTime
106
+ DateTime.parse(value)
107
+ when :Date
108
+ Date.parse(value)
109
+ when :String
110
+ value.to_s
111
+ when :Integer
112
+ value.to_i
113
+ when :Float
114
+ value.to_f
115
+ when :BOOLEAN
116
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
117
+ true
118
+ else
119
+ false
120
+ end
121
+ when :Object
122
+ # generic object (usually a Hash), return directly
123
+ value
124
+ when /\AArray<(?<inner_type>.+)>\z/
125
+ inner_type = Regexp.last_match[:inner_type]
126
+ value.map { |v| _deserialize(inner_type, v) }
127
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
128
+ k_type = Regexp.last_match[:k_type]
129
+ v_type = Regexp.last_match[:v_type]
130
+ {}.tap do |hash|
131
+ value.each do |k, v|
132
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
133
+ end
134
+ end
135
+ else # model
136
+ MuxRuby.const_get(type).build_from_hash(value)
137
+ end
138
+ end
139
+
140
+ # Returns the string representation of the object
141
+ # @return [String] String presentation of the object
142
+ def to_s
143
+ to_hash.to_s
144
+ end
145
+
146
+ # to_body is an alias to to_hash (backward compatibility)
147
+ # @return [Hash] Returns the object in the form of hash
148
+ def to_body
149
+ to_hash
150
+ end
151
+
152
+ # Returns the object in the form of hash
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_hash
155
+ hash = {}
156
+ self.class.attribute_map.each_pair do |attr, param|
157
+ value = self.send(attr)
158
+ next if value.nil?
159
+ hash[param] = _to_hash(value)
160
+ end
161
+ hash
162
+ end
163
+
164
+ # Outputs non-array value in the form of hash
165
+ # For object, use to_hash. Otherwise, just return the value
166
+ # @param [Object] value Any valid value
167
+ # @return [Hash] Returns the value in the form of hash
168
+ def _to_hash(value)
169
+ if value.is_a?(Array)
170
+ value.compact.map { |v| _to_hash(v) }
171
+ elsif value.is_a?(Hash)
172
+ {}.tap do |hash|
173
+ value.each { |k, v| hash[k] = _to_hash(v) }
174
+ end
175
+ elsif value.respond_to? :to_hash
176
+ value.to_hash
177
+ else
178
+ value
179
+ end
180
+ end
181
+
182
+ end
183
+
184
+ end
@@ -0,0 +1,203 @@
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 GetAssetOrLiveStreamIdResponseData
10
+ # The Playback ID used to retrieve the corresponding asset or the live stream ID
11
+ attr_accessor :id
12
+
13
+ attr_accessor :policy
14
+
15
+ attr_accessor :object
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'id' => :'id',
21
+ :'policy' => :'policy',
22
+ :'object' => :'object'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'id' => :'String',
30
+ :'policy' => :'PlaybackPolicy',
31
+ :'object' => :'GetAssetOrLiveStreamIdResponseDataObject'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
42
+
43
+ if attributes.has_key?(:'id')
44
+ self.id = attributes[:'id']
45
+ end
46
+
47
+ if attributes.has_key?(:'policy')
48
+ self.policy = attributes[:'policy']
49
+ end
50
+
51
+ if attributes.has_key?(:'object')
52
+ self.object = attributes[:'object']
53
+ end
54
+ end
55
+
56
+ # Show invalid properties with the reasons. Usually used together with valid?
57
+ # @return Array for valid properties with the reasons
58
+ def list_invalid_properties
59
+ invalid_properties = Array.new
60
+ invalid_properties
61
+ end
62
+
63
+ # Check to see if the all the properties in the model are valid
64
+ # @return true if the model is valid
65
+ def valid?
66
+ true
67
+ end
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] Object to be compared
71
+ def ==(o)
72
+ return true if self.equal?(o)
73
+ self.class == o.class &&
74
+ id == o.id &&
75
+ policy == o.policy &&
76
+ object == o.object
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [id, policy, object].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def self.build_from_hash(attributes)
95
+ new.build_from_hash(attributes)
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.openapi_types.each_pair do |key, type|
104
+ if 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) })
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
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 :DateTime
125
+ DateTime.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
+ MuxRuby.const_get(type).build_from_hash(value)
156
+ end
157
+ end
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # to_body is an alias to to_hash (backward compatibility)
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_body
168
+ to_hash
169
+ end
170
+
171
+ # Returns the object in the form of hash
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_hash
174
+ hash = {}
175
+ self.class.attribute_map.each_pair do |attr, param|
176
+ value = self.send(attr)
177
+ next if value.nil?
178
+ hash[param] = _to_hash(value)
179
+ end
180
+ hash
181
+ end
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+
201
+ end
202
+
203
+ end