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