Module: BlockTemplates

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

Instance Method Summary collapse

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, options = nil)
  @client.raw('post', '/content/block-templates', options, 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

options = {
  fields: 'title'
}
@data = @cxf_user.get_block_template(1, options)

37
38
39
# File 'lib/user/content/block_templates.rb', line 37

def get_block_template(id, options = nil)
  @client.raw('get', "/content/block-templates/#{id}", options)
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

options = {
  fields: 'id, title'
}
@data = @cxf_user.get_block_templates(options)

18
19
20
# File 'lib/user/content/block_templates.rb', line 18

def get_block_templates(options = nil)
  @client.raw('get', '/content/block-templates', options)
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