shotstack 0.0.10 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -12
- data/lib/shotstack.rb +12 -5
- data/lib/shotstack/api/{default_api.rb → endpoints_api.rb} +63 -38
- data/lib/shotstack/api_client.rb +33 -34
- data/lib/shotstack/api_error.rb +4 -4
- data/lib/shotstack/configuration.rb +11 -10
- data/lib/shotstack/models/audio_asset.rb +253 -0
- data/lib/shotstack/models/clip.rb +104 -15
- data/lib/shotstack/models/edit.rb +30 -10
- data/lib/shotstack/models/font.rb +213 -0
- data/lib/shotstack/models/html_asset.rb +319 -0
- data/lib/shotstack/models/image_asset.rb +17 -7
- data/lib/shotstack/models/luma_asset.rb +241 -0
- data/lib/shotstack/models/offset.rb +270 -0
- data/lib/shotstack/models/output.rb +84 -10
- data/lib/shotstack/models/poster.rb +213 -0
- data/lib/shotstack/models/queued_response.rb +17 -5
- data/lib/shotstack/models/queued_response_data.rb +17 -7
- data/lib/shotstack/models/render_response.rb +17 -5
- data/lib/shotstack/models/render_response_data.rb +106 -26
- data/lib/shotstack/models/soundtrack.rb +68 -17
- data/lib/shotstack/models/thumbnail.rb +228 -0
- data/lib/shotstack/models/timeline.rb +33 -9
- data/lib/shotstack/models/title_asset.rb +103 -14
- data/lib/shotstack/models/track.rb +16 -6
- data/lib/shotstack/models/transition.rb +21 -11
- data/lib/shotstack/models/video_asset.rb +20 -10
- data/lib/shotstack/version.rb +5 -5
- data/shotstack.gemspec +6 -12
- metadata +15 -126
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d7ae43e161a59f2235a19bedecbad719688f507fffbea5f3ba98290420c771d
|
4
|
+
data.tar.gz: e8350e8c8a158eb53d927b8abcf4ccf4aedb5800818daacde77fa7494973bc0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e8af0ed7bb5f3ec96c40106a718793e63cc8a4b57fb886c5b07e490251abd540af94744ad56206d32ac3f997ae346d5fb5e99082c8423374b8ff63bcd61df23
|
7
|
+
data.tar.gz: d22fe040921d1393dc9b00fa88a8ca54c2928a082f1e33c548d057a79f651f6bc07a47930e528a99b25b6480b817cd2a8e7762b45da7e284af5d04b25d69c193
|
data/README.md
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
# Shotstack Ruby SDK
|
2
2
|
|
3
|
-
Ruby SDK for Shotstack, the cloud video editing API.
|
3
|
+
Ruby SDK for [Shotstack](http://shotstack.io), the cloud video editing API.
|
4
4
|
|
5
|
-
|
5
|
+
Shotstack is a cloud based video editing platform that enables the editing of videos using code.
|
6
6
|
|
7
|
-
|
7
|
+
The platform uses an API and a JSON format for specifying how videos should be edited and what assets and titles should be used.
|
8
8
|
|
9
|
-
|
9
|
+
A server based render farm takes care of rendering the videos allowing multiple videos to be created simultaneously.
|
10
10
|
|
11
|
-
|
12
|
-
rm shotstack-*.gem
|
13
|
-
gem build shotstack
|
14
|
-
gem push shotstack-*.*.*.gem # use the correct version number
|
15
|
-
```
|
11
|
+
For examples of how to use the SDK to create videos using code checkout the Ruby demo repo: https://github.com/shotstack/ruby-demos
|
16
12
|
|
17
|
-
|
13
|
+
## Installation
|
18
14
|
|
19
|
-
```bash
|
20
|
-
sudo gem install shotstack
|
21
15
|
```
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Documentation
|
20
|
+
|
21
|
+
- [Getting Started Guide](https://shotstack.gitbook.io/docs/guides/getting-started)
|
22
|
+
- [API Reference](https://shotstack.restlet.io/)
|
23
|
+
- [Examples](https://github.com/shotstack/ruby-demos)
|
24
|
+
- [Shotstack Website](http://shotstack.io)
|
25
|
+
|
26
|
+
###
|
data/lib/shotstack.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
4
|
+
#The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -17,15 +17,22 @@ require 'shotstack/version'
|
|
17
17
|
require 'shotstack/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'shotstack/models/audio_asset'
|
20
21
|
require 'shotstack/models/clip'
|
21
22
|
require 'shotstack/models/edit'
|
23
|
+
require 'shotstack/models/font'
|
24
|
+
require 'shotstack/models/html_asset'
|
22
25
|
require 'shotstack/models/image_asset'
|
26
|
+
require 'shotstack/models/luma_asset'
|
27
|
+
require 'shotstack/models/offset'
|
23
28
|
require 'shotstack/models/output'
|
29
|
+
require 'shotstack/models/poster'
|
24
30
|
require 'shotstack/models/queued_response'
|
25
31
|
require 'shotstack/models/queued_response_data'
|
26
32
|
require 'shotstack/models/render_response'
|
27
33
|
require 'shotstack/models/render_response_data'
|
28
34
|
require 'shotstack/models/soundtrack'
|
35
|
+
require 'shotstack/models/thumbnail'
|
29
36
|
require 'shotstack/models/timeline'
|
30
37
|
require 'shotstack/models/title_asset'
|
31
38
|
require 'shotstack/models/track'
|
@@ -33,7 +40,7 @@ require 'shotstack/models/transition'
|
|
33
40
|
require 'shotstack/models/video_asset'
|
34
41
|
|
35
42
|
# APIs
|
36
|
-
require 'shotstack/api/
|
43
|
+
require 'shotstack/api/endpoints_api'
|
37
44
|
|
38
45
|
module Shotstack
|
39
46
|
class << self
|
@@ -1,129 +1,154 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
4
|
+
#The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'cgi'
|
14
14
|
|
15
15
|
module Shotstack
|
16
|
-
class
|
16
|
+
class EndpointsApi
|
17
17
|
attr_accessor :api_client
|
18
18
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
# Get
|
22
|
+
# Get Render Status
|
23
|
+
# Get the rendering status, video url and details of a timeline by ID.
|
23
24
|
# @param id [String] The id of the timeline render task in UUID format
|
24
25
|
# @param [Hash] opts the optional parameters
|
25
26
|
# @return [RenderResponse]
|
26
27
|
def get_render(id, opts = {})
|
27
|
-
data, _status_code, _headers =
|
28
|
+
data, _status_code, _headers = get_render_with_http_info(id, opts)
|
28
29
|
data
|
29
30
|
end
|
30
31
|
|
31
|
-
# Get
|
32
|
+
# Get Render Status
|
33
|
+
# Get the rendering status, video url and details of a timeline by ID.
|
32
34
|
# @param id [String] The id of the timeline render task in UUID format
|
33
35
|
# @param [Hash] opts the optional parameters
|
34
36
|
# @return [Array<(RenderResponse, Integer, Hash)>] RenderResponse data, response status code and response headers
|
35
|
-
def
|
37
|
+
def get_render_with_http_info(id, opts = {})
|
36
38
|
if @api_client.config.debugging
|
37
|
-
@api_client.config.logger.debug 'Calling API:
|
39
|
+
@api_client.config.logger.debug 'Calling API: EndpointsApi.get_render ...'
|
38
40
|
end
|
39
41
|
# verify the required parameter 'id' is set
|
40
42
|
if @api_client.config.client_side_validation && id.nil?
|
41
|
-
fail ArgumentError, "Missing the required parameter 'id' when calling
|
43
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling EndpointsApi.get_render"
|
42
44
|
end
|
43
45
|
pattern = Regexp.new(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)
|
44
46
|
if @api_client.config.client_side_validation && id !~ pattern
|
45
|
-
fail ArgumentError, "invalid value for 'id' when calling
|
47
|
+
fail ArgumentError, "invalid value for 'id' when calling EndpointsApi.get_render, must conform to the pattern #{pattern}."
|
46
48
|
end
|
47
49
|
|
48
50
|
# resource path
|
49
|
-
local_var_path = '/render/{id}'.sub('{' + 'id' + '}', id.to_s)
|
51
|
+
local_var_path = '/render/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
50
52
|
|
51
53
|
# query parameters
|
52
|
-
query_params = {}
|
54
|
+
query_params = opts[:query_params] || {}
|
53
55
|
|
54
56
|
# header parameters
|
55
|
-
header_params = {}
|
57
|
+
header_params = opts[:header_params] || {}
|
56
58
|
# HTTP header 'Accept' (if needed)
|
57
59
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
58
60
|
|
59
61
|
# form parameters
|
60
|
-
form_params = {}
|
62
|
+
form_params = opts[:form_params] || {}
|
61
63
|
|
62
64
|
# http body (model)
|
63
|
-
post_body =
|
64
|
-
|
65
|
-
|
65
|
+
post_body = opts[:body]
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:return_type] || 'RenderResponse'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:auth_names] || ['DeveloperKey']
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
66
74
|
:header_params => header_params,
|
67
75
|
:query_params => query_params,
|
68
76
|
:form_params => form_params,
|
69
77
|
:body => post_body,
|
70
78
|
:auth_names => auth_names,
|
71
|
-
:return_type =>
|
79
|
+
:return_type => return_type
|
80
|
+
)
|
81
|
+
|
82
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
72
83
|
if @api_client.config.debugging
|
73
|
-
@api_client.config.logger.debug "API called:
|
84
|
+
@api_client.config.logger.debug "API called: EndpointsApi#get_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
85
|
end
|
75
86
|
return data, status_code, headers
|
76
87
|
end
|
77
88
|
|
78
|
-
# Render
|
79
|
-
#
|
89
|
+
# Render Video
|
90
|
+
# Queue and render the contents of a timeline as a video file.
|
91
|
+
# @param edit [Edit] The video edit specified using JSON.
|
80
92
|
# @param [Hash] opts the optional parameters
|
93
|
+
# @option opts [String] :x_api_queue_id The id of a dedicated queue (enterprise customers only).
|
81
94
|
# @return [QueuedResponse]
|
82
95
|
def post_render(edit, opts = {})
|
83
|
-
data, _status_code, _headers =
|
96
|
+
data, _status_code, _headers = post_render_with_http_info(edit, opts)
|
84
97
|
data
|
85
98
|
end
|
86
99
|
|
87
|
-
# Render
|
88
|
-
#
|
100
|
+
# Render Video
|
101
|
+
# Queue and render the contents of a timeline as a video file.
|
102
|
+
# @param edit [Edit] The video edit specified using JSON.
|
89
103
|
# @param [Hash] opts the optional parameters
|
104
|
+
# @option opts [String] :x_api_queue_id The id of a dedicated queue (enterprise customers only).
|
90
105
|
# @return [Array<(QueuedResponse, Integer, Hash)>] QueuedResponse data, response status code and response headers
|
91
|
-
def
|
106
|
+
def post_render_with_http_info(edit, opts = {})
|
92
107
|
if @api_client.config.debugging
|
93
|
-
@api_client.config.logger.debug 'Calling API:
|
108
|
+
@api_client.config.logger.debug 'Calling API: EndpointsApi.post_render ...'
|
94
109
|
end
|
95
110
|
# verify the required parameter 'edit' is set
|
96
111
|
if @api_client.config.client_side_validation && edit.nil?
|
97
|
-
fail ArgumentError, "Missing the required parameter 'edit' when calling
|
112
|
+
fail ArgumentError, "Missing the required parameter 'edit' when calling EndpointsApi.post_render"
|
98
113
|
end
|
99
114
|
# resource path
|
100
115
|
local_var_path = '/render'
|
101
116
|
|
102
117
|
# query parameters
|
103
|
-
query_params = {}
|
118
|
+
query_params = opts[:query_params] || {}
|
104
119
|
|
105
120
|
# header parameters
|
106
|
-
header_params = {}
|
121
|
+
header_params = opts[:header_params] || {}
|
107
122
|
# HTTP header 'Accept' (if needed)
|
108
123
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
109
124
|
# HTTP header 'Content-Type'
|
110
125
|
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
126
|
+
header_params[:'x-api-queue-id'] = opts[:'x_api_queue_id'] if !opts[:'x_api_queue_id'].nil?
|
111
127
|
|
112
128
|
# form parameters
|
113
|
-
form_params = {}
|
129
|
+
form_params = opts[:form_params] || {}
|
114
130
|
|
115
131
|
# http body (model)
|
116
|
-
post_body = @api_client.object_to_http_body(edit)
|
117
|
-
|
118
|
-
|
132
|
+
post_body = opts[:body] || @api_client.object_to_http_body(edit)
|
133
|
+
|
134
|
+
# return_type
|
135
|
+
return_type = opts[:return_type] || 'QueuedResponse'
|
136
|
+
|
137
|
+
# auth_names
|
138
|
+
auth_names = opts[:auth_names] || ['DeveloperKey']
|
139
|
+
|
140
|
+
new_options = opts.merge(
|
119
141
|
:header_params => header_params,
|
120
142
|
:query_params => query_params,
|
121
143
|
:form_params => form_params,
|
122
144
|
:body => post_body,
|
123
145
|
:auth_names => auth_names,
|
124
|
-
:return_type =>
|
146
|
+
:return_type => return_type
|
147
|
+
)
|
148
|
+
|
149
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
125
150
|
if @api_client.config.debugging
|
126
|
-
@api_client.config.logger.debug "API called:
|
151
|
+
@api_client.config.logger.debug "API called: EndpointsApi#post_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
127
152
|
end
|
128
153
|
return data, status_code, headers
|
129
154
|
end
|
data/lib/shotstack/api_client.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
4
|
+
#The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -15,7 +15,6 @@ require 'json'
|
|
15
15
|
require 'logger'
|
16
16
|
require 'tempfile'
|
17
17
|
require 'typhoeus'
|
18
|
-
require 'uri'
|
19
18
|
|
20
19
|
module Shotstack
|
21
20
|
class ApiClient
|
@@ -128,6 +127,34 @@ module Shotstack
|
|
128
127
|
request
|
129
128
|
end
|
130
129
|
|
130
|
+
# Builds the HTTP request body
|
131
|
+
#
|
132
|
+
# @param [Hash] header_params Header parameters
|
133
|
+
# @param [Hash] form_params Query parameters
|
134
|
+
# @param [Object] body HTTP body (JSON/XML)
|
135
|
+
# @return [String] HTTP body data in the form of string
|
136
|
+
def build_request_body(header_params, form_params, body)
|
137
|
+
# http form
|
138
|
+
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
139
|
+
header_params['Content-Type'] == 'multipart/form-data'
|
140
|
+
data = {}
|
141
|
+
form_params.each do |key, value|
|
142
|
+
case value
|
143
|
+
when ::File, ::Array, nil
|
144
|
+
# let typhoeus handle File, Array and nil parameters
|
145
|
+
data[key] = value
|
146
|
+
else
|
147
|
+
data[key] = value.to_s
|
148
|
+
end
|
149
|
+
end
|
150
|
+
elsif body
|
151
|
+
data = body.is_a?(String) ? body : body.to_json
|
152
|
+
else
|
153
|
+
data = nil
|
154
|
+
end
|
155
|
+
data
|
156
|
+
end
|
157
|
+
|
131
158
|
# Check if the given MIME is a JSON MIME.
|
132
159
|
# JSON MIME examples:
|
133
160
|
# application/json
|
@@ -262,35 +289,7 @@ module Shotstack
|
|
262
289
|
def build_request_url(path)
|
263
290
|
# Add leading and trailing slashes to path
|
264
291
|
path = "/#{path}".gsub(/\/+/, '/')
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
# Builds the HTTP request body
|
269
|
-
#
|
270
|
-
# @param [Hash] header_params Header parameters
|
271
|
-
# @param [Hash] form_params Query parameters
|
272
|
-
# @param [Object] body HTTP body (JSON/XML)
|
273
|
-
# @return [String] HTTP body data in the form of string
|
274
|
-
def build_request_body(header_params, form_params, body)
|
275
|
-
# http form
|
276
|
-
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
277
|
-
header_params['Content-Type'] == 'multipart/form-data'
|
278
|
-
data = {}
|
279
|
-
form_params.each do |key, value|
|
280
|
-
case value
|
281
|
-
when ::File, ::Array, nil
|
282
|
-
# let typhoeus handle File, Array and nil parameters
|
283
|
-
data[key] = value
|
284
|
-
else
|
285
|
-
data[key] = value.to_s
|
286
|
-
end
|
287
|
-
end
|
288
|
-
elsif body
|
289
|
-
data = body.is_a?(String) ? body : body.to_json
|
290
|
-
else
|
291
|
-
data = nil
|
292
|
-
end
|
293
|
-
data
|
292
|
+
@config.base_url + path
|
294
293
|
end
|
295
294
|
|
296
295
|
# Update hearder and query params based on authentication settings.
|
data/lib/shotstack/api_error.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
4
|
+
#The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -1,17 +1,15 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Shotstack
|
3
3
|
|
4
|
-
#The Shotstack API is a video editing service that allows for the
|
4
|
+
#The Shotstack API is a video editing service that allows for the automated creation of videos using JSON. You can configure an edit and POST it to the Shotstack API which will render your video and provide a file location when complete. For more details check https://shotstack.io
|
5
5
|
|
6
|
-
OpenAPI
|
6
|
+
The version of the OpenAPI document: v1
|
7
7
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
9
|
-
OpenAPI Generator version: 4.
|
9
|
+
OpenAPI Generator version: 4.2.1
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require 'uri'
|
14
|
-
|
15
13
|
module Shotstack
|
16
14
|
class Configuration
|
17
15
|
# Defines url scheme
|
@@ -130,7 +128,7 @@ module Shotstack
|
|
130
128
|
def initialize
|
131
129
|
@scheme = 'https'
|
132
130
|
@host = 'api.shotstack.io'
|
133
|
-
@base_path = '/
|
131
|
+
@base_path = '/v1'
|
134
132
|
@api_key = {}
|
135
133
|
@api_key_prefix = {}
|
136
134
|
@timeout = 0
|
@@ -174,8 +172,7 @@ module Shotstack
|
|
174
172
|
end
|
175
173
|
|
176
174
|
def base_url
|
177
|
-
|
178
|
-
URI.encode(url)
|
175
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
179
176
|
end
|
180
177
|
|
181
178
|
# Gets API key (with prefix if set).
|
@@ -215,7 +212,11 @@ module Shotstack
|
|
215
212
|
variables: {
|
216
213
|
version: {
|
217
214
|
description: "No descriptoin provided",
|
218
|
-
default_value: "
|
215
|
+
default_value: "v1",
|
216
|
+
enum_values: [
|
217
|
+
"v1",
|
218
|
+
"stage"
|
219
|
+
]
|
219
220
|
}
|
220
221
|
}
|
221
222
|
}
|