Module: BlockTemplates
- Included in:
- Content
- Defined in:
- lib/user/content/block_templates.rb
Instance Method Summary collapse
-
#create_block_template(data, options = nil) ⇒ Object
Create block template.
-
#get_block_template(id, options = nil) ⇒ Object
Get block template.
-
#get_block_templates(options = nil) ⇒ Object
Get block templates.
-
#update_block_template(id, data) ⇒ Object
Update block template.
Instance Method Details
#create_block_template(data, options = nil) ⇒ Object
Create block template.
Create a block template with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New block Template',
slug: 'new-block-template-slug'
}
@data = @cxf_user.create_block_template(data)
53 54 55 |
# File 'lib/user/content/block_templates.rb', line 53 def create_block_template(data, = nil) @client.raw('post', '/content/block-templates', , data_transform(data)) end |
#get_block_template(id, options = nil) ⇒ Object
Get block template.
Get a block template info.
Parameters
- id
-
(Integer) – block template id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @cxf_user.get_block_template(2)
Second Example
= {
fields: 'title'
}
@data = @cxf_user.get_block_template(1, )
37 38 39 |
# File 'lib/user/content/block_templates.rb', line 37 def get_block_template(id, = nil) @client.raw('get', "/content/block-templates/#{id}", ) end |
#get_block_templates(options = nil) ⇒ Object
Get block templates.
Get a collection of block templates.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @cxf_user.get_block_templates
Second Example
= {
fields: 'id, title'
}
@data = @cxf_user.get_block_templates()
18 19 20 |
# File 'lib/user/content/block_templates.rb', line 18 def get_block_templates( = nil) @client.raw('get', '/content/block-templates', ) end |
#update_block_template(id, data) ⇒ Object
Update block template.
Update a block template info.
Parameters
- id
-
(Integer) – block template id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New block Template Modified'
}
@data = @cxf_user.update_block_template(3, data)
69 70 71 |
# File 'lib/user/content/block_templates.rb', line 69 def update_block_template(id, data) @client.raw('put', "/content/block-templates/#{id}", nil, data_transform(data)) end |