Module: StoryTemplates

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

Instance Method Summary collapse

Instance Method Details

#create_story_template(data, options = nil) ⇒ Object

Create story template.

Create a story template with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Story Template',
  slug: 'new-story-template-slug'
}
@data = @mints_user.create_story_template(data)

78
79
80
# File 'lib/user/content/story_templates.rb', line 78

def create_story_template(data, options = nil)
  @client.raw('post', '/content/story-templates', options, data_transform(data))
end

#get_story_template(id, options = nil) ⇒ Object

Get story template.

Get a story template info.

Parameters

id

(Integer) – Story template id.

options

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

First Example

@data = @mints_user.get_story_template(2)

Second Example

options = {
  fields: 'title'
}
@data = @mints_user.get_story_template(1, options)

62
63
64
# File 'lib/user/content/story_templates.rb', line 62

def get_story_template(id, options = nil)
  @client.raw('get', "/content/story-templates/#{id}", options)
end

#get_story_template_support_data(id) ⇒ Object

Get support data of story template.

Get support data used in a story template.

Parameters

id

(Integer) – Story template id.

Example

@data = @mints_user.get_story_template_support_data(1)

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

def get_story_template_support_data(id)
  @client.raw('get', "/content/story-templates/support-data/stories/#{id}")
end

#get_story_templates(options = nil) ⇒ Object

Get story templates.

Get a collection of story templates.

Parameters

options

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

First Example

@data = @mints_user.get_story_templates

Second Example

options = {
  fields: 'id, title'
}
@data = @mints_user.get_story_templates(options)

43
44
45
# File 'lib/user/content/story_templates.rb', line 43

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

#get_story_templates_support_dataObject

Get support data of story templates.

Get support data used in story templates.

Example

@data = @mints_user.get_story_templates_support_data

25
26
27
# File 'lib/user/content/story_templates.rb', line 25

def get_story_templates_support_data
  @client.raw('get', '/content/story-templates/support-data')
end

#update_story_template(id, data) ⇒ Object

Update story template.

Update a story template info.

Parameters

id

(Integer) – Story template id.

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Story Template Modified'
}
@data = @mints_user.update_story_template(3, data)

94
95
96
# File 'lib/user/content/story_templates.rb', line 94

def update_story_template(id, data)
  @client.raw('put', "/content/story-templates/#{id}", nil, data_transform(data))
end