Module: ContentTemplates
- Included in:
- Content
- Defined in:
- lib/user/content/content_templates.rb
Instance Method Summary collapse
-
#create_content_template(data) ⇒ Object
Create content template.
-
#delete_content_template(id) ⇒ Object
Delete content template.
-
#duplicate_content_template(id) ⇒ Object
Duplicate content template.
-
#get_content_template(id) ⇒ Object
Get content template.
-
#get_content_template_instances(templateId) ⇒ Object
Get content template instances.
-
#get_content_templates(options = nil) ⇒ Object
Get content templates.
-
#update_content_template(id, data) ⇒ Object
Update content template.
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)
73 74 75 76 |
# File 'lib/user/content/content_templates.rb', line 73 def create_content_template(data) #TODO: Inform ContentTemplateController.store method has been modified return @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)
107 108 109 110 |
# File 'lib/user/content/content_templates.rb', line 107 def delete_content_template(id) #TODO: Inform ContentTemplateController.destroy method has been modified return @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)
26 27 28 |
# File 'lib/user/content/content_templates.rb', line 26 def duplicate_content_template(id) return @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)
54 55 56 |
# File 'lib/user/content/content_templates.rb', line 54 def get_content_template(id) return @client.raw("get", "/content/templates/#{id}") end |
#get_content_template_instances(templateId) ⇒ 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)
14 15 16 |
# File 'lib/user/content/content_templates.rb', line 14 def get_content_template_instances(templateId) return @client.raw("get", "/content/templates/#{templateId}/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
= { "sort": "title" }
@data = @mints_user.get_content_templates()
42 43 44 |
# File 'lib/user/content/content_templates.rb', line 42 def get_content_templates( = nil) return @client.raw("get", "/content/templates", ) 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)
94 95 96 97 |
# File 'lib/user/content/content_templates.rb', line 94 def update_content_template(id, data) #TODO: Inform ContentTemplateController.update method has been modified return @client.raw("put", "/content/templates/#{id}", nil, data) end |