mux_ruby 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/Gemfile.lock +79 -0
  4. data/LICENSE +7 -0
  5. data/README.md +121 -0
  6. data/Rakefile +10 -0
  7. data/docs/AbridgedVideoView.md +18 -0
  8. data/docs/Asset.md +27 -0
  9. data/docs/AssetErrors.md +9 -0
  10. data/docs/AssetMaster.md +9 -0
  11. data/docs/AssetResponse.md +8 -0
  12. data/docs/AssetStaticRenditions.md +9 -0
  13. data/docs/AssetStaticRenditionsFiles.md +13 -0
  14. data/docs/AssetsApi.md +476 -0
  15. data/docs/BreakdownValue.md +12 -0
  16. data/docs/CreateAssetRequest.md +13 -0
  17. data/docs/CreateLiveStreamRequest.md +9 -0
  18. data/docs/CreatePlaybackIDRequest.md +8 -0
  19. data/docs/CreatePlaybackIDResponse.md +8 -0
  20. data/docs/CreateUploadRequest.md +10 -0
  21. data/docs/DirectUploadsApi.md +214 -0
  22. data/docs/Error.md +15 -0
  23. data/docs/ErrorsApi.md +64 -0
  24. data/docs/ExportsApi.md +56 -0
  25. data/docs/FilterValue.md +9 -0
  26. data/docs/FiltersApi.md +118 -0
  27. data/docs/GetAssetInputInfoResponse.md +8 -0
  28. data/docs/GetAssetPlaybackIDResponse.md +8 -0
  29. data/docs/GetMetricTimeseriesDataResponse.md +10 -0
  30. data/docs/GetOverallValuesResponse.md +10 -0
  31. data/docs/InputFile.md +9 -0
  32. data/docs/InputInfo.md +9 -0
  33. data/docs/InputSettings.md +10 -0
  34. data/docs/InputSettingsOverlaySettings.md +14 -0
  35. data/docs/InputTrack.md +18 -0
  36. data/docs/Insight.md +13 -0
  37. data/docs/ListAllMetricValuesResponse.md +10 -0
  38. data/docs/ListAssetsResponse.md +8 -0
  39. data/docs/ListBreakdownValuesResponse.md +10 -0
  40. data/docs/ListErrorsResponse.md +10 -0
  41. data/docs/ListExportsResponse.md +10 -0
  42. data/docs/ListFilterValuesResponse.md +10 -0
  43. data/docs/ListFiltersResponse.md +10 -0
  44. data/docs/ListFiltersResponseData.md +9 -0
  45. data/docs/ListInsightsResponse.md +10 -0
  46. data/docs/ListLiveStreamsResponse.md +8 -0
  47. data/docs/ListSigningKeysResponse.md +8 -0
  48. data/docs/ListUploadsResponse.md +8 -0
  49. data/docs/ListVideoViewsResponse.md +10 -0
  50. data/docs/LiveStream.md +17 -0
  51. data/docs/LiveStreamResponse.md +8 -0
  52. data/docs/LiveStreamsApi.md +420 -0
  53. data/docs/Metric.md +12 -0
  54. data/docs/MetricsApi.md +322 -0
  55. data/docs/OverallValues.md +11 -0
  56. data/docs/PlaybackID.md +9 -0
  57. data/docs/PlaybackPolicy.md +7 -0
  58. data/docs/Score.md +13 -0
  59. data/docs/SignalLiveStreamCompleteResponse.md +8 -0
  60. data/docs/SigningKey.md +10 -0
  61. data/docs/SigningKeyResponse.md +8 -0
  62. data/docs/Track.md +17 -0
  63. data/docs/URLSigningKeysApi.md +215 -0
  64. data/docs/UpdateAssetMP4SupportRequest.md +8 -0
  65. data/docs/Upload.md +15 -0
  66. data/docs/UploadError.md +9 -0
  67. data/docs/UploadResponse.md +8 -0
  68. data/docs/VideoView.md +117 -0
  69. data/docs/VideoViewEvent.md +11 -0
  70. data/docs/VideoViewResponse.md +9 -0
  71. data/docs/VideoViewsApi.md +126 -0
  72. data/examples/data/exercise-errors.rb +23 -0
  73. data/examples/data/exercise-exports.rb +22 -0
  74. data/examples/data/exercise-filters.rb +29 -0
  75. data/examples/data/exercise-metrics.rb +52 -0
  76. data/examples/data/exercise-video-views.rb +30 -0
  77. data/examples/video/create-live-stream.rb +25 -0
  78. data/examples/video/exercise-assets.rb +95 -0
  79. data/examples/video/exercise-live-streams.rb +89 -0
  80. data/examples/video/exercise-signing-keys.rb +46 -0
  81. data/examples/video/exercise-uploads.rb +49 -0
  82. data/examples/video/ingest.rb +37 -0
  83. data/examples/video/list-everything.rb +48 -0
  84. data/github-ruby-sdk.png +0 -0
  85. data/lib/mux_ruby/api/assets_api.rb +507 -0
  86. data/lib/mux_ruby/api/direct_uploads_api.rb +224 -0
  87. data/lib/mux_ruby/api/errors_api.rb +69 -0
  88. data/lib/mux_ruby/api/exports_api.rb +63 -0
  89. data/lib/mux_ruby/api/filters_api.rb +128 -0
  90. data/lib/mux_ruby/api/live_streams_api.rb +440 -0
  91. data/lib/mux_ruby/api/metrics_api.rb +393 -0
  92. data/lib/mux_ruby/api/url_signing_keys_api.rb +219 -0
  93. data/lib/mux_ruby/api/video_views_api.rb +140 -0
  94. data/lib/mux_ruby/api_client.rb +400 -0
  95. data/lib/mux_ruby/api_error.rb +44 -0
  96. data/lib/mux_ruby/configuration.rb +244 -0
  97. data/lib/mux_ruby/models/abridged_video_view.rb +274 -0
  98. data/lib/mux_ruby/models/asset.rb +409 -0
  99. data/lib/mux_ruby/models/asset_errors.rb +195 -0
  100. data/lib/mux_ruby/models/asset_master.rb +193 -0
  101. data/lib/mux_ruby/models/asset_response.rb +184 -0
  102. data/lib/mux_ruby/models/asset_static_renditions.rb +232 -0
  103. data/lib/mux_ruby/models/asset_static_renditions_files.rb +279 -0
  104. data/lib/mux_ruby/models/breakdown_value.rb +220 -0
  105. data/lib/mux_ruby/models/create_asset_request.rb +267 -0
  106. data/lib/mux_ruby/models/create_live_stream_request.rb +195 -0
  107. data/lib/mux_ruby/models/create_playback_id_request.rb +184 -0
  108. data/lib/mux_ruby/models/create_playback_id_response.rb +184 -0
  109. data/lib/mux_ruby/models/create_upload_request.rb +235 -0
  110. data/lib/mux_ruby/models/error.rb +247 -0
  111. data/lib/mux_ruby/models/filter_value.rb +193 -0
  112. data/lib/mux_ruby/models/get_asset_input_info_response.rb +186 -0
  113. data/lib/mux_ruby/models/get_asset_playback_id_response.rb +184 -0
  114. data/lib/mux_ruby/models/get_metric_timeseries_data_response.rb +206 -0
  115. data/lib/mux_ruby/models/get_overall_values_response.rb +204 -0
  116. data/lib/mux_ruby/models/input_file.rb +195 -0
  117. data/lib/mux_ruby/models/input_info.rb +193 -0
  118. data/lib/mux_ruby/models/input_settings.rb +203 -0
  119. data/lib/mux_ruby/models/input_settings_overlay_settings.rb +238 -0
  120. data/lib/mux_ruby/models/input_track.rb +274 -0
  121. data/lib/mux_ruby/models/insight.rb +229 -0
  122. data/lib/mux_ruby/models/list_all_metric_values_response.rb +206 -0
  123. data/lib/mux_ruby/models/list_assets_response.rb +186 -0
  124. data/lib/mux_ruby/models/list_breakdown_values_response.rb +206 -0
  125. data/lib/mux_ruby/models/list_errors_response.rb +206 -0
  126. data/lib/mux_ruby/models/list_exports_response.rb +206 -0
  127. data/lib/mux_ruby/models/list_filter_values_response.rb +206 -0
  128. data/lib/mux_ruby/models/list_filters_response.rb +204 -0
  129. data/lib/mux_ruby/models/list_filters_response_data.rb +197 -0
  130. data/lib/mux_ruby/models/list_insights_response.rb +206 -0
  131. data/lib/mux_ruby/models/list_live_streams_response.rb +186 -0
  132. data/lib/mux_ruby/models/list_signing_keys_response.rb +186 -0
  133. data/lib/mux_ruby/models/list_uploads_response.rb +186 -0
  134. data/lib/mux_ruby/models/list_video_views_response.rb +206 -0
  135. data/lib/mux_ruby/models/live_stream.rb +269 -0
  136. data/lib/mux_ruby/models/live_stream_response.rb +184 -0
  137. data/lib/mux_ruby/models/metric.rb +220 -0
  138. data/lib/mux_ruby/models/overall_values.rb +211 -0
  139. data/lib/mux_ruby/models/playback_id.rb +193 -0
  140. data/lib/mux_ruby/models/playback_policy.rb +31 -0
  141. data/lib/mux_ruby/models/score.rb +231 -0
  142. data/lib/mux_ruby/models/signal_live_stream_complete_response.rb +184 -0
  143. data/lib/mux_ruby/models/signing_key.rb +202 -0
  144. data/lib/mux_ruby/models/signing_key_response.rb +184 -0
  145. data/lib/mux_ruby/models/track.rb +265 -0
  146. data/lib/mux_ruby/models/update_asset_mp4_support_request.rb +219 -0
  147. data/lib/mux_ruby/models/upload.rb +311 -0
  148. data/lib/mux_ruby/models/upload_error.rb +194 -0
  149. data/lib/mux_ruby/models/upload_response.rb +184 -0
  150. data/lib/mux_ruby/models/video_view.rb +1167 -0
  151. data/lib/mux_ruby/models/video_view_event.rb +211 -0
  152. data/lib/mux_ruby/models/video_view_response.rb +195 -0
  153. data/lib/mux_ruby/version.rb +8 -0
  154. data/lib/mux_ruby.rb +97 -0
  155. data/mux_ruby.gemspec +38 -0
  156. data/spec/api/assets_api_spec.rb +136 -0
  157. data/spec/api/direct_uploads_api_spec.rb +74 -0
  158. data/spec/api/errors_api_spec.rb +41 -0
  159. data/spec/api/exports_api_spec.rb +39 -0
  160. data/spec/api/filters_api_spec.rb +55 -0
  161. data/spec/api/live_streams_api_spec.rb +122 -0
  162. data/spec/api/metrics_api_spec.rb +110 -0
  163. data/spec/api/url_signing_keys_api_spec.rb +76 -0
  164. data/spec/api/video_views_api_spec.rb +58 -0
  165. data/spec/api_client_spec.rb +219 -0
  166. data/spec/configuration_spec.rb +35 -0
  167. data/spec/models/abridged_video_view_spec.rb +94 -0
  168. data/spec/models/asset_errors_spec.rb +40 -0
  169. data/spec/models/asset_master_spec.rb +40 -0
  170. data/spec/models/asset_response_spec.rb +34 -0
  171. data/spec/models/asset_spec.rb +156 -0
  172. data/spec/models/asset_static_renditions_files_spec.rb +72 -0
  173. data/spec/models/asset_static_renditions_spec.rb +44 -0
  174. data/spec/models/breakdown_value_spec.rb +58 -0
  175. data/spec/models/create_asset_request_spec.rb +68 -0
  176. data/spec/models/create_live_stream_request_spec.rb +40 -0
  177. data/spec/models/create_playback_id_request_spec.rb +34 -0
  178. data/spec/models/create_playback_id_response_spec.rb +34 -0
  179. data/spec/models/create_upload_request_spec.rb +46 -0
  180. data/spec/models/error_spec.rb +76 -0
  181. data/spec/models/filter_value_spec.rb +40 -0
  182. data/spec/models/get_asset_input_info_response_spec.rb +34 -0
  183. data/spec/models/get_asset_playback_id_response_spec.rb +34 -0
  184. data/spec/models/get_metric_timeseries_data_response_spec.rb +46 -0
  185. data/spec/models/get_overall_values_response_spec.rb +46 -0
  186. data/spec/models/input_file_spec.rb +40 -0
  187. data/spec/models/input_info_spec.rb +40 -0
  188. data/spec/models/input_settings_overlay_settings_spec.rb +70 -0
  189. data/spec/models/input_settings_spec.rb +46 -0
  190. data/spec/models/input_track_spec.rb +94 -0
  191. data/spec/models/insight_spec.rb +64 -0
  192. data/spec/models/list_all_metric_values_response_spec.rb +46 -0
  193. data/spec/models/list_assets_response_spec.rb +34 -0
  194. data/spec/models/list_breakdown_values_response_spec.rb +46 -0
  195. data/spec/models/list_errors_response_spec.rb +46 -0
  196. data/spec/models/list_exports_response_spec.rb +46 -0
  197. data/spec/models/list_filter_values_response_spec.rb +46 -0
  198. data/spec/models/list_filters_response_data_spec.rb +40 -0
  199. data/spec/models/list_filters_response_spec.rb +46 -0
  200. data/spec/models/list_insights_response_spec.rb +46 -0
  201. data/spec/models/list_live_streams_response_spec.rb +34 -0
  202. data/spec/models/list_signing_keys_response_spec.rb +34 -0
  203. data/spec/models/list_uploads_response_spec.rb +34 -0
  204. data/spec/models/list_video_views_response_spec.rb +46 -0
  205. data/spec/models/live_stream_response_spec.rb +34 -0
  206. data/spec/models/live_stream_spec.rb +88 -0
  207. data/spec/models/metric_spec.rb +58 -0
  208. data/spec/models/overall_values_spec.rb +52 -0
  209. data/spec/models/playback_id_spec.rb +40 -0
  210. data/spec/models/playback_policy_spec.rb +28 -0
  211. data/spec/models/score_spec.rb +64 -0
  212. data/spec/models/signal_live_stream_complete_response_spec.rb +34 -0
  213. data/spec/models/signing_key_response_spec.rb +34 -0
  214. data/spec/models/signing_key_spec.rb +46 -0
  215. data/spec/models/track_spec.rb +88 -0
  216. data/spec/models/update_asset_mp4_support_request_spec.rb +38 -0
  217. data/spec/models/upload_error_spec.rb +40 -0
  218. data/spec/models/upload_response_spec.rb +34 -0
  219. data/spec/models/upload_spec.rb +80 -0
  220. data/spec/models/video_view_event_spec.rb +52 -0
  221. data/spec/models/video_view_response_spec.rb +40 -0
  222. data/spec/models/video_view_spec.rb +688 -0
  223. data/spec/spec_helper.rb +104 -0
  224. metadata +514 -0
@@ -0,0 +1,265 @@
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 Track
10
+ attr_accessor :id
11
+
12
+ attr_accessor :type
13
+
14
+ attr_accessor :duration
15
+
16
+ attr_accessor :max_width
17
+
18
+ attr_accessor :max_height
19
+
20
+ attr_accessor :max_frame_rate
21
+
22
+ attr_accessor :max_channels
23
+
24
+ attr_accessor :max_channel_layout
25
+
26
+ attr_accessor :text_track_type
27
+
28
+ attr_accessor :language
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'id' => :'id',
34
+ :'type' => :'type',
35
+ :'duration' => :'duration',
36
+ :'max_width' => :'max_width',
37
+ :'max_height' => :'max_height',
38
+ :'max_frame_rate' => :'max_frame_rate',
39
+ :'max_channels' => :'max_channels',
40
+ :'max_channel_layout' => :'max_channel_layout',
41
+ :'text_track_type' => :'text_track_type',
42
+ :'language' => :'language'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'id' => :'String',
50
+ :'type' => :'String',
51
+ :'duration' => :'Float',
52
+ :'max_width' => :'Integer',
53
+ :'max_height' => :'Integer',
54
+ :'max_frame_rate' => :'Float',
55
+ :'max_channels' => :'Integer',
56
+ :'max_channel_layout' => :'String',
57
+ :'text_track_type' => :'String',
58
+ :'language' => :'String'
59
+ }
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ return unless attributes.is_a?(Hash)
66
+
67
+ # convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
69
+
70
+ if attributes.has_key?(:'id')
71
+ self.id = attributes[:'id']
72
+ end
73
+
74
+ if attributes.has_key?(:'type')
75
+ self.type = attributes[:'type']
76
+ end
77
+
78
+ if attributes.has_key?(:'duration')
79
+ self.duration = attributes[:'duration']
80
+ end
81
+
82
+ if attributes.has_key?(:'max_width')
83
+ self.max_width = attributes[:'max_width']
84
+ end
85
+
86
+ if attributes.has_key?(:'max_height')
87
+ self.max_height = attributes[:'max_height']
88
+ end
89
+
90
+ if attributes.has_key?(:'max_frame_rate')
91
+ self.max_frame_rate = attributes[:'max_frame_rate']
92
+ end
93
+
94
+ if attributes.has_key?(:'max_channels')
95
+ self.max_channels = attributes[:'max_channels']
96
+ end
97
+
98
+ if attributes.has_key?(:'max_channel_layout')
99
+ self.max_channel_layout = attributes[:'max_channel_layout']
100
+ end
101
+
102
+ if attributes.has_key?(:'text_track_type')
103
+ self.text_track_type = attributes[:'text_track_type']
104
+ end
105
+
106
+ if attributes.has_key?(:'language')
107
+ self.language = attributes[:'language']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ id == o.id &&
130
+ type == o.type &&
131
+ duration == o.duration &&
132
+ max_width == o.max_width &&
133
+ max_height == o.max_height &&
134
+ max_frame_rate == o.max_frame_rate &&
135
+ max_channels == o.max_channels &&
136
+ max_channel_layout == o.max_channel_layout &&
137
+ text_track_type == o.text_track_type &&
138
+ language == o.language
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Fixnum] Hash code
149
+ def hash
150
+ [id, type, duration, max_width, max_height, max_frame_rate, max_channels, max_channel_layout, text_track_type, language].hash
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 self.build_from_hash(attributes)
157
+ new.build_from_hash(attributes)
158
+ end
159
+
160
+ # Builds the object from hash
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ # @return [Object] Returns the model itself
163
+ def build_from_hash(attributes)
164
+ return nil unless attributes.is_a?(Hash)
165
+ self.class.openapi_types.each_pair do |key, type|
166
+ if type =~ /\AArray<(.*)>/i
167
+ # check to ensure the input is an array given that the attribute
168
+ # is documented as an array but the input is not
169
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
170
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
171
+ end
172
+ elsif !attributes[self.class.attribute_map[key]].nil?
173
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
174
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
175
+ end
176
+
177
+ self
178
+ end
179
+
180
+ # Deserializes the data based on type
181
+ # @param string type Data type
182
+ # @param string value Value to be deserialized
183
+ # @return [Object] Deserialized data
184
+ def _deserialize(type, value)
185
+ case type.to_sym
186
+ when :DateTime
187
+ DateTime.parse(value)
188
+ when :Date
189
+ Date.parse(value)
190
+ when :String
191
+ value.to_s
192
+ when :Integer
193
+ value.to_i
194
+ when :Float
195
+ value.to_f
196
+ when :BOOLEAN
197
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
198
+ true
199
+ else
200
+ false
201
+ end
202
+ when :Object
203
+ # generic object (usually a Hash), return directly
204
+ value
205
+ when /\AArray<(?<inner_type>.+)>\z/
206
+ inner_type = Regexp.last_match[:inner_type]
207
+ value.map { |v| _deserialize(inner_type, v) }
208
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
209
+ k_type = Regexp.last_match[:k_type]
210
+ v_type = Regexp.last_match[:v_type]
211
+ {}.tap do |hash|
212
+ value.each do |k, v|
213
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
214
+ end
215
+ end
216
+ else # model
217
+ MuxRuby.const_get(type).build_from_hash(value)
218
+ end
219
+ end
220
+
221
+ # Returns the string representation of the object
222
+ # @return [String] String presentation of the object
223
+ def to_s
224
+ to_hash.to_s
225
+ end
226
+
227
+ # to_body is an alias to to_hash (backward compatibility)
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_body
230
+ to_hash
231
+ end
232
+
233
+ # Returns the object in the form of hash
234
+ # @return [Hash] Returns the object in the form of hash
235
+ def to_hash
236
+ hash = {}
237
+ self.class.attribute_map.each_pair do |attr, param|
238
+ value = self.send(attr)
239
+ next if value.nil?
240
+ hash[param] = _to_hash(value)
241
+ end
242
+ hash
243
+ end
244
+
245
+ # Outputs non-array value in the form of hash
246
+ # For object, use to_hash. Otherwise, just return the value
247
+ # @param [Object] value Any valid value
248
+ # @return [Hash] Returns the value in the form of hash
249
+ def _to_hash(value)
250
+ if value.is_a?(Array)
251
+ value.compact.map { |v| _to_hash(v) }
252
+ elsif value.is_a?(Hash)
253
+ {}.tap do |hash|
254
+ value.each { |k, v| hash[k] = _to_hash(v) }
255
+ end
256
+ elsif value.respond_to? :to_hash
257
+ value.to_hash
258
+ else
259
+ value
260
+ end
261
+ end
262
+
263
+ end
264
+
265
+ end
@@ -0,0 +1,219 @@
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 UpdateAssetMP4SupportRequest
10
+ # String value for the level of mp4 support
11
+ attr_accessor :mp4_support
12
+
13
+ class EnumAttributeValidator
14
+ attr_reader :datatype
15
+ attr_reader :allowable_values
16
+
17
+ def initialize(datatype, allowable_values)
18
+ @allowable_values = allowable_values.map do |value|
19
+ case datatype.to_s
20
+ when /Integer/i
21
+ value.to_i
22
+ when /Float/i
23
+ value.to_f
24
+ else
25
+ value
26
+ end
27
+ end
28
+ end
29
+
30
+ def valid?(value)
31
+ !value || allowable_values.include?(value)
32
+ end
33
+ end
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'mp4_support' => :'mp4_support'
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'mp4_support' => :'String'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'mp4_support')
58
+ self.mp4_support = attributes[:'mp4_support']
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
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
+ mp4_support_validator = EnumAttributeValidator.new('String', ['standard', 'none'])
73
+ return false unless mp4_support_validator.valid?(@mp4_support)
74
+ true
75
+ end
76
+
77
+ # Custom attribute writer method checking allowed values (enum).
78
+ # @param [Object] mp4_support Object to be assigned
79
+ def mp4_support=(mp4_support)
80
+ validator = EnumAttributeValidator.new('String', ['standard', 'none'])
81
+ unless validator.valid?(mp4_support)
82
+ fail ArgumentError, 'invalid value for "mp4_support", must be one of #{validator.allowable_values}.'
83
+ end
84
+ @mp4_support = mp4_support
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ mp4_support == o.mp4_support
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Fixnum] Hash code
103
+ def hash
104
+ [mp4_support].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :BOOLEAN
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ MuxRuby.const_get(type).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
+ next if value.nil?
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+
217
+ end
218
+
219
+ end