mux_ruby 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +3 -0
  4. data/docs/Asset.md +1 -0
  5. data/docs/AssetsApi.md +103 -0
  6. data/docs/CreateAssetRequest.md +2 -0
  7. data/docs/CreateLiveStreamRequest.md +3 -0
  8. data/docs/CreateSimulcastTargetRequest.md +10 -0
  9. data/docs/CreateTrackRequest.md +14 -0
  10. data/docs/CreateTrackResponse.md +8 -0
  11. data/docs/DeliveryReport.md +14 -0
  12. data/docs/DeliveryUsageApi.md +68 -0
  13. data/docs/GetMetricTimeseriesDataResponse.md +1 -1
  14. data/docs/GetOverallValuesResponse.md +1 -1
  15. data/docs/InputSettings.md +6 -1
  16. data/docs/InputTrack.md +0 -2
  17. data/docs/Insight.md +2 -2
  18. data/docs/ListAllMetricValuesResponse.md +1 -1
  19. data/docs/ListBreakdownValuesResponse.md +1 -1
  20. data/docs/ListDeliveryUsageResponse.md +11 -0
  21. data/docs/ListErrorsResponse.md +1 -1
  22. data/docs/ListExportsResponse.md +1 -1
  23. data/docs/ListFilterValuesResponse.md +1 -1
  24. data/docs/ListFiltersResponse.md +1 -1
  25. data/docs/ListInsightsResponse.md +1 -1
  26. data/docs/ListVideoViewsResponse.md +1 -1
  27. data/docs/LiveStream.md +2 -0
  28. data/docs/LiveStreamsApi.md +161 -0
  29. data/docs/SigningKeyResponse.md +1 -1
  30. data/docs/SimulcastTarget.md +12 -0
  31. data/docs/SimulcastTargetResponse.md +8 -0
  32. data/docs/Track.md +5 -2
  33. data/docs/VideoViewResponse.md +1 -1
  34. data/examples/data/exercise-errors.rb +1 -1
  35. data/examples/data/exercise-metrics.rb +0 -7
  36. data/examples/video/exercise-assets.rb +17 -1
  37. data/examples/video/exercise-delivery-usage.rb +23 -0
  38. data/examples/video/exercise-live-streams.rb +28 -1
  39. data/lib/mux_ruby/api/assets_api.rb +113 -0
  40. data/lib/mux_ruby/api/delivery_usage_api.rb +75 -0
  41. data/lib/mux_ruby/api/live_streams_api.rb +176 -0
  42. data/lib/mux_ruby/api_client.rb +1 -1
  43. data/lib/mux_ruby/models/asset.rb +12 -1
  44. data/lib/mux_ruby/models/create_asset_request.rb +37 -4
  45. data/lib/mux_ruby/models/create_live_stream_request.rb +57 -4
  46. data/lib/mux_ruby/models/create_simulcast_target_request.rb +210 -0
  47. data/lib/mux_ruby/models/create_track_request.rb +304 -0
  48. data/lib/mux_ruby/models/create_track_response.rb +184 -0
  49. data/lib/mux_ruby/models/delivery_report.rb +238 -0
  50. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +1 -1
  51. data/lib/mux_ruby/models/get_overall_values_response.rb +1 -1
  52. data/lib/mux_ruby/models/input_settings.rb +104 -13
  53. data/lib/mux_ruby/models/input_track.rb +4 -22
  54. data/lib/mux_ruby/models/insight.rb +2 -2
  55. data/lib/mux_ruby/models/list_all_metric_values_response.rb +1 -1
  56. data/lib/mux_ruby/models/list_breakdown_values_response.rb +1 -1
  57. data/lib/mux_ruby/models/list_delivery_usage_response.rb +216 -0
  58. data/lib/mux_ruby/models/list_errors_response.rb +1 -1
  59. data/lib/mux_ruby/models/list_exports_response.rb +1 -1
  60. data/lib/mux_ruby/models/list_filter_values_response.rb +1 -1
  61. data/lib/mux_ruby/models/list_filters_response.rb +1 -1
  62. data/lib/mux_ruby/models/list_insights_response.rb +1 -1
  63. data/lib/mux_ruby/models/list_video_views_response.rb +1 -1
  64. data/lib/mux_ruby/models/live_stream.rb +24 -4
  65. data/lib/mux_ruby/models/simulcast_target.rb +259 -0
  66. data/lib/mux_ruby/models/simulcast_target_response.rb +184 -0
  67. data/lib/mux_ruby/models/track.rb +86 -13
  68. data/lib/mux_ruby/models/video_view_response.rb +1 -1
  69. data/lib/mux_ruby/version.rb +1 -1
  70. data/lib/mux_ruby.rb +8 -0
  71. data/spec/api/assets_api_spec.rb +24 -0
  72. data/spec/api/delivery_usage_api_spec.rb +43 -0
  73. data/spec/api/live_streams_api_spec.rb +39 -0
  74. data/spec/models/asset_spec.rb +6 -0
  75. data/spec/models/create_asset_request_spec.rb +16 -0
  76. data/spec/models/create_live_stream_request_spec.rb +18 -0
  77. data/spec/models/create_simulcast_target_request_spec.rb +46 -0
  78. data/spec/models/create_track_request_spec.rb +78 -0
  79. data/spec/models/create_track_response_spec.rb +34 -0
  80. data/spec/models/delivery_report_spec.rb +70 -0
  81. data/spec/models/input_settings_spec.rb +40 -2
  82. data/spec/models/input_track_spec.rb +0 -12
  83. data/spec/models/list_delivery_usage_response_spec.rb +52 -0
  84. data/spec/models/live_stream_spec.rb +12 -0
  85. data/spec/models/simulcast_target_response_spec.rb +34 -0
  86. data/spec/models/simulcast_target_spec.rb +62 -0
  87. data/spec/models/track_spec.rb +28 -2
  88. metadata +36 -3
@@ -19,6 +19,11 @@ module MuxRuby
19
19
 
20
20
  attr_accessor :mp4_support
21
21
 
22
+ # Normalize the audio track loudness level. This parameter is only applicable to on-demand (not live) assets.
23
+ attr_accessor :normalize_audio
24
+
25
+ attr_accessor :master_access
26
+
22
27
  class EnumAttributeValidator
23
28
  attr_reader :datatype
24
29
  attr_reader :allowable_values
@@ -49,7 +54,9 @@ module MuxRuby
49
54
  :'demo' => :'demo',
50
55
  :'per_title_encode' => :'per_title_encode',
51
56
  :'passthrough' => :'passthrough',
52
- :'mp4_support' => :'mp4_support'
57
+ :'mp4_support' => :'mp4_support',
58
+ :'normalize_audio' => :'normalize_audio',
59
+ :'master_access' => :'master_access'
53
60
  }
54
61
  end
55
62
 
@@ -61,7 +68,9 @@ module MuxRuby
61
68
  :'demo' => :'BOOLEAN',
62
69
  :'per_title_encode' => :'BOOLEAN',
63
70
  :'passthrough' => :'String',
64
- :'mp4_support' => :'String'
71
+ :'mp4_support' => :'String',
72
+ :'normalize_audio' => :'BOOLEAN',
73
+ :'master_access' => :'String'
65
74
  }
66
75
  end
67
76
 
@@ -100,6 +109,16 @@ module MuxRuby
100
109
  if attributes.has_key?(:'mp4_support')
101
110
  self.mp4_support = attributes[:'mp4_support']
102
111
  end
112
+
113
+ if attributes.has_key?(:'normalize_audio')
114
+ self.normalize_audio = attributes[:'normalize_audio']
115
+ else
116
+ self.normalize_audio = false
117
+ end
118
+
119
+ if attributes.has_key?(:'master_access')
120
+ self.master_access = attributes[:'master_access']
121
+ end
103
122
  end
104
123
 
105
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -114,6 +133,8 @@ module MuxRuby
114
133
  def valid?
115
134
  mp4_support_validator = EnumAttributeValidator.new('String', ['none', 'standard'])
116
135
  return false unless mp4_support_validator.valid?(@mp4_support)
136
+ master_access_validator = EnumAttributeValidator.new('String', ['none', 'temporary'])
137
+ return false unless master_access_validator.valid?(@master_access)
117
138
  true
118
139
  end
119
140
 
@@ -127,6 +148,16 @@ module MuxRuby
127
148
  @mp4_support = mp4_support
128
149
  end
129
150
 
151
+ # Custom attribute writer method checking allowed values (enum).
152
+ # @param [Object] master_access Object to be assigned
153
+ def master_access=(master_access)
154
+ validator = EnumAttributeValidator.new('String', ['none', 'temporary'])
155
+ unless validator.valid?(master_access)
156
+ fail ArgumentError, 'invalid value for "master_access", must be one of #{validator.allowable_values}.'
157
+ end
158
+ @master_access = master_access
159
+ end
160
+
130
161
  # Checks equality by comparing each attribute.
131
162
  # @param [Object] Object to be compared
132
163
  def ==(o)
@@ -137,7 +168,9 @@ module MuxRuby
137
168
  demo == o.demo &&
138
169
  per_title_encode == o.per_title_encode &&
139
170
  passthrough == o.passthrough &&
140
- mp4_support == o.mp4_support
171
+ mp4_support == o.mp4_support &&
172
+ normalize_audio == o.normalize_audio &&
173
+ master_access == o.master_access
141
174
  end
142
175
 
143
176
  # @see the `==` method
@@ -149,7 +182,7 @@ module MuxRuby
149
182
  # Calculates hash code according to all attributes.
150
183
  # @return [Fixnum] Hash code
151
184
  def hash
152
- [input, playback_policy, demo, per_title_encode, passthrough, mp4_support].hash
185
+ [input, playback_policy, demo, per_title_encode, passthrough, mp4_support, normalize_audio, master_access].hash
153
186
  end
154
187
 
155
188
  # Builds the object from hash
@@ -11,11 +11,22 @@ module MuxRuby
11
11
 
12
12
  attr_accessor :new_asset_settings
13
13
 
14
+ # 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. Defaults to 60 seconds on the API if not specified.
15
+ attr_accessor :reconnect_window
16
+
17
+ attr_accessor :passthrough
18
+
19
+ # Latency is the time from when the streamer does something in real life to when you see it happen in the player. Set this if you want lower latency for your live stream. Note: Reconnect windows are incompatible with Reduced Latency and will always be set to zero (0) seconds. Read more here: https://mux.com/blog/reduced-latency-for-mux-live-streaming-now-available/
20
+ attr_accessor :reduced_latency
21
+
14
22
  # Attribute mapping from ruby-style variable name to JSON key.
15
23
  def self.attribute_map
16
24
  {
17
25
  :'playback_policy' => :'playback_policy',
18
- :'new_asset_settings' => :'new_asset_settings'
26
+ :'new_asset_settings' => :'new_asset_settings',
27
+ :'reconnect_window' => :'reconnect_window',
28
+ :'passthrough' => :'passthrough',
29
+ :'reduced_latency' => :'reduced_latency'
19
30
  }
20
31
  end
21
32
 
@@ -23,7 +34,10 @@ module MuxRuby
23
34
  def self.openapi_types
24
35
  {
25
36
  :'playback_policy' => :'Array<PlaybackPolicy>',
26
- :'new_asset_settings' => :'CreateAssetRequest'
37
+ :'new_asset_settings' => :'CreateAssetRequest',
38
+ :'reconnect_window' => :'Float',
39
+ :'passthrough' => :'String',
40
+ :'reduced_latency' => :'BOOLEAN'
27
41
  }
28
42
  end
29
43
 
@@ -44,28 +58,67 @@ module MuxRuby
44
58
  if attributes.has_key?(:'new_asset_settings')
45
59
  self.new_asset_settings = attributes[:'new_asset_settings']
46
60
  end
61
+
62
+ if attributes.has_key?(:'reconnect_window')
63
+ self.reconnect_window = attributes[:'reconnect_window']
64
+ end
65
+
66
+ if attributes.has_key?(:'passthrough')
67
+ self.passthrough = attributes[:'passthrough']
68
+ end
69
+
70
+ if attributes.has_key?(:'reduced_latency')
71
+ self.reduced_latency = attributes[:'reduced_latency']
72
+ end
47
73
  end
48
74
 
49
75
  # Show invalid properties with the reasons. Usually used together with valid?
50
76
  # @return Array for valid properties with the reasons
51
77
  def list_invalid_properties
52
78
  invalid_properties = Array.new
79
+ if !@reconnect_window.nil? && @reconnect_window > 300
80
+ invalid_properties.push('invalid value for "reconnect_window", must be smaller than or equal to 300.')
81
+ end
82
+
83
+ if !@reconnect_window.nil? && @reconnect_window < 0.1
84
+ invalid_properties.push('invalid value for "reconnect_window", must be greater than or equal to 0.1.')
85
+ end
86
+
53
87
  invalid_properties
54
88
  end
55
89
 
56
90
  # Check to see if the all the properties in the model are valid
57
91
  # @return true if the model is valid
58
92
  def valid?
93
+ return false if !@reconnect_window.nil? && @reconnect_window > 300
94
+ return false if !@reconnect_window.nil? && @reconnect_window < 0.1
59
95
  true
60
96
  end
61
97
 
98
+ # Custom attribute writer method with validation
99
+ # @param [Object] reconnect_window Value to be assigned
100
+ def reconnect_window=(reconnect_window)
101
+ if !reconnect_window.nil? && reconnect_window > 300
102
+ fail ArgumentError, 'invalid value for "reconnect_window", must be smaller than or equal to 300.'
103
+ end
104
+
105
+ if !reconnect_window.nil? && reconnect_window < 0.1
106
+ fail ArgumentError, 'invalid value for "reconnect_window", must be greater than or equal to 0.1.'
107
+ end
108
+
109
+ @reconnect_window = reconnect_window
110
+ end
111
+
62
112
  # Checks equality by comparing each attribute.
63
113
  # @param [Object] Object to be compared
64
114
  def ==(o)
65
115
  return true if self.equal?(o)
66
116
  self.class == o.class &&
67
117
  playback_policy == o.playback_policy &&
68
- new_asset_settings == o.new_asset_settings
118
+ new_asset_settings == o.new_asset_settings &&
119
+ reconnect_window == o.reconnect_window &&
120
+ passthrough == o.passthrough &&
121
+ reduced_latency == o.reduced_latency
69
122
  end
70
123
 
71
124
  # @see the `==` method
@@ -77,7 +130,7 @@ module MuxRuby
77
130
  # Calculates hash code according to all attributes.
78
131
  # @return [Fixnum] Hash code
79
132
  def hash
80
- [playback_policy, new_asset_settings].hash
133
+ [playback_policy, new_asset_settings, reconnect_window, passthrough, reduced_latency].hash
81
134
  end
82
135
 
83
136
  # Builds the object from hash
@@ -0,0 +1,210 @@
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 CreateSimulcastTargetRequest
10
+ # Arbitrary metadata set by you when creating a simulcast target.
11
+ attr_accessor :passthrough
12
+
13
+ # Stream Key represents a stream identifier on the third party live streaming service to send the parent live stream to.
14
+ attr_accessor :stream_key
15
+
16
+ # RTMP hostname including application name for the third party live streaming service. Example: 'rtmp://live.example.com/app'.
17
+ attr_accessor :url
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'passthrough' => :'passthrough',
23
+ :'stream_key' => :'stream_key',
24
+ :'url' => :'url'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'passthrough' => :'String',
32
+ :'stream_key' => :'String',
33
+ :'url' => :'String'
34
+ }
35
+ end
36
+
37
+ # Initializes the object
38
+ # @param [Hash] attributes Model attributes in the form of hash
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ if attributes.has_key?(:'passthrough')
46
+ self.passthrough = attributes[:'passthrough']
47
+ end
48
+
49
+ if attributes.has_key?(:'stream_key')
50
+ self.stream_key = attributes[:'stream_key']
51
+ end
52
+
53
+ if attributes.has_key?(:'url')
54
+ self.url = attributes[:'url']
55
+ end
56
+ end
57
+
58
+ # Show invalid properties with the reasons. Usually used together with valid?
59
+ # @return Array for valid properties with the reasons
60
+ def list_invalid_properties
61
+ invalid_properties = Array.new
62
+ if @url.nil?
63
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
64
+ end
65
+
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ return false if @url.nil?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ passthrough == o.passthrough &&
82
+ stream_key == o.stream_key &&
83
+ url == o.url
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [passthrough, stream_key, url].hash
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 self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :BOOLEAN
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ MuxRuby.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ next if value.nil?
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ end
209
+
210
+ end