Module: UniOne::Client::Template

Included in:
UniOne::Client
Defined in:
lib/unione/client/template.rb

Instance Method Summary collapse

Instance Method Details

#delete_template(id) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/unione/client/template.rb', line 36

def delete_template(id)
  params = { id: id }
  post 'template/delete.json', params
  validate_response({
    'type' => 'object', 'required' => ['status'], 'properties' => {
      'status' => {'type' => 'string'}}
  })
end

#get_template(id) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/unione/client/template.rb', line 15

def get_template(id)
  params = { id: id }
  post 'template/get.json', params
  validate_response({
    'type' => 'object', 'required' => ['status', 'template'], 'properties' => {
     'status' => {'type' => 'string'},
     'template' => template_schema}
  })
end

#list_templates(limit, offset) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/unione/client/template.rb', line 25

def list_templates(limit, offset)
  params = { limit: limit, offset: offset }
  post 'template/list.json', params
  list_template_schema = remove_fields_from_schema(template_schema, ['from_name', 'headers'])
  validate_response({
    'type' => 'object', 'required' => ['status', 'templates'], 'properties' => {
      'status' => {'type' => 'string'},
      'templates' => {'items' => list_template_schema}}
  })
end

#set_template(template) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/unione/client/template.rb', line 6

def set_template(template)
  post 'template/set.json', template
  validate_response({
    'type' => 'object', 'required' => ['status', 'template'], 'properties' => {
     'status' => {'type' => 'string'},
     'template' => template_schema}
  })
end