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,206 @@
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 GetMetricTimeseriesDataResponse
10
+ attr_accessor :data
11
+
12
+ attr_accessor :total_row_count
13
+
14
+ attr_accessor :timeframe
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'data' => :'data',
20
+ :'total_row_count' => :'total_row_count',
21
+ :'timeframe' => :'timeframe'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'data' => :'Array<Array<String>>',
29
+ :'total_row_count' => :'Integer',
30
+ :'timeframe' => :'Array<String>'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
+
42
+ if attributes.has_key?(:'data')
43
+ if (value = attributes[:'data']).is_a?(Array)
44
+ self.data = value
45
+ end
46
+ end
47
+
48
+ if attributes.has_key?(:'total_row_count')
49
+ self.total_row_count = attributes[:'total_row_count']
50
+ end
51
+
52
+ if attributes.has_key?(:'timeframe')
53
+ if (value = attributes[:'timeframe']).is_a?(Array)
54
+ self.timeframe = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ data == o.data &&
78
+ total_row_count == o.total_row_count &&
79
+ timeframe == o.timeframe
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [data, total_row_count, timeframe].hash
92
+ end
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ new.build_from_hash(attributes)
99
+ end
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.openapi_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :BOOLEAN
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ MuxRuby.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
180
+ next if value.nil?
181
+ hash[param] = _to_hash(value)
182
+ end
183
+ hash
184
+ end
185
+
186
+ # Outputs non-array value in the form of hash
187
+ # For object, use to_hash. Otherwise, just return the value
188
+ # @param [Object] value Any valid value
189
+ # @return [Hash] Returns the value in the form of hash
190
+ def _to_hash(value)
191
+ if value.is_a?(Array)
192
+ value.compact.map { |v| _to_hash(v) }
193
+ elsif value.is_a?(Hash)
194
+ {}.tap do |hash|
195
+ value.each { |k, v| hash[k] = _to_hash(v) }
196
+ end
197
+ elsif value.respond_to? :to_hash
198
+ value.to_hash
199
+ else
200
+ value
201
+ end
202
+ end
203
+
204
+ end
205
+
206
+ end
@@ -0,0 +1,204 @@
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 GetOverallValuesResponse
10
+ attr_accessor :data
11
+
12
+ attr_accessor :total_row_count
13
+
14
+ attr_accessor :timeframe
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'data' => :'data',
20
+ :'total_row_count' => :'total_row_count',
21
+ :'timeframe' => :'timeframe'
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.openapi_types
27
+ {
28
+ :'data' => :'OverallValues',
29
+ :'total_row_count' => :'Integer',
30
+ :'timeframe' => :'Array<String>'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
+
42
+ if attributes.has_key?(:'data')
43
+ self.data = attributes[:'data']
44
+ end
45
+
46
+ if attributes.has_key?(:'total_row_count')
47
+ self.total_row_count = attributes[:'total_row_count']
48
+ end
49
+
50
+ if attributes.has_key?(:'timeframe')
51
+ if (value = attributes[:'timeframe']).is_a?(Array)
52
+ self.timeframe = value
53
+ end
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ data == o.data &&
76
+ total_row_count == o.total_row_count &&
77
+ timeframe == o.timeframe
78
+ end
79
+
80
+ # @see the `==` method
81
+ # @param [Object] Object to be compared
82
+ def eql?(o)
83
+ self == o
84
+ end
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [data, total_row_count, timeframe].hash
90
+ end
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def self.build_from_hash(attributes)
96
+ new.build_from_hash(attributes)
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def build_from_hash(attributes)
103
+ return nil unless attributes.is_a?(Hash)
104
+ self.class.openapi_types.each_pair do |key, type|
105
+ if type =~ /\AArray<(.*)>/i
106
+ # check to ensure the input is an array given that the attribute
107
+ # is documented as an array but the input is not
108
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
109
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
113
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ # Deserializes the data based on type
120
+ # @param string type Data type
121
+ # @param string value Value to be deserialized
122
+ # @return [Object] Deserialized data
123
+ def _deserialize(type, value)
124
+ case type.to_sym
125
+ when :DateTime
126
+ DateTime.parse(value)
127
+ when :Date
128
+ Date.parse(value)
129
+ when :String
130
+ value.to_s
131
+ when :Integer
132
+ value.to_i
133
+ when :Float
134
+ value.to_f
135
+ when :BOOLEAN
136
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
137
+ true
138
+ else
139
+ false
140
+ end
141
+ when :Object
142
+ # generic object (usually a Hash), return directly
143
+ value
144
+ when /\AArray<(?<inner_type>.+)>\z/
145
+ inner_type = Regexp.last_match[:inner_type]
146
+ value.map { |v| _deserialize(inner_type, v) }
147
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
148
+ k_type = Regexp.last_match[:k_type]
149
+ v_type = Regexp.last_match[:v_type]
150
+ {}.tap do |hash|
151
+ value.each do |k, v|
152
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
153
+ end
154
+ end
155
+ else # model
156
+ MuxRuby.const_get(type).build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map { |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ end
@@ -0,0 +1,195 @@
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 InputFile
10
+ attr_accessor :container_format
11
+
12
+ attr_accessor :tracks
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :'container_format' => :'container_format',
18
+ :'tracks' => :'tracks'
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.openapi_types
24
+ {
25
+ :'container_format' => :'String',
26
+ :'tracks' => :'Array<InputTrack>'
27
+ }
28
+ end
29
+
30
+ # Initializes the object
31
+ # @param [Hash] attributes Model attributes in the form of hash
32
+ def initialize(attributes = {})
33
+ return unless attributes.is_a?(Hash)
34
+
35
+ # convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
37
+
38
+ if attributes.has_key?(:'container_format')
39
+ self.container_format = attributes[:'container_format']
40
+ end
41
+
42
+ if attributes.has_key?(:'tracks')
43
+ if (value = attributes[:'tracks']).is_a?(Array)
44
+ self.tracks = value
45
+ end
46
+ end
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properties with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ container_format == o.container_format &&
68
+ tracks == o.tracks
69
+ end
70
+
71
+ # @see the `==` method
72
+ # @param [Object] Object to be compared
73
+ def eql?(o)
74
+ self == o
75
+ end
76
+
77
+ # Calculates hash code according to all attributes.
78
+ # @return [Fixnum] Hash code
79
+ def hash
80
+ [container_format, tracks].hash
81
+ end
82
+
83
+ # Builds the object from hash
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @return [Object] Returns the model itself
86
+ def self.build_from_hash(attributes)
87
+ new.build_from_hash(attributes)
88
+ end
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.openapi_types.each_pair do |key, type|
96
+ if type =~ /\AArray<(.*)>/i
97
+ # check to ensure the input is an array given that the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
104
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+
110
+ # Deserializes the data based on type
111
+ # @param string type Data type
112
+ # @param string value Value to be deserialized
113
+ # @return [Object] Deserialized data
114
+ def _deserialize(type, value)
115
+ case type.to_sym
116
+ when :DateTime
117
+ DateTime.parse(value)
118
+ when :Date
119
+ Date.parse(value)
120
+ when :String
121
+ value.to_s
122
+ when :Integer
123
+ value.to_i
124
+ when :Float
125
+ value.to_f
126
+ when :BOOLEAN
127
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
128
+ true
129
+ else
130
+ false
131
+ end
132
+ when :Object
133
+ # generic object (usually a Hash), return directly
134
+ value
135
+ when /\AArray<(?<inner_type>.+)>\z/
136
+ inner_type = Regexp.last_match[:inner_type]
137
+ value.map { |v| _deserialize(inner_type, v) }
138
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
139
+ k_type = Regexp.last_match[:k_type]
140
+ v_type = Regexp.last_match[:v_type]
141
+ {}.tap do |hash|
142
+ value.each do |k, v|
143
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
144
+ end
145
+ end
146
+ else # model
147
+ MuxRuby.const_get(type).build_from_hash(value)
148
+ end
149
+ end
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # to_body is an alias to to_hash (backward compatibility)
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ next if value.nil?
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ # Outputs non-array value in the form of hash
176
+ # For object, use to_hash. Otherwise, just return the value
177
+ # @param [Object] value Any valid value
178
+ # @return [Hash] Returns the value in the form of hash
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map { |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ end
194
+
195
+ end