Module: PublicStories

Included in:
PublicContent
Defined in:
lib/pub/content/stories.rb

Instance Method Summary collapse

Instance Method Details

#get_stories(options = nil, use_post = true) ⇒ Object

Get Stories.

Get a collection of stories.

Parameters

options

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

use_post

(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.

First Example

@data = @mints_pub.get_stories

Second Example

options = { fields: 'id, slug' }
@data = @mints_pub.get_stories(options)

Third Example

options = {
  fields: 'id, slug'
}
@data = @mints_pub.get_stories(options, false)


24
25
26
# File 'lib/pub/content/stories.rb', line 24

def get_stories(options = nil, use_post = true)
  get_query_results('/content/stories', options, use_post)
end

#get_story(slug, options = nil) ⇒ Object

Get Story.

Get a single story.

Parameters

slug

(String) – It’s the string identifier generated by Mints.

options

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

First Example

@data = @mints_pub.get_story("story_slug")

Second Example

@data = @mints_pub.get_story("story_slug", options.to_json)


41
42
43
# File 'lib/pub/content/stories.rb', line 41

def get_story(slug, options = nil)
  @client.raw('get', "/content/stories/#{slug}", options)
end