mux_ruby 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +13 -7
  4. data/docs/Asset.md +1 -1
  5. data/docs/Broadcast.md +30 -0
  6. data/docs/BroadcastLayout.md +15 -0
  7. data/docs/BroadcastResolution.md +15 -0
  8. data/docs/BroadcastResponse.md +18 -0
  9. data/docs/BroadcastStatus.md +15 -0
  10. data/docs/CreateBroadcastRequest.md +26 -0
  11. data/docs/CreateSimulcastTargetRequest.md +1 -1
  12. data/docs/CreateSpaceRequest.md +22 -0
  13. data/docs/ListSpacesResponse.md +18 -0
  14. data/docs/Space.md +30 -0
  15. data/docs/SpaceResponse.md +18 -0
  16. data/docs/SpaceStatus.md +15 -0
  17. data/docs/SpaceType.md +15 -0
  18. data/docs/SpacesApi.md +658 -0
  19. data/docs/StartSpaceBroadcastResponse.md +18 -0
  20. data/docs/StopSpaceBroadcastResponse.md +18 -0
  21. data/gen/generator-config.json +1 -1
  22. data/gen/templates/README.mustache +9 -3
  23. data/lib/mux_ruby/api/spaces_api.rb +619 -0
  24. data/lib/mux_ruby/models/asset.rb +1 -1
  25. data/lib/mux_ruby/models/broadcast.rb +305 -0
  26. data/lib/mux_ruby/models/broadcast_layout.rb +37 -0
  27. data/lib/mux_ruby/models/broadcast_resolution.rb +41 -0
  28. data/lib/mux_ruby/models/broadcast_response.rb +223 -0
  29. data/lib/mux_ruby/models/broadcast_status.rb +37 -0
  30. data/lib/mux_ruby/models/create_broadcast_request.rb +266 -0
  31. data/lib/mux_ruby/models/create_simulcast_target_request.rb +1 -1
  32. data/lib/mux_ruby/models/create_space_request.rb +242 -0
  33. data/lib/mux_ruby/models/list_spaces_response.rb +225 -0
  34. data/lib/mux_ruby/models/space.rb +301 -0
  35. data/lib/mux_ruby/models/space_response.rb +223 -0
  36. data/lib/mux_ruby/models/space_status.rb +37 -0
  37. data/lib/mux_ruby/models/space_type.rb +36 -0
  38. data/lib/mux_ruby/models/start_space_broadcast_response.rb +218 -0
  39. data/lib/mux_ruby/models/stop_space_broadcast_response.rb +218 -0
  40. data/lib/mux_ruby/version.rb +1 -1
  41. data/lib/mux_ruby.rb +15 -0
  42. data/spec/api/spaces_api_spec.rb +149 -0
  43. data/spec/models/broadcast_layout_spec.rb +28 -0
  44. data/spec/models/broadcast_resolution_spec.rb +28 -0
  45. data/spec/models/broadcast_response_spec.rb +34 -0
  46. data/spec/models/broadcast_spec.rb +70 -0
  47. data/spec/models/broadcast_status_spec.rb +28 -0
  48. data/spec/models/create_broadcast_request_spec.rb +58 -0
  49. data/spec/models/create_space_request_spec.rb +46 -0
  50. data/spec/models/list_spaces_response_spec.rb +34 -0
  51. data/spec/models/space_response_spec.rb +34 -0
  52. data/spec/models/space_spec.rb +70 -0
  53. data/spec/models/space_status_spec.rb +28 -0
  54. data/spec/models/space_type_spec.rb +28 -0
  55. data/spec/models/start_space_broadcast_response_spec.rb +34 -0
  56. data/spec/models/stop_space_broadcast_response_spec.rb +34 -0
  57. metadata +164 -104
@@ -0,0 +1,266 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ class CreateBroadcastRequest
18
+ # Arbitrary user-supplied metadata that will be included in the broadcast details and related webhooks. Max: 255 characters.
19
+ attr_accessor :passthrough
20
+
21
+ # The ID of the live stream that you want to broadcast to.
22
+ attr_accessor :live_stream_id
23
+
24
+ attr_accessor :layout
25
+
26
+ # URL of an image to display as the background of the broadcast. Its dimensions should match the provided resolution.
27
+ attr_accessor :background
28
+
29
+ attr_accessor :resolution
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'passthrough' => :'passthrough',
35
+ :'live_stream_id' => :'live_stream_id',
36
+ :'layout' => :'layout',
37
+ :'background' => :'background',
38
+ :'resolution' => :'resolution'
39
+ }
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'passthrough' => :'String',
51
+ :'live_stream_id' => :'String',
52
+ :'layout' => :'BroadcastLayout',
53
+ :'background' => :'String',
54
+ :'resolution' => :'BroadcastResolution'
55
+ }
56
+ end
57
+
58
+ # List of attributes with nullable: true
59
+ def self.openapi_nullable
60
+ Set.new([
61
+ ])
62
+ end
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ def initialize(attributes = {})
67
+ if (!attributes.is_a?(Hash))
68
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::CreateBroadcastRequest` initialize method"
69
+ end
70
+
71
+ # check to see if the attribute exists and convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h|
73
+ if (!self.class.attribute_map.key?(k.to_sym))
74
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::CreateBroadcastRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
75
+ end
76
+ h[k.to_sym] = v
77
+ }
78
+
79
+ if attributes.key?(:'passthrough')
80
+ self.passthrough = attributes[:'passthrough']
81
+ end
82
+
83
+ if attributes.key?(:'live_stream_id')
84
+ self.live_stream_id = attributes[:'live_stream_id']
85
+ end
86
+
87
+ if attributes.key?(:'layout')
88
+ self.layout = attributes[:'layout']
89
+ else
90
+ self.layout = 'gallery'
91
+ end
92
+
93
+ if attributes.key?(:'background')
94
+ self.background = attributes[:'background']
95
+ end
96
+
97
+ if attributes.key?(:'resolution')
98
+ self.resolution = attributes[:'resolution']
99
+ else
100
+ self.resolution = '1920x1080'
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if @live_stream_id.nil?
109
+ invalid_properties.push('invalid value for "live_stream_id", live_stream_id cannot be nil.')
110
+ end
111
+
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ return false if @live_stream_id.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ passthrough == o.passthrough &&
128
+ live_stream_id == o.live_stream_id &&
129
+ layout == o.layout &&
130
+ background == o.background &&
131
+ resolution == o.resolution
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Integer] Hash code
142
+ def hash
143
+ [passthrough, live_stream_id, layout, background, resolution].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def self.build_from_hash(attributes)
150
+ new.build_from_hash(attributes)
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.openapi_types.each_pair do |key, type|
159
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
160
+ self.send("#{key}=", nil)
161
+ elsif type =~ /\AArray<(.*)>/i
162
+ # check to ensure the input is an array given that the attribute
163
+ # is documented as an array but the input is not
164
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
165
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
166
+ end
167
+ elsif !attributes[self.class.attribute_map[key]].nil?
168
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
169
+ end
170
+ end
171
+
172
+ self
173
+ end
174
+
175
+ # Deserializes the data based on type
176
+ # @param string type Data type
177
+ # @param string value Value to be deserialized
178
+ # @return [Object] Deserialized data
179
+ def _deserialize(type, value)
180
+ case type.to_sym
181
+ when :Time
182
+ Time.parse(value)
183
+ when :Date
184
+ Date.parse(value)
185
+ when :String
186
+ value.to_s
187
+ when :Integer
188
+ value.to_i
189
+ when :Float
190
+ value.to_f
191
+ when :Boolean
192
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
193
+ true
194
+ else
195
+ false
196
+ end
197
+ when :Object
198
+ # generic object (usually a Hash), return directly
199
+ value
200
+ when /\AArray<(?<inner_type>.+)>\z/
201
+ inner_type = Regexp.last_match[:inner_type]
202
+ value.map { |v| _deserialize(inner_type, v) }
203
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
204
+ k_type = Regexp.last_match[:k_type]
205
+ v_type = Regexp.last_match[:v_type]
206
+ {}.tap do |hash|
207
+ value.each do |k, v|
208
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
209
+ end
210
+ end
211
+ else # model
212
+ # models (e.g. Pet) or oneOf
213
+ klass = MuxRuby.const_get(type)
214
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ # Returns the string representation of the object
219
+ # @return [String] String presentation of the object
220
+ def to_s
221
+ to_hash.to_s
222
+ end
223
+
224
+ # to_body is an alias to to_hash (backward compatibility)
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_body
227
+ to_hash
228
+ end
229
+
230
+ # Returns the object in the form of hash
231
+ # @return [Hash] Returns the object in the form of hash
232
+ def to_hash
233
+ hash = {}
234
+ self.class.attribute_map.each_pair do |attr, param|
235
+ value = self.send(attr)
236
+ if value.nil?
237
+ is_nullable = self.class.openapi_nullable.include?(attr)
238
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
239
+ end
240
+
241
+ hash[param] = _to_hash(value)
242
+ end
243
+ hash
244
+ end
245
+
246
+ # Outputs non-array value in the form of hash
247
+ # For object, use to_hash. Otherwise, just return the value
248
+ # @param [Object] value Any valid value
249
+ # @return [Hash] Returns the value in the form of hash
250
+ def _to_hash(value)
251
+ if value.is_a?(Array)
252
+ value.compact.map { |v| _to_hash(v) }
253
+ elsif value.is_a?(Hash)
254
+ {}.tap do |hash|
255
+ value.each { |k, v| hash[k] = _to_hash(v) }
256
+ end
257
+ elsif value.respond_to? :to_hash
258
+ value.to_hash
259
+ else
260
+ value
261
+ end
262
+ end
263
+
264
+ end
265
+
266
+ end
@@ -21,7 +21,7 @@ module MuxRuby
21
21
  # Stream Key represents a stream identifier on the third party live streaming service to send the parent live stream to.
22
22
  attr_accessor :stream_key
23
23
 
24
- # RTMP hostname including application name for the third party live streaming service. Example: 'rtmp://live.example.com/app'.
24
+ # RTMP hostname including application name for the third party live streaming service. Example: `rtmp://live.example.com/app`.
25
25
  attr_accessor :url
26
26
 
27
27
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -0,0 +1,242 @@
1
+ =begin
2
+ #Mux API
3
+
4
+ #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: devex@mux.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module MuxRuby
17
+ class CreateSpaceRequest
18
+ attr_accessor :type
19
+
20
+ # Arbitrary user-supplied metadata that will be included in the space details and related webhooks. Max: 255 characters.
21
+ attr_accessor :passthrough
22
+
23
+ # An array of broadcast destinations you want to stream the space to. **Note:** By default only a single broadcast destination can be specified. Contact Mux support if you need more.
24
+ attr_accessor :broadcasts
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'type' => :'type',
30
+ :'passthrough' => :'passthrough',
31
+ :'broadcasts' => :'broadcasts'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'type' => :'SpaceType',
44
+ :'passthrough' => :'String',
45
+ :'broadcasts' => :'Array<CreateBroadcastRequest>'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::CreateSpaceRequest` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::CreateSpaceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'type')
71
+ self.type = attributes[:'type']
72
+ else
73
+ self.type = 'server'
74
+ end
75
+
76
+ if attributes.key?(:'passthrough')
77
+ self.passthrough = attributes[:'passthrough']
78
+ end
79
+
80
+ if attributes.key?(:'broadcasts')
81
+ if (value = attributes[:'broadcasts']).is_a?(Array)
82
+ self.broadcasts = value
83
+ end
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ type == o.type &&
106
+ passthrough == o.passthrough &&
107
+ broadcasts == o.broadcasts
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Integer] Hash code
118
+ def hash
119
+ [type, passthrough, broadcasts].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def self.build_from_hash(attributes)
126
+ new.build_from_hash(attributes)
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.openapi_types.each_pair do |key, type|
135
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
136
+ self.send("#{key}=", nil)
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
141
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
+ end
143
+ elsif !attributes[self.class.attribute_map[key]].nil?
144
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
145
+ end
146
+ end
147
+
148
+ self
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def _deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = MuxRuby.const_get(type)
190
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end