Class: Sevk::Resources::Templates
- Inherits:
-
Base
- Object
- Base
- Sevk::Resources::Templates
show all
- Defined in:
- lib/sevk/resources/templates.rb
Instance Attribute Summary
Attributes inherited from Base
#client
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#create(title:, content:) ⇒ Object
17
18
19
|
# File 'lib/sevk/resources/templates.rb', line 17
def create(title:, content:)
client.post("/templates", { title: title, content: content })
end
|
#delete(id) ⇒ Object
28
29
30
|
# File 'lib/sevk/resources/templates.rb', line 28
def delete(id)
client.delete("/templates/#{id}")
end
|
#duplicate(id) ⇒ Object
32
33
34
|
# File 'lib/sevk/resources/templates.rb', line 32
def duplicate(id)
client.post("/templates/#{id}/duplicate", {})
end
|
#get(id) ⇒ Object
13
14
15
|
# File 'lib/sevk/resources/templates.rb', line 13
def get(id)
client.get("/templates/#{id}")
end
|
#list(page: nil, limit: nil, search: nil) ⇒ Object
8
9
10
11
|
# File 'lib/sevk/resources/templates.rb', line 8
def list(page: nil, limit: nil, search: nil)
params = { page: page, limit: limit, search: search }
client.get("/templates#{build_query_string(params)}")
end
|
#update(id, title: nil, content: nil) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/sevk/resources/templates.rb', line 21
def update(id, title: nil, content: nil)
body = {}
body[:title] = title if title
body[:content] = content if content
client.put("/templates/#{id}", body)
end
|