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,244 @@
|
|
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 'uri'
|
7
|
+
|
8
|
+
module MuxRuby
|
9
|
+
class Configuration
|
10
|
+
# Defines url scheme
|
11
|
+
attr_accessor :scheme
|
12
|
+
|
13
|
+
# Defines url host
|
14
|
+
attr_accessor :host
|
15
|
+
|
16
|
+
# Defines url base path
|
17
|
+
attr_accessor :base_path
|
18
|
+
|
19
|
+
# Defines API keys used with API Key authentications.
|
20
|
+
#
|
21
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
22
|
+
#
|
23
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
24
|
+
# config.api_key['api_key'] = 'xxx'
|
25
|
+
attr_accessor :api_key
|
26
|
+
|
27
|
+
# Defines API key prefixes used with API Key authentications.
|
28
|
+
#
|
29
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
30
|
+
#
|
31
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
32
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
33
|
+
attr_accessor :api_key_prefix
|
34
|
+
|
35
|
+
# Defines the username used with HTTP basic authentication.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :username
|
39
|
+
|
40
|
+
# Defines the password used with HTTP basic authentication.
|
41
|
+
#
|
42
|
+
# @return [String]
|
43
|
+
attr_accessor :password
|
44
|
+
|
45
|
+
# Defines the access token (Bearer) used with OAuth2.
|
46
|
+
attr_accessor :access_token
|
47
|
+
|
48
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
49
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
50
|
+
# Default to false.
|
51
|
+
#
|
52
|
+
# @return [true, false]
|
53
|
+
attr_accessor :debugging
|
54
|
+
|
55
|
+
# Defines the logger used for debugging.
|
56
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
57
|
+
#
|
58
|
+
# @return [#debug]
|
59
|
+
attr_accessor :logger
|
60
|
+
|
61
|
+
# Defines the temporary folder to store downloaded files
|
62
|
+
# (for API endpoints that have file response).
|
63
|
+
# Default to use `Tempfile`.
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
attr_accessor :temp_folder_path
|
67
|
+
|
68
|
+
# The time limit for HTTP request in seconds.
|
69
|
+
# Default to 0 (never times out).
|
70
|
+
attr_accessor :timeout
|
71
|
+
|
72
|
+
# Set this to false to skip client side validation in the operation.
|
73
|
+
# Default to true.
|
74
|
+
# @return [true, false]
|
75
|
+
attr_accessor :client_side_validation
|
76
|
+
|
77
|
+
### TLS/SSL setting
|
78
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
79
|
+
# Default to true.
|
80
|
+
#
|
81
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
82
|
+
#
|
83
|
+
# @return [true, false]
|
84
|
+
attr_accessor :verify_ssl
|
85
|
+
|
86
|
+
### TLS/SSL setting
|
87
|
+
# Set this to false to skip verifying SSL host name
|
88
|
+
# Default to true.
|
89
|
+
#
|
90
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
91
|
+
#
|
92
|
+
# @return [true, false]
|
93
|
+
attr_accessor :verify_ssl_host
|
94
|
+
|
95
|
+
### TLS/SSL setting
|
96
|
+
# Set this to customize the certificate file to verify the peer.
|
97
|
+
#
|
98
|
+
# @return [String] the path to the certificate file
|
99
|
+
#
|
100
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
101
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
102
|
+
attr_accessor :ssl_ca_cert
|
103
|
+
|
104
|
+
### TLS/SSL setting
|
105
|
+
# Client certificate file (for client certificate)
|
106
|
+
attr_accessor :cert_file
|
107
|
+
|
108
|
+
### TLS/SSL setting
|
109
|
+
# Client private key file (for client certificate)
|
110
|
+
attr_accessor :key_file
|
111
|
+
|
112
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
113
|
+
# Default to nil.
|
114
|
+
#
|
115
|
+
# @see The params_encoding option of Ethon. Related source code:
|
116
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
117
|
+
attr_accessor :params_encoding
|
118
|
+
|
119
|
+
attr_accessor :inject_format
|
120
|
+
|
121
|
+
attr_accessor :force_ending_format
|
122
|
+
|
123
|
+
def initialize
|
124
|
+
@scheme = 'https'
|
125
|
+
@host = 'api.mux.com'
|
126
|
+
@base_path = ''
|
127
|
+
@api_key = {}
|
128
|
+
@api_key_prefix = {}
|
129
|
+
@timeout = 0
|
130
|
+
@client_side_validation = true
|
131
|
+
@verify_ssl = true
|
132
|
+
@verify_ssl_host = true
|
133
|
+
@params_encoding = nil
|
134
|
+
@cert_file = nil
|
135
|
+
@key_file = nil
|
136
|
+
@debugging = false
|
137
|
+
@inject_format = false
|
138
|
+
@force_ending_format = false
|
139
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
140
|
+
|
141
|
+
yield(self) if block_given?
|
142
|
+
end
|
143
|
+
|
144
|
+
# The default Configuration object.
|
145
|
+
def self.default
|
146
|
+
@@default ||= Configuration.new
|
147
|
+
end
|
148
|
+
|
149
|
+
def configure
|
150
|
+
yield(self) if block_given?
|
151
|
+
end
|
152
|
+
|
153
|
+
def scheme=(scheme)
|
154
|
+
# remove :// from scheme
|
155
|
+
@scheme = scheme.sub(/:\/\//, '')
|
156
|
+
end
|
157
|
+
|
158
|
+
def host=(host)
|
159
|
+
# remove http(s):// and anything after a slash
|
160
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
161
|
+
end
|
162
|
+
|
163
|
+
def base_path=(base_path)
|
164
|
+
# Add leading and trailing slashes to base_path
|
165
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
166
|
+
@base_path = '' if @base_path == '/'
|
167
|
+
end
|
168
|
+
|
169
|
+
def base_url
|
170
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
171
|
+
URI.encode(url)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Gets API key (with prefix if set).
|
175
|
+
# @param [String] param_name the parameter name of API key auth
|
176
|
+
def api_key_with_prefix(param_name)
|
177
|
+
if @api_key_prefix[param_name]
|
178
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
179
|
+
else
|
180
|
+
@api_key[param_name]
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
# Gets Basic Auth token string
|
185
|
+
def basic_auth_token
|
186
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
187
|
+
end
|
188
|
+
|
189
|
+
# Returns Auth Settings hash for api client.
|
190
|
+
def auth_settings
|
191
|
+
{
|
192
|
+
'accessToken' =>
|
193
|
+
{
|
194
|
+
type: 'basic',
|
195
|
+
in: 'header',
|
196
|
+
key: 'Authorization',
|
197
|
+
value: basic_auth_token
|
198
|
+
},
|
199
|
+
}
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns an array of Server setting
|
203
|
+
def server_settings
|
204
|
+
[
|
205
|
+
{
|
206
|
+
url: "https://api.mux.com/",
|
207
|
+
description: "Mux Production Environment",
|
208
|
+
}
|
209
|
+
]
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns URL based on server settings
|
213
|
+
#
|
214
|
+
# @param index array index of the server settings
|
215
|
+
# @param variables hash of variable and the corresponding value
|
216
|
+
def server_url(index, variables = {})
|
217
|
+
servers = server_settings
|
218
|
+
|
219
|
+
# check array index out of bound
|
220
|
+
if (index < 0 || index > servers.size)
|
221
|
+
fail ArgumentError "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
222
|
+
end
|
223
|
+
|
224
|
+
server = servers[index]
|
225
|
+
url = server[:url]
|
226
|
+
|
227
|
+
# go through variable and assign a value
|
228
|
+
server[:variables].each do |name, variable|
|
229
|
+
if variables.key?(name)
|
230
|
+
if (server[:variables][name][:enum_values].include? variables[name])
|
231
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
232
|
+
else
|
233
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
234
|
+
end
|
235
|
+
else
|
236
|
+
# use default value
|
237
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
url
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,274 @@
|
|
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 AbridgedVideoView
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
attr_accessor :viewer_os_family
|
13
|
+
|
14
|
+
attr_accessor :viewer_application_name
|
15
|
+
|
16
|
+
attr_accessor :video_title
|
17
|
+
|
18
|
+
attr_accessor :total_row_count
|
19
|
+
|
20
|
+
attr_accessor :player_error_message
|
21
|
+
|
22
|
+
attr_accessor :player_error_code
|
23
|
+
|
24
|
+
attr_accessor :error_type_id
|
25
|
+
|
26
|
+
attr_accessor :country_code
|
27
|
+
|
28
|
+
attr_accessor :view_start
|
29
|
+
|
30
|
+
attr_accessor :view_end
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'id' => :'id',
|
36
|
+
:'viewer_os_family' => :'viewer_os_family',
|
37
|
+
:'viewer_application_name' => :'viewer_application_name',
|
38
|
+
:'video_title' => :'video_title',
|
39
|
+
:'total_row_count' => :'total_row_count',
|
40
|
+
:'player_error_message' => :'player_error_message',
|
41
|
+
:'player_error_code' => :'player_error_code',
|
42
|
+
:'error_type_id' => :'error_type_id',
|
43
|
+
:'country_code' => :'country_code',
|
44
|
+
:'view_start' => :'view_start',
|
45
|
+
:'view_end' => :'view_end'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.openapi_types
|
51
|
+
{
|
52
|
+
:'id' => :'String',
|
53
|
+
:'viewer_os_family' => :'String',
|
54
|
+
:'viewer_application_name' => :'String',
|
55
|
+
:'video_title' => :'String',
|
56
|
+
:'total_row_count' => :'Integer',
|
57
|
+
:'player_error_message' => :'String',
|
58
|
+
:'player_error_code' => :'String',
|
59
|
+
:'error_type_id' => :'Integer',
|
60
|
+
:'country_code' => :'String',
|
61
|
+
:'view_start' => :'String',
|
62
|
+
:'view_end' => :'String'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
return unless attributes.is_a?(Hash)
|
70
|
+
|
71
|
+
# convert string to symbol for hash key
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
73
|
+
|
74
|
+
if attributes.has_key?(:'id')
|
75
|
+
self.id = attributes[:'id']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'viewer_os_family')
|
79
|
+
self.viewer_os_family = attributes[:'viewer_os_family']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'viewer_application_name')
|
83
|
+
self.viewer_application_name = attributes[:'viewer_application_name']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'video_title')
|
87
|
+
self.video_title = attributes[:'video_title']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'total_row_count')
|
91
|
+
self.total_row_count = attributes[:'total_row_count']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'player_error_message')
|
95
|
+
self.player_error_message = attributes[:'player_error_message']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'player_error_code')
|
99
|
+
self.player_error_code = attributes[:'player_error_code']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'error_type_id')
|
103
|
+
self.error_type_id = attributes[:'error_type_id']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'country_code')
|
107
|
+
self.country_code = attributes[:'country_code']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'view_start')
|
111
|
+
self.view_start = attributes[:'view_start']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'view_end')
|
115
|
+
self.view_end = attributes[:'view_end']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properties with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
id == o.id &&
|
138
|
+
viewer_os_family == o.viewer_os_family &&
|
139
|
+
viewer_application_name == o.viewer_application_name &&
|
140
|
+
video_title == o.video_title &&
|
141
|
+
total_row_count == o.total_row_count &&
|
142
|
+
player_error_message == o.player_error_message &&
|
143
|
+
player_error_code == o.player_error_code &&
|
144
|
+
error_type_id == o.error_type_id &&
|
145
|
+
country_code == o.country_code &&
|
146
|
+
view_start == o.view_start &&
|
147
|
+
view_end == o.view_end
|
148
|
+
end
|
149
|
+
|
150
|
+
# @see the `==` method
|
151
|
+
# @param [Object] Object to be compared
|
152
|
+
def eql?(o)
|
153
|
+
self == o
|
154
|
+
end
|
155
|
+
|
156
|
+
# Calculates hash code according to all attributes.
|
157
|
+
# @return [Fixnum] Hash code
|
158
|
+
def hash
|
159
|
+
[id, viewer_os_family, viewer_application_name, video_title, total_row_count, player_error_message, player_error_code, error_type_id, country_code, view_start, view_end].hash
|
160
|
+
end
|
161
|
+
|
162
|
+
# Builds the object from hash
|
163
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
164
|
+
# @return [Object] Returns the model itself
|
165
|
+
def self.build_from_hash(attributes)
|
166
|
+
new.build_from_hash(attributes)
|
167
|
+
end
|
168
|
+
|
169
|
+
# Builds the object from hash
|
170
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
171
|
+
# @return [Object] Returns the model itself
|
172
|
+
def build_from_hash(attributes)
|
173
|
+
return nil unless attributes.is_a?(Hash)
|
174
|
+
self.class.openapi_types.each_pair do |key, type|
|
175
|
+
if type =~ /\AArray<(.*)>/i
|
176
|
+
# check to ensure the input is an array given that the attribute
|
177
|
+
# is documented as an array but the input is not
|
178
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
179
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
180
|
+
end
|
181
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
182
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
183
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
184
|
+
end
|
185
|
+
|
186
|
+
self
|
187
|
+
end
|
188
|
+
|
189
|
+
# Deserializes the data based on type
|
190
|
+
# @param string type Data type
|
191
|
+
# @param string value Value to be deserialized
|
192
|
+
# @return [Object] Deserialized data
|
193
|
+
def _deserialize(type, value)
|
194
|
+
case type.to_sym
|
195
|
+
when :DateTime
|
196
|
+
DateTime.parse(value)
|
197
|
+
when :Date
|
198
|
+
Date.parse(value)
|
199
|
+
when :String
|
200
|
+
value.to_s
|
201
|
+
when :Integer
|
202
|
+
value.to_i
|
203
|
+
when :Float
|
204
|
+
value.to_f
|
205
|
+
when :BOOLEAN
|
206
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
207
|
+
true
|
208
|
+
else
|
209
|
+
false
|
210
|
+
end
|
211
|
+
when :Object
|
212
|
+
# generic object (usually a Hash), return directly
|
213
|
+
value
|
214
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
215
|
+
inner_type = Regexp.last_match[:inner_type]
|
216
|
+
value.map { |v| _deserialize(inner_type, v) }
|
217
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
218
|
+
k_type = Regexp.last_match[:k_type]
|
219
|
+
v_type = Regexp.last_match[:v_type]
|
220
|
+
{}.tap do |hash|
|
221
|
+
value.each do |k, v|
|
222
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
else # model
|
226
|
+
MuxRuby.const_get(type).build_from_hash(value)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# Returns the string representation of the object
|
231
|
+
# @return [String] String presentation of the object
|
232
|
+
def to_s
|
233
|
+
to_hash.to_s
|
234
|
+
end
|
235
|
+
|
236
|
+
# to_body is an alias to to_hash (backward compatibility)
|
237
|
+
# @return [Hash] Returns the object in the form of hash
|
238
|
+
def to_body
|
239
|
+
to_hash
|
240
|
+
end
|
241
|
+
|
242
|
+
# Returns the object in the form of hash
|
243
|
+
# @return [Hash] Returns the object in the form of hash
|
244
|
+
def to_hash
|
245
|
+
hash = {}
|
246
|
+
self.class.attribute_map.each_pair do |attr, param|
|
247
|
+
value = self.send(attr)
|
248
|
+
next if value.nil?
|
249
|
+
hash[param] = _to_hash(value)
|
250
|
+
end
|
251
|
+
hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Outputs non-array value in the form of hash
|
255
|
+
# For object, use to_hash. Otherwise, just return the value
|
256
|
+
# @param [Object] value Any valid value
|
257
|
+
# @return [Hash] Returns the value in the form of hash
|
258
|
+
def _to_hash(value)
|
259
|
+
if value.is_a?(Array)
|
260
|
+
value.compact.map { |v| _to_hash(v) }
|
261
|
+
elsif value.is_a?(Hash)
|
262
|
+
{}.tap do |hash|
|
263
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
264
|
+
end
|
265
|
+
elsif value.respond_to? :to_hash
|
266
|
+
value.to_hash
|
267
|
+
else
|
268
|
+
value
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|