mux_ruby 3.20.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +4 -4
  4. data/docs/Asset.md +4 -2
  5. data/docs/AssetMetadata.md +22 -0
  6. data/docs/AssetStaticRenditions.md +2 -2
  7. data/docs/AssetsApi.md +146 -1
  8. data/docs/CreateAssetRequest.md +14 -6
  9. data/docs/CreateLiveStreamRequest.md +4 -2
  10. data/docs/CreateStaticRenditionRequest.md +20 -0
  11. data/docs/CreateStaticRenditionResponse.md +18 -0
  12. data/docs/InputSettings.md +1 -1
  13. data/docs/LiveStreamsApi.md +143 -0
  14. data/docs/PlaybackRestrictionsApi.md +1 -1
  15. data/docs/StaticRendition.md +40 -0
  16. data/docs/UpdateAssetRequest.md +4 -2
  17. data/docs/UpdateLiveStreamNewAssetSettings.md +6 -2
  18. data/docs/UpdateLiveStreamNewAssetSettingsStaticRenditionsRequest.md +18 -0
  19. data/docs/UpdateReferrerDomainRestrictionRequest.md +10 -37
  20. data/docs/Upload.md +1 -1
  21. data/docs/VideoView.md +35 -1
  22. data/examples/video/exercise-assets.rb +1 -1
  23. data/gen/generator-config.json +1 -1
  24. data/lib/mux_ruby/api/assets_api.rb +140 -2
  25. data/lib/mux_ruby/api/live_streams_api.rb +132 -0
  26. data/lib/mux_ruby/api/metrics_api.rb +2 -2
  27. data/lib/mux_ruby/models/asset.rb +14 -5
  28. data/lib/mux_ruby/models/{space_response.rb → asset_metadata.rb} +74 -13
  29. data/lib/mux_ruby/models/asset_static_renditions.rb +2 -2
  30. data/lib/mux_ruby/models/create_asset_request.rb +54 -9
  31. data/lib/mux_ruby/models/create_live_stream_request.rb +15 -2
  32. data/lib/mux_ruby/models/{create_broadcast_request.rb → create_static_rendition_request.rb} +49 -53
  33. data/lib/mux_ruby/models/{start_space_broadcast_response.rb → create_static_rendition_response.rb} +4 -4
  34. data/lib/mux_ruby/models/input_settings.rb +1 -1
  35. data/lib/mux_ruby/models/{asset_static_renditions_files.rb → static_rendition.rb} +118 -9
  36. data/lib/mux_ruby/models/update_asset_request.rb +14 -5
  37. data/lib/mux_ruby/models/update_live_stream_new_asset_settings.rb +37 -6
  38. data/lib/mux_ruby/models/{list_spaces_response.rb → update_live_stream_new_asset_settings_static_renditions_request.rb} +11 -16
  39. data/lib/mux_ruby/models/update_referrer_domain_restriction_request.rb +203 -73
  40. data/lib/mux_ruby/models/upload.rb +1 -1
  41. data/lib/mux_ruby/models/video_view.rb +171 -4
  42. data/lib/mux_ruby/version.rb +1 -1
  43. data/lib/mux_ruby.rb +5 -16
  44. data/spec/models/asset_metadata_spec.rb +46 -0
  45. data/spec/models/create_static_rendition_request_spec.rb +44 -0
  46. data/spec/models/create_static_rendition_response_spec.rb +34 -0
  47. data/spec/models/static_rendition_spec.rb +124 -0
  48. data/spec/models/update_live_stream_new_asset_settings_static_renditions_request_spec.rb +34 -0
  49. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/byebug/byebug.so +0 -0
  50. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-11.1.3/gem_make.out +8 -8
  51. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/ffi_c.so +0 -0
  52. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/gem_make.out +6 -6
  53. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/ffi-1.16.3/mkmf.log +19 -19
  54. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +7 -7
  55. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/jaro_winkler/jaro_winkler_ext.so +0 -0
  56. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/gem_make.out +6 -6
  57. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/mkmf.log +5 -5
  58. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-4.0.4/psych.so +0 -0
  59. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/gem_make.out +6 -6
  60. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/mkmf.log +2 -2
  61. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.0.2/stringio.so +0 -0
  62. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/ext/byebug/Makefile +3 -3
  63. data/vendor/bundle/ruby/3.2.0/gems/byebug-11.1.3/lib/byebug/byebug.so +0 -0
  64. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/ext/ffi_c/Makefile +3 -3
  65. data/vendor/bundle/ruby/3.2.0/gems/ffi-1.16.3/lib/ffi_c.so +0 -0
  66. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/ext/jaro_winkler/Makefile +3 -3
  67. data/vendor/bundle/ruby/3.2.0/gems/jaro_winkler-1.5.6/lib/jaro_winkler/jaro_winkler_ext.so +0 -0
  68. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/ext/psych/Makefile +3 -3
  69. data/vendor/bundle/ruby/3.2.0/gems/psych-4.0.4/lib/psych.so +0 -0
  70. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/ext/stringio/Makefile +3 -3
  71. data/vendor/bundle/ruby/3.2.0/gems/stringio-3.0.2/lib/stringio.so +0 -0
  72. metadata +184 -199
  73. data/docs/AssetStaticRenditionsFiles.md +0 -28
  74. data/docs/Broadcast.md +0 -30
  75. data/docs/BroadcastLayout.md +0 -15
  76. data/docs/BroadcastResolution.md +0 -15
  77. data/docs/BroadcastResponse.md +0 -18
  78. data/docs/BroadcastStatus.md +0 -15
  79. data/docs/CreateBroadcastRequest.md +0 -26
  80. data/docs/CreateSpaceRequest.md +0 -22
  81. data/docs/ListSpacesResponse.md +0 -18
  82. data/docs/Space.md +0 -30
  83. data/docs/SpaceResponse.md +0 -18
  84. data/docs/SpaceStatus.md +0 -15
  85. data/docs/SpaceType.md +0 -15
  86. data/docs/SpacesApi.md +0 -658
  87. data/docs/StartSpaceBroadcastResponse.md +0 -18
  88. data/docs/StopSpaceBroadcastResponse.md +0 -18
  89. data/lib/mux_ruby/api/spaces_api.rb +0 -619
  90. data/lib/mux_ruby/models/broadcast.rb +0 -305
  91. data/lib/mux_ruby/models/broadcast_layout.rb +0 -38
  92. data/lib/mux_ruby/models/broadcast_resolution.rb +0 -41
  93. data/lib/mux_ruby/models/broadcast_response.rb +0 -223
  94. data/lib/mux_ruby/models/broadcast_status.rb +0 -37
  95. data/lib/mux_ruby/models/create_space_request.rb +0 -242
  96. data/lib/mux_ruby/models/space.rb +0 -301
  97. data/lib/mux_ruby/models/space_status.rb +0 -37
  98. data/lib/mux_ruby/models/space_type.rb +0 -36
  99. data/lib/mux_ruby/models/stop_space_broadcast_response.rb +0 -218
@@ -1,305 +0,0 @@
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
@@ -1,38 +0,0 @@
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
- CROP = "crop".freeze
21
-
22
- # Builds the enum from string
23
- # @param [String] The enum value in the form of the string
24
- # @return [String] The enum value
25
- def self.build_from_hash(value)
26
- new.build_from_hash(value)
27
- end
28
-
29
- # Builds the enum from string
30
- # @param [String] The enum value in the form of the string
31
- # @return [String] The enum value
32
- def build_from_hash(value)
33
- constantValues = BroadcastLayout.constants.select { |c| BroadcastLayout::const_get(c) == value }
34
- raise "Invalid ENUM value #{value} for class #BroadcastLayout" if constantValues.empty?
35
- value
36
- end
37
- end
38
- end
@@ -1,41 +0,0 @@
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
@@ -1,223 +0,0 @@
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
@@ -1,37 +0,0 @@
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