forked from transloadit/ruby-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.rb
63 lines (58 loc) · 1.99 KB
/
template.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require "transloadit"
#
# Represents a Template API ready to interact with its corresponding REST API.
#
# See the Transloadit {documentation}[https://transloadit.com/docs/api-docs/#template-api]
# for further information on Templates and their parameters.
#
class Transloadit::Template < Transloadit::ApiModel
#
# Submits a template to be created.
#
# @param [Hash] params POST data to submit with the request.
# must contain keys 'name' and 'template'
#
# @option params [String] :name name assigned to the newly created template
# @option params [Hash] :template key, value pair of template content
# see {template}[https://transloadit.com/templates]
#
def create(params)
_do_request("/templates", params, "post")
end
#
# Returns a list of all templates
# @param [Hash] additional GET data to submit with the request
#
def list(params = {})
_do_request("/templates", params)
end
#
# Returns a single template object specified by the template id
# @param [String] id id of the desired template
# @param [Hash] additional GET data to submit with the request
#
def get(id, params = {})
_do_request("/templates/#{id}", params)
end
#
# Updates the template object specified by the template id
# @param [String] id id of the desired template
# @param [Hash] additional POST data to submit with the request
# must contain keys 'name' and 'template'
#
# @option params [String] :name name assigned to the newly created template
# @option params [Hash] :template key, value pair of template content
# see {template}[https://transloadit.com/templates]
#
def update(id, params = {})
_do_request("/templates/#{id}", params, "put")
end
#
# Deletes the template object specified by the template id
# @param [String] id id of the desired template
# @param [Hash] additional POST data to submit with the request
#
def delete(id, params = {})
_do_request("/templates/#{id}", params, "delete")
end
end