mux_ruby 3.3.1 → 3.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) 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/AssetNonStandardInputReasons.md +2 -2
  6. data/docs/AssetResponse.md +1 -1
  7. data/docs/AssetsApi.md +8 -0
  8. data/docs/Broadcast.md +30 -0
  9. data/docs/BroadcastLayout.md +15 -0
  10. data/docs/BroadcastResolution.md +15 -0
  11. data/docs/BroadcastResponse.md +18 -0
  12. data/docs/BroadcastStatus.md +15 -0
  13. data/docs/CreateBroadcastRequest.md +26 -0
  14. data/docs/CreateLiveStreamRequest.md +3 -1
  15. data/docs/CreatePlaybackIDResponse.md +1 -1
  16. data/docs/CreatePlaybackRestrictionRequest.md +1 -1
  17. data/docs/CreateSimulcastTargetRequest.md +1 -1
  18. data/docs/CreateSpaceRequest.md +22 -0
  19. data/docs/CreateTrackResponse.md +1 -1
  20. data/docs/DirectUploadsApi.md +6 -0
  21. data/docs/GetAssetPlaybackIDResponse.md +1 -1
  22. data/docs/GetLiveStreamPlaybackIDResponse.md +1 -1
  23. data/docs/IncidentResponse.md +1 -1
  24. data/docs/InputSettings.md +3 -3
  25. data/docs/ListSpacesResponse.md +18 -0
  26. data/docs/LiveStream.md +3 -1
  27. data/docs/LiveStreamResponse.md +1 -1
  28. data/docs/LiveStreamsApi.md +16 -4
  29. data/docs/MetricsApi.md +3 -3
  30. data/docs/PlaybackRestrictionResponse.md +1 -1
  31. data/docs/PlaybackRestrictionsApi.md +6 -6
  32. data/docs/RealTimeApi.md +2 -2
  33. data/docs/SigningKeyResponse.md +1 -1
  34. data/docs/SimulcastTargetResponse.md +1 -1
  35. data/docs/Space.md +30 -0
  36. data/docs/SpaceResponse.md +18 -0
  37. data/docs/SpaceStatus.md +15 -0
  38. data/docs/SpaceType.md +15 -0
  39. data/docs/SpacesApi.md +658 -0
  40. data/docs/StartSpaceBroadcastResponse.md +18 -0
  41. data/docs/StopSpaceBroadcastResponse.md +18 -0
  42. data/docs/Track.md +9 -7
  43. data/docs/UpdateLiveStreamRequest.md +3 -1
  44. data/docs/UpdateReferrerDomainRestrictionRequest.md +37 -5
  45. data/docs/UploadResponse.md +1 -1
  46. data/docs/VideoViewResponse.md +1 -1
  47. data/gen/generator-config.json +1 -1
  48. data/gen/templates/README.mustache +9 -3
  49. data/lib/mux_ruby/api/assets_api.rb +8 -0
  50. data/lib/mux_ruby/api/direct_uploads_api.rb +6 -0
  51. data/lib/mux_ruby/api/live_streams_api.rb +14 -2
  52. data/lib/mux_ruby/api/metrics_api.rb +5 -5
  53. data/lib/mux_ruby/api/playback_restrictions_api.rb +9 -9
  54. data/lib/mux_ruby/api/real_time_api.rb +2 -2
  55. data/lib/mux_ruby/api/spaces_api.rb +619 -0
  56. data/lib/mux_ruby/models/abridged_video_view.rb +7 -0
  57. data/lib/mux_ruby/models/asset.rb +1 -1
  58. data/lib/mux_ruby/models/asset_non_standard_input_reasons.rb +2 -2
  59. data/lib/mux_ruby/models/broadcast.rb +305 -0
  60. data/lib/mux_ruby/models/broadcast_layout.rb +37 -0
  61. data/lib/mux_ruby/models/broadcast_resolution.rb +41 -0
  62. data/lib/mux_ruby/models/broadcast_response.rb +223 -0
  63. data/lib/mux_ruby/models/broadcast_status.rb +37 -0
  64. data/lib/mux_ruby/models/create_broadcast_request.rb +266 -0
  65. data/lib/mux_ruby/models/create_live_stream_request.rb +40 -4
  66. data/lib/mux_ruby/models/create_simulcast_target_request.rb +1 -1
  67. data/lib/mux_ruby/models/create_space_request.rb +242 -0
  68. data/lib/mux_ruby/models/input_settings.rb +3 -3
  69. data/lib/mux_ruby/models/list_spaces_response.rb +225 -0
  70. data/lib/mux_ruby/models/live_stream.rb +40 -4
  71. data/lib/mux_ruby/models/space.rb +301 -0
  72. data/lib/mux_ruby/models/space_response.rb +223 -0
  73. data/lib/mux_ruby/models/space_status.rb +37 -0
  74. data/lib/mux_ruby/models/space_type.rb +36 -0
  75. data/lib/mux_ruby/models/start_space_broadcast_response.rb +218 -0
  76. data/lib/mux_ruby/models/stop_space_broadcast_response.rb +218 -0
  77. data/lib/mux_ruby/models/track.rb +32 -10
  78. data/lib/mux_ruby/models/update_live_stream_request.rb +40 -4
  79. data/lib/mux_ruby/models/update_referrer_domain_restriction_request.rb +74 -179
  80. data/lib/mux_ruby/models/video_view.rb +103 -0
  81. data/lib/mux_ruby/version.rb +1 -1
  82. data/lib/mux_ruby.rb +15 -0
  83. data/spec/api/spaces_api_spec.rb +149 -0
  84. data/spec/models/broadcast_layout_spec.rb +28 -0
  85. data/spec/models/broadcast_resolution_spec.rb +28 -0
  86. data/spec/models/broadcast_response_spec.rb +34 -0
  87. data/spec/models/broadcast_spec.rb +70 -0
  88. data/spec/models/broadcast_status_spec.rb +28 -0
  89. data/spec/models/create_broadcast_request_spec.rb +58 -0
  90. data/spec/models/create_space_request_spec.rb +46 -0
  91. data/spec/models/list_spaces_response_spec.rb +34 -0
  92. data/spec/models/space_response_spec.rb +34 -0
  93. data/spec/models/space_spec.rb +70 -0
  94. data/spec/models/space_status_spec.rb +28 -0
  95. data/spec/models/space_type_spec.rb +28 -0
  96. data/spec/models/start_space_broadcast_response_spec.rb +34 -0
  97. data/spec/models/stop_space_broadcast_response_spec.rb +34 -0
  98. metadata +159 -99
@@ -0,0 +1,305 @@
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 Broadcast
18
+ # Unique identifier for the broadcast. Max 255 characters.
19
+ attr_accessor :id
20
+
21
+ # Arbitrary user-supplied metadata that will be included in the broadcast details and related webhooks. Max: 255 characters.
22
+ attr_accessor :passthrough
23
+
24
+ # The ID of the live stream that the broadcast will be sent to.
25
+ attr_accessor :live_stream_id
26
+
27
+ attr_accessor :status
28
+
29
+ attr_accessor :layout
30
+
31
+ # URL of an image to display as the background of the broadcast. Its dimensions should match the provided resolution.
32
+ attr_accessor :background
33
+
34
+ attr_accessor :resolution
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'id' => :'id',
40
+ :'passthrough' => :'passthrough',
41
+ :'live_stream_id' => :'live_stream_id',
42
+ :'status' => :'status',
43
+ :'layout' => :'layout',
44
+ :'background' => :'background',
45
+ :'resolution' => :'resolution'
46
+ }
47
+ end
48
+
49
+ # Returns all the JSON keys this model knows about
50
+ def self.acceptable_attributes
51
+ attribute_map.values
52
+ end
53
+
54
+ # Attribute type mapping.
55
+ def self.openapi_types
56
+ {
57
+ :'id' => :'String',
58
+ :'passthrough' => :'String',
59
+ :'live_stream_id' => :'String',
60
+ :'status' => :'BroadcastStatus',
61
+ :'layout' => :'BroadcastLayout',
62
+ :'background' => :'String',
63
+ :'resolution' => :'BroadcastResolution'
64
+ }
65
+ end
66
+
67
+ # List of attributes with nullable: true
68
+ def self.openapi_nullable
69
+ Set.new([
70
+ ])
71
+ end
72
+
73
+ # Initializes the object
74
+ # @param [Hash] attributes Model attributes in the form of hash
75
+ def initialize(attributes = {})
76
+ if (!attributes.is_a?(Hash))
77
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::Broadcast` initialize method"
78
+ end
79
+
80
+ # check to see if the attribute exists and convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h|
82
+ if (!self.class.attribute_map.key?(k.to_sym))
83
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::Broadcast`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
84
+ end
85
+ h[k.to_sym] = v
86
+ }
87
+
88
+ if attributes.key?(:'id')
89
+ self.id = attributes[:'id']
90
+ end
91
+
92
+ if attributes.key?(:'passthrough')
93
+ self.passthrough = attributes[:'passthrough']
94
+ end
95
+
96
+ if attributes.key?(:'live_stream_id')
97
+ self.live_stream_id = attributes[:'live_stream_id']
98
+ end
99
+
100
+ if attributes.key?(:'status')
101
+ self.status = attributes[:'status']
102
+ end
103
+
104
+ if attributes.key?(:'layout')
105
+ self.layout = attributes[:'layout']
106
+ else
107
+ self.layout = 'gallery'
108
+ end
109
+
110
+ if attributes.key?(:'background')
111
+ self.background = attributes[:'background']
112
+ end
113
+
114
+ if attributes.key?(:'resolution')
115
+ self.resolution = attributes[:'resolution']
116
+ else
117
+ self.resolution = '1920x1080'
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ invalid_properties = Array.new
125
+ if @id.nil?
126
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
127
+ end
128
+
129
+ if @live_stream_id.nil?
130
+ invalid_properties.push('invalid value for "live_stream_id", live_stream_id cannot be nil.')
131
+ end
132
+
133
+ if @status.nil?
134
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
135
+ end
136
+
137
+ if @layout.nil?
138
+ invalid_properties.push('invalid value for "layout", layout cannot be nil.')
139
+ end
140
+
141
+ if @resolution.nil?
142
+ invalid_properties.push('invalid value for "resolution", resolution cannot be nil.')
143
+ end
144
+
145
+ invalid_properties
146
+ end
147
+
148
+ # Check to see if the all the properties in the model are valid
149
+ # @return true if the model is valid
150
+ def valid?
151
+ return false if @id.nil?
152
+ return false if @live_stream_id.nil?
153
+ return false if @status.nil?
154
+ return false if @layout.nil?
155
+ return false if @resolution.nil?
156
+ true
157
+ end
158
+
159
+ # Checks equality by comparing each attribute.
160
+ # @param [Object] Object to be compared
161
+ def ==(o)
162
+ return true if self.equal?(o)
163
+ self.class == o.class &&
164
+ id == o.id &&
165
+ passthrough == o.passthrough &&
166
+ live_stream_id == o.live_stream_id &&
167
+ status == o.status &&
168
+ layout == o.layout &&
169
+ background == o.background &&
170
+ resolution == o.resolution
171
+ end
172
+
173
+ # @see the `==` method
174
+ # @param [Object] Object to be compared
175
+ def eql?(o)
176
+ self == o
177
+ end
178
+
179
+ # Calculates hash code according to all attributes.
180
+ # @return [Integer] Hash code
181
+ def hash
182
+ [id, passthrough, live_stream_id, status, layout, background, resolution].hash
183
+ end
184
+
185
+ # Builds the object from hash
186
+ # @param [Hash] attributes Model attributes in the form of hash
187
+ # @return [Object] Returns the model itself
188
+ def self.build_from_hash(attributes)
189
+ new.build_from_hash(attributes)
190
+ end
191
+
192
+ # Builds the object from hash
193
+ # @param [Hash] attributes Model attributes in the form of hash
194
+ # @return [Object] Returns the model itself
195
+ def build_from_hash(attributes)
196
+ return nil unless attributes.is_a?(Hash)
197
+ self.class.openapi_types.each_pair do |key, type|
198
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
199
+ self.send("#{key}=", nil)
200
+ elsif type =~ /\AArray<(.*)>/i
201
+ # check to ensure the input is an array given that the attribute
202
+ # is documented as an array but the input is not
203
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
204
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
205
+ end
206
+ elsif !attributes[self.class.attribute_map[key]].nil?
207
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
208
+ end
209
+ end
210
+
211
+ self
212
+ end
213
+
214
+ # Deserializes the data based on type
215
+ # @param string type Data type
216
+ # @param string value Value to be deserialized
217
+ # @return [Object] Deserialized data
218
+ def _deserialize(type, value)
219
+ case type.to_sym
220
+ when :Time
221
+ Time.parse(value)
222
+ when :Date
223
+ Date.parse(value)
224
+ when :String
225
+ value.to_s
226
+ when :Integer
227
+ value.to_i
228
+ when :Float
229
+ value.to_f
230
+ when :Boolean
231
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
232
+ true
233
+ else
234
+ false
235
+ end
236
+ when :Object
237
+ # generic object (usually a Hash), return directly
238
+ value
239
+ when /\AArray<(?<inner_type>.+)>\z/
240
+ inner_type = Regexp.last_match[:inner_type]
241
+ value.map { |v| _deserialize(inner_type, v) }
242
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
243
+ k_type = Regexp.last_match[:k_type]
244
+ v_type = Regexp.last_match[:v_type]
245
+ {}.tap do |hash|
246
+ value.each do |k, v|
247
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
248
+ end
249
+ end
250
+ else # model
251
+ # models (e.g. Pet) or oneOf
252
+ klass = MuxRuby.const_get(type)
253
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
254
+ end
255
+ end
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # to_body is an alias to to_hash (backward compatibility)
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_body
266
+ to_hash
267
+ end
268
+
269
+ # Returns the object in the form of hash
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_hash
272
+ hash = {}
273
+ self.class.attribute_map.each_pair do |attr, param|
274
+ value = self.send(attr)
275
+ if value.nil?
276
+ is_nullable = self.class.openapi_nullable.include?(attr)
277
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
278
+ end
279
+
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+
303
+ end
304
+
305
+ end
@@ -0,0 +1,37 @@
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 BroadcastLayout
18
+ GALLERY = "gallery".freeze
19
+ ACTIVE_SPEAKER = "active-speaker".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = BroadcastLayout.constants.select { |c| BroadcastLayout::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #BroadcastLayout" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,41 @@
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 BroadcastResolution
18
+ N1920X1080 = "1920x1080".freeze
19
+ N1280X720 = "1280x720".freeze
20
+ N1080X1920 = "1080x1920".freeze
21
+ N720X1280 = "720x1280".freeze
22
+ N1080X1080 = "1080x1080".freeze
23
+ N720X720 = "720x720".freeze
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ constantValues = BroadcastResolution.constants.select { |c| BroadcastResolution::const_get(c) == value }
37
+ raise "Invalid ENUM value #{value} for class #BroadcastResolution" if constantValues.empty?
38
+ value
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,223 @@
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 BroadcastResponse
18
+ attr_accessor :data
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'data' => :'data'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'data' => :'Broadcast'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `MuxRuby::BroadcastResponse` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `MuxRuby::BroadcastResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'data')
61
+ self.data = attributes[:'data']
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ if @data.nil?
70
+ invalid_properties.push('invalid value for "data", data cannot be nil.')
71
+ end
72
+
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ return false if @data.nil?
80
+ true
81
+ end
82
+
83
+ # Checks equality by comparing each attribute.
84
+ # @param [Object] Object to be compared
85
+ def ==(o)
86
+ return true if self.equal?(o)
87
+ self.class == o.class &&
88
+ data == o.data
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [data].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
117
+ self.send("#{key}=", nil)
118
+ elsif type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :Time
139
+ Time.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ # models (e.g. Pet) or oneOf
170
+ klass = MuxRuby.const_get(type)
171
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+
221
+ end
222
+
223
+ end
@@ -0,0 +1,37 @@
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 BroadcastStatus
18
+ IDLE = "idle".freeze
19
+ ACTIVE = "active".freeze
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ constantValues = BroadcastStatus.constants.select { |c| BroadcastStatus::const_get(c) == value }
33
+ raise "Invalid ENUM value #{value} for class #BroadcastStatus" if constantValues.empty?
34
+ value
35
+ end
36
+ end
37
+ end