mux_ruby 1.3.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -1
  3. data/Gemfile.lock +37 -35
  4. data/README.md +6 -1
  5. data/docs/Asset.md +1 -1
  6. data/docs/AssetsApi.md +54 -0
  7. data/docs/CreateAssetRequest.md +1 -1
  8. data/docs/CreateLiveStreamRequest.md +2 -0
  9. data/docs/CreateUploadRequest.md +1 -0
  10. data/docs/LiveStream.md +2 -1
  11. data/docs/UpdateAssetMasterAccessRequest.md +8 -0
  12. data/docs/Upload.md +1 -0
  13. data/docs/VideoView.md +16 -14
  14. data/examples/data/exercise-errors.rb +1 -1
  15. data/examples/video/exercise-assets.rb +10 -0
  16. data/lib/mux_ruby.rb +1 -0
  17. data/lib/mux_ruby/api/assets_api.rb +61 -0
  18. data/lib/mux_ruby/api_client.rb +6 -1
  19. data/lib/mux_ruby/api_error.rb +3 -0
  20. data/lib/mux_ruby/configuration.rb +1 -4
  21. data/lib/mux_ruby/models/asset.rb +13 -13
  22. data/lib/mux_ruby/models/asset_static_renditions_files.rb +4 -4
  23. data/lib/mux_ruby/models/create_asset_request.rb +13 -13
  24. data/lib/mux_ruby/models/create_live_stream_request.rb +24 -4
  25. data/lib/mux_ruby/models/create_upload_request.rb +13 -4
  26. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +46 -0
  27. data/lib/mux_ruby/models/live_stream.rb +14 -5
  28. data/lib/mux_ruby/models/update_asset_master_access_request.rb +219 -0
  29. data/lib/mux_ruby/models/upload.rb +13 -4
  30. data/lib/mux_ruby/models/video_view.rb +36 -18
  31. data/lib/mux_ruby/version.rb +1 -1
  32. data/spec/api/assets_api_spec.rb +13 -0
  33. data/spec/models/asset_spec.rb +6 -6
  34. data/spec/models/asset_static_renditions_files_spec.rb +2 -2
  35. data/spec/models/create_asset_request_spec.rb +6 -6
  36. data/spec/models/create_live_stream_request_spec.rb +12 -0
  37. data/spec/models/create_upload_request_spec.rb +6 -0
  38. data/spec/models/input_settings_overlay_settings_spec.rb +8 -0
  39. data/spec/models/live_stream_spec.rb +6 -0
  40. data/spec/models/update_asset_master_access_request_spec.rb +38 -0
  41. data/spec/models/upload_spec.rb +6 -0
  42. data/spec/models/video_view_spec.rb +12 -0
  43. data/test.sh +28 -0
  44. metadata +65 -61
@@ -69,6 +69,11 @@ module MuxRuby
69
69
  :response_headers => response.headers,
70
70
  :response_body => response.body),
71
71
  response.status_message
72
+ elsif response.code == 429
73
+ fail TooManyRequestsError.new(:code => response.code,
74
+ :response_headers => response.headers,
75
+ :response_body => response.body),
76
+ response.status_message
72
77
  elsif response.code.between?(500, 599)
73
78
  fail ServiceError.new(:code => response.code,
74
79
  :response_headers => response.headers,
@@ -275,7 +280,7 @@ module MuxRuby
275
280
  def build_request_url(path)
276
281
  # Add leading and trailing slashes to path
277
282
  path = "/#{path}".gsub(/\/+/, '/')
278
- URI.encode(@config.base_url + path)
283
+ "#{@config.base_url}#{path}"
279
284
  end
280
285
 
281
286
  # Builds the HTTP request body
@@ -41,4 +41,7 @@ module MuxRuby
41
41
  class ServiceError < ApiError
42
42
  end
43
43
 
44
+ class TooManyRequestsError < ApiError
45
+ end
46
+
44
47
  end
@@ -3,8 +3,6 @@
3
3
  # NOTE: This file is auto generated. Do not edit this file manually.
4
4
  =end
5
5
 
6
- require 'uri'
7
-
8
6
  module MuxRuby
9
7
  class Configuration
10
8
  # Defines url scheme
@@ -167,8 +165,7 @@ module MuxRuby
167
165
  end
168
166
 
169
167
  def base_url
170
- url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
171
- URI.encode(url)
168
+ "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
172
169
  end
173
170
 
174
171
  # Gets API key (with prefix if set).
@@ -27,8 +27,6 @@ module MuxRuby
27
27
 
28
28
  attr_accessor :tracks
29
29
 
30
- attr_accessor :demo
31
-
32
30
  attr_accessor :errors
33
31
 
34
32
  attr_accessor :per_title_encode
@@ -49,6 +47,8 @@ module MuxRuby
49
47
 
50
48
  attr_accessor :static_renditions
51
49
 
50
+ attr_accessor :test
51
+
52
52
  class EnumAttributeValidator
53
53
  attr_reader :datatype
54
54
  attr_reader :allowable_values
@@ -84,7 +84,6 @@ module MuxRuby
84
84
  :'aspect_ratio' => :'aspect_ratio',
85
85
  :'playback_ids' => :'playback_ids',
86
86
  :'tracks' => :'tracks',
87
- :'demo' => :'demo',
88
87
  :'errors' => :'errors',
89
88
  :'per_title_encode' => :'per_title_encode',
90
89
  :'is_live' => :'is_live',
@@ -94,7 +93,8 @@ module MuxRuby
94
93
  :'master_access' => :'master_access',
95
94
  :'mp4_support' => :'mp4_support',
96
95
  :'normalize_audio' => :'normalize_audio',
97
- :'static_renditions' => :'static_renditions'
96
+ :'static_renditions' => :'static_renditions',
97
+ :'test' => :'test'
98
98
  }
99
99
  end
100
100
 
@@ -111,7 +111,6 @@ module MuxRuby
111
111
  :'aspect_ratio' => :'String',
112
112
  :'playback_ids' => :'Array<PlaybackID>',
113
113
  :'tracks' => :'Array<Track>',
114
- :'demo' => :'BOOLEAN',
115
114
  :'errors' => :'AssetErrors',
116
115
  :'per_title_encode' => :'BOOLEAN',
117
116
  :'is_live' => :'BOOLEAN',
@@ -121,7 +120,8 @@ module MuxRuby
121
120
  :'master_access' => :'String',
122
121
  :'mp4_support' => :'String',
123
122
  :'normalize_audio' => :'BOOLEAN',
124
- :'static_renditions' => :'AssetStaticRenditions'
123
+ :'static_renditions' => :'AssetStaticRenditions',
124
+ :'test' => :'BOOLEAN'
125
125
  }
126
126
  end
127
127
 
@@ -177,10 +177,6 @@ module MuxRuby
177
177
  end
178
178
  end
179
179
 
180
- if attributes.has_key?(:'demo')
181
- self.demo = attributes[:'demo']
182
- end
183
-
184
180
  if attributes.has_key?(:'errors')
185
181
  self.errors = attributes[:'errors']
186
182
  end
@@ -226,6 +222,10 @@ module MuxRuby
226
222
  if attributes.has_key?(:'static_renditions')
227
223
  self.static_renditions = attributes[:'static_renditions']
228
224
  end
225
+
226
+ if attributes.has_key?(:'test')
227
+ self.test = attributes[:'test']
228
+ end
229
229
  end
230
230
 
231
231
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -280,7 +280,6 @@ module MuxRuby
280
280
  aspect_ratio == o.aspect_ratio &&
281
281
  playback_ids == o.playback_ids &&
282
282
  tracks == o.tracks &&
283
- demo == o.demo &&
284
283
  errors == o.errors &&
285
284
  per_title_encode == o.per_title_encode &&
286
285
  is_live == o.is_live &&
@@ -290,7 +289,8 @@ module MuxRuby
290
289
  master_access == o.master_access &&
291
290
  mp4_support == o.mp4_support &&
292
291
  normalize_audio == o.normalize_audio &&
293
- static_renditions == o.static_renditions
292
+ static_renditions == o.static_renditions &&
293
+ test == o.test
294
294
  end
295
295
 
296
296
  # @see the `==` method
@@ -302,7 +302,7 @@ module MuxRuby
302
302
  # Calculates hash code according to all attributes.
303
303
  # @return [Fixnum] Hash code
304
304
  def hash
305
- [id, created_at, deleted_at, status, duration, max_stored_resolution, max_stored_frame_rate, aspect_ratio, playback_ids, tracks, demo, errors, per_title_encode, is_live, passthrough, live_stream_id, master, master_access, mp4_support, normalize_audio, static_renditions].hash
305
+ [id, created_at, deleted_at, status, duration, max_stored_resolution, max_stored_frame_rate, aspect_ratio, playback_ids, tracks, errors, per_title_encode, is_live, passthrough, live_stream_id, master, master_access, mp4_support, normalize_audio, static_renditions, test].hash
306
306
  end
307
307
 
308
308
  # Builds the object from hash
@@ -112,9 +112,9 @@ module MuxRuby
112
112
  # Check to see if the all the properties in the model are valid
113
113
  # @return true if the model is valid
114
114
  def valid?
115
- name_validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4'])
115
+ name_validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4', 'audio.m4a'])
116
116
  return false unless name_validator.valid?(@name)
117
- ext_validator = EnumAttributeValidator.new('String', ['mp4'])
117
+ ext_validator = EnumAttributeValidator.new('String', ['mp4', 'm4a'])
118
118
  return false unless ext_validator.valid?(@ext)
119
119
  true
120
120
  end
@@ -122,7 +122,7 @@ module MuxRuby
122
122
  # Custom attribute writer method checking allowed values (enum).
123
123
  # @param [Object] name Object to be assigned
124
124
  def name=(name)
125
- validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4'])
125
+ validator = EnumAttributeValidator.new('String', ['low.mp4', 'medium.mp4', 'high.mp4', 'audio.m4a'])
126
126
  unless validator.valid?(name)
127
127
  fail ArgumentError, 'invalid value for "name", must be one of #{validator.allowable_values}.'
128
128
  end
@@ -132,7 +132,7 @@ module MuxRuby
132
132
  # Custom attribute writer method checking allowed values (enum).
133
133
  # @param [Object] ext Object to be assigned
134
134
  def ext=(ext)
135
- validator = EnumAttributeValidator.new('String', ['mp4'])
135
+ validator = EnumAttributeValidator.new('String', ['mp4', 'm4a'])
136
136
  unless validator.valid?(ext)
137
137
  fail ArgumentError, 'invalid value for "ext", must be one of #{validator.allowable_values}.'
138
138
  end
@@ -11,8 +11,6 @@ module MuxRuby
11
11
 
12
12
  attr_accessor :playback_policy
13
13
 
14
- attr_accessor :demo
15
-
16
14
  attr_accessor :per_title_encode
17
15
 
18
16
  attr_accessor :passthrough
@@ -24,6 +22,8 @@ module MuxRuby
24
22
 
25
23
  attr_accessor :master_access
26
24
 
25
+ attr_accessor :test
26
+
27
27
  class EnumAttributeValidator
28
28
  attr_reader :datatype
29
29
  attr_reader :allowable_values
@@ -51,12 +51,12 @@ module MuxRuby
51
51
  {
52
52
  :'input' => :'input',
53
53
  :'playback_policy' => :'playback_policy',
54
- :'demo' => :'demo',
55
54
  :'per_title_encode' => :'per_title_encode',
56
55
  :'passthrough' => :'passthrough',
57
56
  :'mp4_support' => :'mp4_support',
58
57
  :'normalize_audio' => :'normalize_audio',
59
- :'master_access' => :'master_access'
58
+ :'master_access' => :'master_access',
59
+ :'test' => :'test'
60
60
  }
61
61
  end
62
62
 
@@ -65,12 +65,12 @@ module MuxRuby
65
65
  {
66
66
  :'input' => :'Array<InputSettings>',
67
67
  :'playback_policy' => :'Array<PlaybackPolicy>',
68
- :'demo' => :'BOOLEAN',
69
68
  :'per_title_encode' => :'BOOLEAN',
70
69
  :'passthrough' => :'String',
71
70
  :'mp4_support' => :'String',
72
71
  :'normalize_audio' => :'BOOLEAN',
73
- :'master_access' => :'String'
72
+ :'master_access' => :'String',
73
+ :'test' => :'BOOLEAN'
74
74
  }
75
75
  end
76
76
 
@@ -94,10 +94,6 @@ module MuxRuby
94
94
  end
95
95
  end
96
96
 
97
- if attributes.has_key?(:'demo')
98
- self.demo = attributes[:'demo']
99
- end
100
-
101
97
  if attributes.has_key?(:'per_title_encode')
102
98
  self.per_title_encode = attributes[:'per_title_encode']
103
99
  end
@@ -119,6 +115,10 @@ module MuxRuby
119
115
  if attributes.has_key?(:'master_access')
120
116
  self.master_access = attributes[:'master_access']
121
117
  end
118
+
119
+ if attributes.has_key?(:'test')
120
+ self.test = attributes[:'test']
121
+ end
122
122
  end
123
123
 
124
124
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -165,12 +165,12 @@ module MuxRuby
165
165
  self.class == o.class &&
166
166
  input == o.input &&
167
167
  playback_policy == o.playback_policy &&
168
- demo == o.demo &&
169
168
  per_title_encode == o.per_title_encode &&
170
169
  passthrough == o.passthrough &&
171
170
  mp4_support == o.mp4_support &&
172
171
  normalize_audio == o.normalize_audio &&
173
- master_access == o.master_access
172
+ master_access == o.master_access &&
173
+ test == o.test
174
174
  end
175
175
 
176
176
  # @see the `==` method
@@ -182,7 +182,7 @@ module MuxRuby
182
182
  # Calculates hash code according to all attributes.
183
183
  # @return [Fixnum] Hash code
184
184
  def hash
185
- [input, playback_policy, demo, per_title_encode, passthrough, mp4_support, normalize_audio, master_access].hash
185
+ [input, playback_policy, per_title_encode, passthrough, mp4_support, normalize_audio, master_access, test].hash
186
186
  end
187
187
 
188
188
  # Builds the object from hash
@@ -19,6 +19,10 @@ module MuxRuby
19
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
20
  attr_accessor :reduced_latency
21
21
 
22
+ attr_accessor :test
23
+
24
+ attr_accessor :simulcast_targets
25
+
22
26
  # Attribute mapping from ruby-style variable name to JSON key.
23
27
  def self.attribute_map
24
28
  {
@@ -26,7 +30,9 @@ module MuxRuby
26
30
  :'new_asset_settings' => :'new_asset_settings',
27
31
  :'reconnect_window' => :'reconnect_window',
28
32
  :'passthrough' => :'passthrough',
29
- :'reduced_latency' => :'reduced_latency'
33
+ :'reduced_latency' => :'reduced_latency',
34
+ :'test' => :'test',
35
+ :'simulcast_targets' => :'simulcast_targets'
30
36
  }
31
37
  end
32
38
 
@@ -37,7 +43,9 @@ module MuxRuby
37
43
  :'new_asset_settings' => :'CreateAssetRequest',
38
44
  :'reconnect_window' => :'Float',
39
45
  :'passthrough' => :'String',
40
- :'reduced_latency' => :'BOOLEAN'
46
+ :'reduced_latency' => :'BOOLEAN',
47
+ :'test' => :'BOOLEAN',
48
+ :'simulcast_targets' => :'Array<CreateSimulcastTargetRequest>'
41
49
  }
42
50
  end
43
51
 
@@ -70,6 +78,16 @@ module MuxRuby
70
78
  if attributes.has_key?(:'reduced_latency')
71
79
  self.reduced_latency = attributes[:'reduced_latency']
72
80
  end
81
+
82
+ if attributes.has_key?(:'test')
83
+ self.test = attributes[:'test']
84
+ end
85
+
86
+ if attributes.has_key?(:'simulcast_targets')
87
+ if (value = attributes[:'simulcast_targets']).is_a?(Array)
88
+ self.simulcast_targets = value
89
+ end
90
+ end
73
91
  end
74
92
 
75
93
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -118,7 +136,9 @@ module MuxRuby
118
136
  new_asset_settings == o.new_asset_settings &&
119
137
  reconnect_window == o.reconnect_window &&
120
138
  passthrough == o.passthrough &&
121
- reduced_latency == o.reduced_latency
139
+ reduced_latency == o.reduced_latency &&
140
+ test == o.test &&
141
+ simulcast_targets == o.simulcast_targets
122
142
  end
123
143
 
124
144
  # @see the `==` method
@@ -130,7 +150,7 @@ module MuxRuby
130
150
  # Calculates hash code according to all attributes.
131
151
  # @return [Fixnum] Hash code
132
152
  def hash
133
- [playback_policy, new_asset_settings, reconnect_window, passthrough, reduced_latency].hash
153
+ [playback_policy, new_asset_settings, reconnect_window, passthrough, reduced_latency, test, simulcast_targets].hash
134
154
  end
135
155
 
136
156
  # Builds the object from hash
@@ -15,12 +15,15 @@ module MuxRuby
15
15
 
16
16
  attr_accessor :new_asset_settings
17
17
 
18
+ attr_accessor :test
19
+
18
20
  # Attribute mapping from ruby-style variable name to JSON key.
19
21
  def self.attribute_map
20
22
  {
21
23
  :'timeout' => :'timeout',
22
24
  :'cors_origin' => :'cors_origin',
23
- :'new_asset_settings' => :'new_asset_settings'
25
+ :'new_asset_settings' => :'new_asset_settings',
26
+ :'test' => :'test'
24
27
  }
25
28
  end
26
29
 
@@ -29,7 +32,8 @@ module MuxRuby
29
32
  {
30
33
  :'timeout' => :'Integer',
31
34
  :'cors_origin' => :'String',
32
- :'new_asset_settings' => :'CreateAssetRequest'
35
+ :'new_asset_settings' => :'CreateAssetRequest',
36
+ :'test' => :'BOOLEAN'
33
37
  }
34
38
  end
35
39
 
@@ -54,6 +58,10 @@ module MuxRuby
54
58
  if attributes.has_key?(:'new_asset_settings')
55
59
  self.new_asset_settings = attributes[:'new_asset_settings']
56
60
  end
61
+
62
+ if attributes.has_key?(:'test')
63
+ self.test = attributes[:'test']
64
+ end
57
65
  end
58
66
 
59
67
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -105,7 +113,8 @@ module MuxRuby
105
113
  self.class == o.class &&
106
114
  timeout == o.timeout &&
107
115
  cors_origin == o.cors_origin &&
108
- new_asset_settings == o.new_asset_settings
116
+ new_asset_settings == o.new_asset_settings &&
117
+ test == o.test
109
118
  end
110
119
 
111
120
  # @see the `==` method
@@ -117,7 +126,7 @@ module MuxRuby
117
126
  # Calculates hash code according to all attributes.
118
127
  # @return [Fixnum] Hash code
119
128
  def hash
120
- [timeout, cors_origin, new_asset_settings].hash
129
+ [timeout, cors_origin, new_asset_settings, test].hash
121
130
  end
122
131
 
123
132
  # Builds the object from hash
@@ -21,6 +21,28 @@ module MuxRuby
21
21
 
22
22
  attr_accessor :opacity
23
23
 
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
24
46
  # Attribute mapping from ruby-style variable name to JSON key.
25
47
  def self.attribute_map
26
48
  {
@@ -94,9 +116,33 @@ module MuxRuby
94
116
  # Check to see if the all the properties in the model are valid
95
117
  # @return true if the model is valid
96
118
  def valid?
119
+ vertical_align_validator = EnumAttributeValidator.new('String', ['top', 'middle', 'bottom'])
120
+ return false unless vertical_align_validator.valid?(@vertical_align)
121
+ horizontal_align_validator = EnumAttributeValidator.new('String', ['left', 'center', 'right'])
122
+ return false unless horizontal_align_validator.valid?(@horizontal_align)
97
123
  true
98
124
  end
99
125
 
126
+ # Custom attribute writer method checking allowed values (enum).
127
+ # @param [Object] vertical_align Object to be assigned
128
+ def vertical_align=(vertical_align)
129
+ validator = EnumAttributeValidator.new('String', ['top', 'middle', 'bottom'])
130
+ unless validator.valid?(vertical_align)
131
+ fail ArgumentError, 'invalid value for "vertical_align", must be one of #{validator.allowable_values}.'
132
+ end
133
+ @vertical_align = vertical_align
134
+ end
135
+
136
+ # Custom attribute writer method checking allowed values (enum).
137
+ # @param [Object] horizontal_align Object to be assigned
138
+ def horizontal_align=(horizontal_align)
139
+ validator = EnumAttributeValidator.new('String', ['left', 'center', 'right'])
140
+ unless validator.valid?(horizontal_align)
141
+ fail ArgumentError, 'invalid value for "horizontal_align", must be one of #{validator.allowable_values}.'
142
+ end
143
+ @horizontal_align = horizontal_align
144
+ end
145
+
100
146
  # Checks equality by comparing each attribute.
101
147
  # @param [Object] Object to be compared
102
148
  def ==(o)