Module: ContentTemplates

Included in:
Content
Defined in:
lib/user/content/content_templates.rb

Instance Method Summary collapse

Instance Method Details

#create_content_template(data) ⇒ Object

Create content template.

Create a content template with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  template: {
    title: 'New Content Template',
    slug: 'new-content-template-slug',
    description: 'New Content Template Description'
  }
}
@data = @mints_user.create_content_template(data.to_json)

75
76
77
78
# File 'lib/user/content/content_templates.rb', line 75

def create_content_template(data)
  # TODO: Inform ContentTemplateController.store method has been modified
  @client.raw('post', '/content/templates', nil, data)
end

#delete_content_template(id) ⇒ Object

Delete content template.

Delete a content template.

Parameters

id

(Integer) – Content template id.

Example

@data = @mints_user.delete_content_template(1)

109
110
111
112
# File 'lib/user/content/content_templates.rb', line 109

def delete_content_template(id)
  # TODO: Inform ContentTemplateController.destroy method has been modified
  @client.raw('delete', "/content/templates/#{id}")
end

#duplicate_content_template(id) ⇒ Object

Duplicate content template.

Duplicate a content template.

Parameters

id

(Integer) – Content template id.

Example

@data = @mints_user.get_content_template(1)

28
29
30
# File 'lib/user/content/content_templates.rb', line 28

def duplicate_content_template(id)
  @client.raw('post', "/content/templates/#{id}/duplicate/")
end

#get_content_template(id) ⇒ Object

Get content template.

Get a content template.

Parameters

id

(Integer) – Content template id.

Example

@data = @mints_user.get_content_template(1)

56
57
58
# File 'lib/user/content/content_templates.rb', line 56

def get_content_template(id)
  @client.raw('get', "/content/templates/#{id}")
end

#get_content_template_instances(template_id) ⇒ Object

Get content template instances.

Get instances of a content template.

Parameters

templateId

(Integer) – Template id.

Example

@data = @mints_user.get_content_template_instances(1)

16
17
18
# File 'lib/user/content/content_templates.rb', line 16

def get_content_template_instances(template_id)
  @client.raw('get', "/content/templates/#{template_id}/instances")
end

#get_content_templates(options = nil) ⇒ Object

Get content templates.

Get a collection of content templates.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_content_templates

Second Example

options = { sort: "title" }
@data = @mints_user.get_content_templates(options)

44
45
46
# File 'lib/user/content/content_templates.rb', line 44

def get_content_templates(options = nil)
  @client.raw('get', '/content/templates', options)
end

#update_content_template(id, data) ⇒ Object

Update content template.

Update a content template info.

Parameters

id

(Integer) – Content template id.

data

(Hash) – Data to be submitted.

Example

data = {
  template: {
    title: 'New Content Template Modified',
    slug: 'new-content-template-slug',
    description: 'New Content Template Description'
  }
}
@data = @mints_user.update_content_template(7, data.to_json)

96
97
98
99
# File 'lib/user/content/content_templates.rb', line 96

def update_content_template(id, data)
  # TODO: Inform ContentTemplateController.update method has been modified
  @client.raw('put', "/content/templates/#{id}", nil, data)
end