cloudmersive-video-api-client 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +116 -0
- data/Rakefile +8 -0
- data/cloudmersive-video-api-client.gemspec +45 -0
- data/docs/MediaInformation.md +17 -0
- data/docs/VideoApi.md +353 -0
- data/git_push.sh +55 -0
- data/lib/cloudmersive-video-api-client.rb +41 -0
- data/lib/cloudmersive-video-api-client/api/video_api.rb +388 -0
- data/lib/cloudmersive-video-api-client/api_client.rb +391 -0
- data/lib/cloudmersive-video-api-client/api_error.rb +38 -0
- data/lib/cloudmersive-video-api-client/configuration.rb +209 -0
- data/lib/cloudmersive-video-api-client/models/media_information.rb +278 -0
- data/lib/cloudmersive-video-api-client/version.rb +15 -0
- data/spec/api/video_api_spec.rb +125 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/media_information_spec.rb +95 -0
- data/spec/spec_helper.rb +111 -0
- metadata +22 -3
@@ -0,0 +1,278 @@
|
|
1
|
+
=begin
|
2
|
+
#videoapi
|
3
|
+
|
4
|
+
#The video APIs help you convert, encode, and transcode videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveVideoApiClient
|
16
|
+
# Result of retrieving information about a video or audio file
|
17
|
+
class MediaInformation
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# The file's short format name
|
22
|
+
attr_accessor :file_format
|
23
|
+
|
24
|
+
# The file's full format name
|
25
|
+
attr_accessor :file_format_full
|
26
|
+
|
27
|
+
# A list of the file's valid formats
|
28
|
+
attr_accessor :valid_file_formats
|
29
|
+
|
30
|
+
# The video's width, if file is a video
|
31
|
+
attr_accessor :width
|
32
|
+
|
33
|
+
# The video's height, if file is a video
|
34
|
+
attr_accessor :height
|
35
|
+
|
36
|
+
# The file's size in bytes
|
37
|
+
attr_accessor :size
|
38
|
+
|
39
|
+
# The file's bit rate
|
40
|
+
attr_accessor :bit_rate
|
41
|
+
|
42
|
+
# The file's duration in seconds
|
43
|
+
attr_accessor :duration
|
44
|
+
|
45
|
+
# The file's media start time
|
46
|
+
attr_accessor :start_time
|
47
|
+
|
48
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
49
|
+
def self.attribute_map
|
50
|
+
{
|
51
|
+
:'successful' => :'Successful',
|
52
|
+
:'file_format' => :'FileFormat',
|
53
|
+
:'file_format_full' => :'FileFormatFull',
|
54
|
+
:'valid_file_formats' => :'ValidFileFormats',
|
55
|
+
:'width' => :'Width',
|
56
|
+
:'height' => :'Height',
|
57
|
+
:'size' => :'Size',
|
58
|
+
:'bit_rate' => :'BitRate',
|
59
|
+
:'duration' => :'Duration',
|
60
|
+
:'start_time' => :'StartTime'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Attribute type mapping.
|
65
|
+
def self.swagger_types
|
66
|
+
{
|
67
|
+
:'successful' => :'BOOLEAN',
|
68
|
+
:'file_format' => :'String',
|
69
|
+
:'file_format_full' => :'String',
|
70
|
+
:'valid_file_formats' => :'Array<String>',
|
71
|
+
:'width' => :'Integer',
|
72
|
+
:'height' => :'Integer',
|
73
|
+
:'size' => :'Integer',
|
74
|
+
:'bit_rate' => :'Integer',
|
75
|
+
:'duration' => :'Float',
|
76
|
+
:'start_time' => :'Float'
|
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?(:'Successful')
|
89
|
+
self.successful = attributes[:'Successful']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.has_key?(:'FileFormat')
|
93
|
+
self.file_format = attributes[:'FileFormat']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'FileFormatFull')
|
97
|
+
self.file_format_full = attributes[:'FileFormatFull']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:'ValidFileFormats')
|
101
|
+
if (value = attributes[:'ValidFileFormats']).is_a?(Array)
|
102
|
+
self.valid_file_formats = value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'Width')
|
107
|
+
self.width = attributes[:'Width']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'Height')
|
111
|
+
self.height = attributes[:'Height']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'Size')
|
115
|
+
self.size = attributes[:'Size']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'BitRate')
|
119
|
+
self.bit_rate = attributes[:'BitRate']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'Duration')
|
123
|
+
self.duration = attributes[:'Duration']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'StartTime')
|
127
|
+
self.start_time = attributes[:'StartTime']
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
132
|
+
# @return Array for valid properties with the reasons
|
133
|
+
def list_invalid_properties
|
134
|
+
invalid_properties = Array.new
|
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
|
+
true
|
142
|
+
end
|
143
|
+
|
144
|
+
# Checks equality by comparing each attribute.
|
145
|
+
# @param [Object] Object to be compared
|
146
|
+
def ==(o)
|
147
|
+
return true if self.equal?(o)
|
148
|
+
self.class == o.class &&
|
149
|
+
successful == o.successful &&
|
150
|
+
file_format == o.file_format &&
|
151
|
+
file_format_full == o.file_format_full &&
|
152
|
+
valid_file_formats == o.valid_file_formats &&
|
153
|
+
width == o.width &&
|
154
|
+
height == o.height &&
|
155
|
+
size == o.size &&
|
156
|
+
bit_rate == o.bit_rate &&
|
157
|
+
duration == o.duration &&
|
158
|
+
start_time == o.start_time
|
159
|
+
end
|
160
|
+
|
161
|
+
# @see the `==` method
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def eql?(o)
|
164
|
+
self == o
|
165
|
+
end
|
166
|
+
|
167
|
+
# Calculates hash code according to all attributes.
|
168
|
+
# @return [Fixnum] Hash code
|
169
|
+
def hash
|
170
|
+
[successful, file_format, file_format_full, valid_file_formats, width, height, size, bit_rate, duration, start_time].hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Builds the object from hash
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
175
|
+
# @return [Object] Returns the model itself
|
176
|
+
def build_from_hash(attributes)
|
177
|
+
return nil unless attributes.is_a?(Hash)
|
178
|
+
self.class.swagger_types.each_pair do |key, type|
|
179
|
+
if type =~ /\AArray<(.*)>/i
|
180
|
+
# check to ensure the input is an array given that the attribute
|
181
|
+
# is documented as an array but the input is not
|
182
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
183
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
184
|
+
end
|
185
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
186
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
187
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
188
|
+
end
|
189
|
+
|
190
|
+
self
|
191
|
+
end
|
192
|
+
|
193
|
+
# Deserializes the data based on type
|
194
|
+
# @param string type Data type
|
195
|
+
# @param string value Value to be deserialized
|
196
|
+
# @return [Object] Deserialized data
|
197
|
+
def _deserialize(type, value)
|
198
|
+
case type.to_sym
|
199
|
+
when :DateTime
|
200
|
+
DateTime.parse(value)
|
201
|
+
when :Date
|
202
|
+
Date.parse(value)
|
203
|
+
when :String
|
204
|
+
value.to_s
|
205
|
+
when :Integer
|
206
|
+
value.to_i
|
207
|
+
when :Float
|
208
|
+
value.to_f
|
209
|
+
when :BOOLEAN
|
210
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
211
|
+
true
|
212
|
+
else
|
213
|
+
false
|
214
|
+
end
|
215
|
+
when :Object
|
216
|
+
# generic object (usually a Hash), return directly
|
217
|
+
value
|
218
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
219
|
+
inner_type = Regexp.last_match[:inner_type]
|
220
|
+
value.map { |v| _deserialize(inner_type, v) }
|
221
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
222
|
+
k_type = Regexp.last_match[:k_type]
|
223
|
+
v_type = Regexp.last_match[:v_type]
|
224
|
+
{}.tap do |hash|
|
225
|
+
value.each do |k, v|
|
226
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
else # model
|
230
|
+
temp_model = CloudmersiveVideoApiClient.const_get(type).new
|
231
|
+
temp_model.build_from_hash(value)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
# Returns the string representation of the object
|
236
|
+
# @return [String] String presentation of the object
|
237
|
+
def to_s
|
238
|
+
to_hash.to_s
|
239
|
+
end
|
240
|
+
|
241
|
+
# to_body is an alias to to_hash (backward compatibility)
|
242
|
+
# @return [Hash] Returns the object in the form of hash
|
243
|
+
def to_body
|
244
|
+
to_hash
|
245
|
+
end
|
246
|
+
|
247
|
+
# Returns the object in the form of hash
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_hash
|
250
|
+
hash = {}
|
251
|
+
self.class.attribute_map.each_pair do |attr, param|
|
252
|
+
value = self.send(attr)
|
253
|
+
next if value.nil?
|
254
|
+
hash[param] = _to_hash(value)
|
255
|
+
end
|
256
|
+
hash
|
257
|
+
end
|
258
|
+
|
259
|
+
# Outputs non-array value in the form of hash
|
260
|
+
# For object, use to_hash. Otherwise, just return the value
|
261
|
+
# @param [Object] value Any valid value
|
262
|
+
# @return [Hash] Returns the value in the form of hash
|
263
|
+
def _to_hash(value)
|
264
|
+
if value.is_a?(Array)
|
265
|
+
value.compact.map { |v| _to_hash(v) }
|
266
|
+
elsif value.is_a?(Hash)
|
267
|
+
{}.tap do |hash|
|
268
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
269
|
+
end
|
270
|
+
elsif value.respond_to? :to_hash
|
271
|
+
value.to_hash
|
272
|
+
else
|
273
|
+
value
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
end
|
278
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
=begin
|
2
|
+
#videoapi
|
3
|
+
|
4
|
+
#The video APIs help you convert, encode, and transcode videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
module CloudmersiveVideoApiClient
|
14
|
+
VERSION = '2.0.2'
|
15
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
=begin
|
2
|
+
#videoapi
|
3
|
+
|
4
|
+
#The video APIs help you convert, encode, and transcode videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for CloudmersiveVideoApiClient::VideoApi
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'VideoApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@instance = CloudmersiveVideoApiClient::VideoApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of VideoApi' do
|
30
|
+
it 'should create an instance of VideoApi' do
|
31
|
+
expect(@instance).to be_instance_of(CloudmersiveVideoApiClient::VideoApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for video_convert_to_gif
|
36
|
+
# Convert Video to Animated GIF format.
|
37
|
+
# Automatically detect video file format and convert it to animated GIF format. Supports many input video formats, including AVI, ASF, FLV, MP4, MPEG/MPG, Matroska/WEBM, 3G2, OGV, MKV, M4V and MOV. Uses 1 API call per 10 MB of file size. Maximum output file size is 50GB. Default height is 250 pixels, while preserving the video's aspect ratio.
|
38
|
+
# @param input_file Input file to perform the operation on.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @option opts [String] :file_url Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
|
41
|
+
# @option opts [Integer] :max_width Optional; Maximum width of the output video, up to the original video width. Defaults to 250 pixels.
|
42
|
+
# @option opts [Integer] :max_height Optional; Maximum height of the output video, up to the original video width. Defaults to 250 pixels.
|
43
|
+
# @option opts [BOOLEAN] :preserve_aspect_ratio Optional; If false, the original video's aspect ratio will not be preserved, allowing customization of the aspect ratio using maxWidth and maxHeight, potentially skewing the video. Default is true.
|
44
|
+
# @option opts [Integer] :frame_rate Optional; Specify the frame rate of the output video. Defaults to 24 frames per second.
|
45
|
+
# @option opts [BOOLEAN] :extend_processing_time Optional; If true, will allow additional processing time for the video file conversion, using one API call per additional minute over the 5 minute default processing time, up to a maximum of 25 total minutes. This is generally necessary for files larger than 500 MB or longer than 30 minutes.
|
46
|
+
# @option opts [DateTime] :start_time Optional; Specify the desired starting time of the GIF video in TimeSpan format.
|
47
|
+
# @option opts [DateTime] :time_span Optional; Specify the desired length of the GIF video in TimeSpan format. Limit is 30 minutes.
|
48
|
+
# @return [String]
|
49
|
+
describe 'video_convert_to_gif test' do
|
50
|
+
it 'should work' do
|
51
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# unit tests for video_convert_to_mov
|
56
|
+
# Convert Video to MOV format.
|
57
|
+
# Automatically detect video file format and convert it to MOV format. Supports many input video formats, including AVI, ASF, FLV, MP4, MPEG/MPG, Matroska/WEBM, 3G2, OGV, MKV, M4V and MOV. Uses 1 API call per 10 MB of file size. Maximum output file size is 50GB.
|
58
|
+
# @param input_file Input file to perform the operation on.
|
59
|
+
# @param [Hash] opts the optional parameters
|
60
|
+
# @option opts [String] :file_url Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
|
61
|
+
# @option opts [Integer] :max_width Optional; Maximum width of the output video, up to the original video width. Defaults to original video width.
|
62
|
+
# @option opts [Integer] :max_height Optional; Maximum height of the output video, up to the original video width. Defaults to original video height.
|
63
|
+
# @option opts [BOOLEAN] :preserve_aspect_ratio Optional; If false, the original video's aspect ratio will not be preserved, allowing customization of the aspect ratio using maxWidth and maxHeight, potentially skewing the video. Default is true.
|
64
|
+
# @option opts [Integer] :frame_rate Optional; Specify the frame rate of the output video. Defaults to original video frame rate.
|
65
|
+
# @option opts [Integer] :quality Optional; Specify the quality of the output video, where 100 is lossless and 1 is the lowest possible quality with highest compression. Default is 50.
|
66
|
+
# @option opts [BOOLEAN] :extend_processing_time Optional; If true, will allow additional processing time for the video file conversion, using one API call per additional minute over the 5 minute default processing time, up to a maximum of 25 total minutes. This is generally necessary for files larger than 500 MB or longer than 30 minutes.
|
67
|
+
# @return [String]
|
68
|
+
describe 'video_convert_to_mov test' do
|
69
|
+
it 'should work' do
|
70
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# unit tests for video_convert_to_mp4
|
75
|
+
# Convert Video to MP4 format.
|
76
|
+
# Automatically detect video file format and convert it to MP4 format. Supports many input video formats, including AVI, ASF, FLV, MP4, MPEG/MPG, Matroska/WEBM, 3G2, OGV, MKV, M4V and MOV. Uses 1 API call per 10 MB of file size. Maximum output file size is 50GB.
|
77
|
+
# @param input_file Input file to perform the operation on.
|
78
|
+
# @param [Hash] opts the optional parameters
|
79
|
+
# @option opts [String] :file_url Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
|
80
|
+
# @option opts [Integer] :max_width Optional; Maximum width of the output video, up to the original video width. Defaults to original video width.
|
81
|
+
# @option opts [Integer] :max_height Optional; Maximum height of the output video, up to the original video width. Defaults to original video height.
|
82
|
+
# @option opts [BOOLEAN] :preserve_aspect_ratio Optional; If false, the original video's aspect ratio will not be preserved, allowing customization of the aspect ratio using maxWidth and maxHeight, potentially skewing the video. Default is true.
|
83
|
+
# @option opts [Integer] :frame_rate Optional; Specify the frame rate of the output video. Defaults to original video frame rate.
|
84
|
+
# @option opts [Integer] :quality Optional; Specify the quality of the output video, where 100 is lossless and 1 is the lowest possible quality with highest compression. Default is 50.
|
85
|
+
# @option opts [BOOLEAN] :extend_processing_time Optional; If true, will allow additional processing time for the video file conversion, using one API call per additional minute over the 5 minute default processing time, up to a maximum of 25 total minutes. This is generally necessary for files larger than 500 MB or longer than 30 minutes.
|
86
|
+
# @return [String]
|
87
|
+
describe 'video_convert_to_mp4 test' do
|
88
|
+
it 'should work' do
|
89
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# unit tests for video_convert_to_webm
|
94
|
+
# Convert Video to WEBM format.
|
95
|
+
# Automatically detect video file format and convert it to WEBM format. Supports many input video formats, including AVI, ASF, FLV, MP4, MPEG/MPG, Matroska/WEBM, 3G2, OGV, MKV, M4V and MOV. Uses 1 API call per 10 MB of file size. Maximum output file size is 50GB.
|
96
|
+
# @param input_file Input file to perform the operation on.
|
97
|
+
# @param [Hash] opts the optional parameters
|
98
|
+
# @option opts [String] :file_url Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
|
99
|
+
# @option opts [Integer] :max_width Optional; Maximum width of the output video, up to the original video width. Defaults to original video width.
|
100
|
+
# @option opts [Integer] :max_height Optional; Maximum height of the output video, up to the original video width. Defaults to original video height.
|
101
|
+
# @option opts [BOOLEAN] :preserve_aspect_ratio Optional; If false, the original video's aspect ratio will not be preserved, allowing customization of the aspect ratio using maxWidth and maxHeight, potentially skewing the video. Default is true.
|
102
|
+
# @option opts [Integer] :frame_rate Optional; Specify the frame rate of the output video. Defaults to original video frame rate.
|
103
|
+
# @option opts [Integer] :quality Optional; Specify the quality of the output video, where 100 is lossless and 1 is the lowest possible quality with highest compression. Default is 50.
|
104
|
+
# @option opts [BOOLEAN] :extend_processing_time Optional; If true, will allow additional processing time for the video file conversion, using one API call per additional minute over the 5 minute default processing time, up to a maximum of 25 total minutes. This is generally necessary for files larger than 500 MB or longer than 30 minutes.
|
105
|
+
# @return [String]
|
106
|
+
describe 'video_convert_to_webm test' do
|
107
|
+
it 'should work' do
|
108
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# unit tests for video_get_info
|
113
|
+
# Get detailed information about a video or audio file
|
114
|
+
# Retrieve detailed information about a video or audio file, including format, dimensions, file size, bit rate, duration and start time. Compatible with many formats, including: AVI, ASF, FLV, GIF, MP4, MPEG/MPG, Matroska/WEBM, MOV, AIFF, ASF, CAF, MP3, MP2, MP1, Ogg, OMG/OMA, and WAV. Uses 1 API call per 10 MB of file size.
|
115
|
+
# @param input_file Input file to perform the operation on.
|
116
|
+
# @param [Hash] opts the optional parameters
|
117
|
+
# @option opts [String] :file_url Optional; URL of a video file being used for conversion. Use this option for files larger than 2GB.
|
118
|
+
# @return [String]
|
119
|
+
describe 'video_get_info test' do
|
120
|
+
it 'should work' do
|
121
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
@@ -0,0 +1,243 @@
|
|
1
|
+
=begin
|
2
|
+
#videoapi
|
3
|
+
|
4
|
+
#The video APIs help you convert, encode, and transcode videos.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe CloudmersiveVideoApiClient::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
CloudmersiveVideoApiClient.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
CloudmersiveVideoApiClient.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(CloudmersiveVideoApiClient::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
CloudmersiveVideoApiClient.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
CloudmersiveVideoApiClient.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
CloudmersiveVideoApiClient.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
CloudmersiveVideoApiClient.configure { |c| c.base_path = nil }
|
48
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'params_encoding in #build_request' do
|
55
|
+
let(:config) { CloudmersiveVideoApiClient::Configuration.new }
|
56
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new(config) }
|
57
|
+
|
58
|
+
it 'defaults to nil' do
|
59
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.params_encoding).to eq(nil)
|
60
|
+
expect(config.params_encoding).to eq(nil)
|
61
|
+
|
62
|
+
request = api_client.build_request(:get, '/test')
|
63
|
+
expect(request.options[:params_encoding]).to eq(nil)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'can be customized' do
|
67
|
+
config.params_encoding = :multi
|
68
|
+
request = api_client.build_request(:get, '/test')
|
69
|
+
expect(request.options[:params_encoding]).to eq(:multi)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'timeout in #build_request' do
|
74
|
+
let(:config) { CloudmersiveVideoApiClient::Configuration.new }
|
75
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new(config) }
|
76
|
+
|
77
|
+
it 'defaults to 0' do
|
78
|
+
expect(CloudmersiveVideoApiClient::Configuration.default.timeout).to eq(0)
|
79
|
+
expect(config.timeout).to eq(0)
|
80
|
+
|
81
|
+
request = api_client.build_request(:get, '/test')
|
82
|
+
expect(request.options[:timeout]).to eq(0)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'can be customized' do
|
86
|
+
config.timeout = 100
|
87
|
+
request = api_client.build_request(:get, '/test')
|
88
|
+
expect(request.options[:timeout]).to eq(100)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#build_request' do
|
93
|
+
let(:config) { CloudmersiveVideoApiClient::Configuration.new }
|
94
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new(config) }
|
95
|
+
|
96
|
+
it 'does not send multipart to request' do
|
97
|
+
expect(Typhoeus::Request).to receive(:new).with(anything, hash_not_including(:multipart))
|
98
|
+
api_client.build_request(:get, '/test')
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when the content type is multipart' do
|
102
|
+
it 'sends multipart to request' do
|
103
|
+
expect(Typhoeus::Request).to receive(:new).with(anything, hash_including(multipart: true))
|
104
|
+
api_client.build_request(:get, '/test', {header_params: { 'Content-Type' => 'multipart/form-data'}})
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#deserialize' do
|
110
|
+
it "handles Array<Integer>" do
|
111
|
+
api_client = CloudmersiveVideoApiClient::ApiClient.new
|
112
|
+
headers = { 'Content-Type' => 'application/json' }
|
113
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
114
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
115
|
+
expect(data).to be_instance_of(Array)
|
116
|
+
expect(data).to eq([12, 34])
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'handles Array<Array<Integer>>' do
|
120
|
+
api_client = CloudmersiveVideoApiClient::ApiClient.new
|
121
|
+
headers = { 'Content-Type' => 'application/json' }
|
122
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
123
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
124
|
+
expect(data).to be_instance_of(Array)
|
125
|
+
expect(data).to eq([[12, 34], [56]])
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'handles Hash<String, String>' do
|
129
|
+
api_client = CloudmersiveVideoApiClient::ApiClient.new
|
130
|
+
headers = { 'Content-Type' => 'application/json' }
|
131
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
132
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
133
|
+
expect(data).to be_instance_of(Hash)
|
134
|
+
expect(data).to eq(:message => 'Hello')
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "#object_to_hash" do
|
139
|
+
it 'ignores nils and includes empty arrays' do
|
140
|
+
# uncomment below to test object_to_hash for model
|
141
|
+
# api_client = CloudmersiveVideoApiClient::ApiClient.new
|
142
|
+
# _model = CloudmersiveVideoApiClient::ModelName.new
|
143
|
+
# update the model attribute below
|
144
|
+
# _model.id = 1
|
145
|
+
# update the expected value (hash) below
|
146
|
+
# expected = {id: 1, name: '', tags: []}
|
147
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe '#build_collection_param' do
|
152
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
153
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new }
|
154
|
+
|
155
|
+
it 'works for csv' do
|
156
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'works for ssv' do
|
160
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'works for tsv' do
|
164
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'works for pipes' do
|
168
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'works for multi' do
|
172
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'fails for invalid collection format' do
|
176
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
describe '#json_mime?' do
|
181
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new }
|
182
|
+
|
183
|
+
it 'works' do
|
184
|
+
expect(api_client.json_mime?(nil)).to eq false
|
185
|
+
expect(api_client.json_mime?('')).to eq false
|
186
|
+
|
187
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
188
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
189
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
190
|
+
|
191
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
192
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
193
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe '#select_header_accept' do
|
198
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new }
|
199
|
+
|
200
|
+
it 'works' do
|
201
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
202
|
+
expect(api_client.select_header_accept([])).to be_nil
|
203
|
+
|
204
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
205
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
206
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
207
|
+
|
208
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
209
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
describe '#select_header_content_type' do
|
214
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new }
|
215
|
+
|
216
|
+
it 'works' do
|
217
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
218
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
219
|
+
|
220
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
221
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
222
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
223
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
224
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
describe '#sanitize_filename' do
|
229
|
+
let(:api_client) { CloudmersiveVideoApiClient::ApiClient.new }
|
230
|
+
|
231
|
+
it 'works' do
|
232
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
233
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
234
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
235
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
236
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
237
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
238
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
239
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
240
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|