Module: Stories
- Included in:
- Content
- Defined in:
- lib/user/content/stories.rb
Instance Method Summary collapse
-
#create_story(data) ⇒ Object
Create story.
-
#delete_story(id) ⇒ Object
Delete story.
-
#duplicate_story(id, data) ⇒ Object
Duplicate story.
-
#get_stories(options = nil, use_post = true) ⇒ Object
Get stories.
-
#get_stories_support_data ⇒ Object
Get stories support data.
-
#get_story(id, options = nil) ⇒ Object
Get story.
-
#publish_story(id, data) ⇒ Object
Publish story.
-
#revert_published_story(id) ⇒ Object
Revert published story.
-
#schedule_story(id, data) ⇒ Object
Schedule story.
-
#update_story(id, data) ⇒ Object
Update story.
Instance Method Details
#create_story(data) ⇒ Object
Create story.
Create a story with data.
Parameters
- data
-
(Hash) – Data to be submited.
Example
data = {
"title": "New Story",
"slug": "new-story",
"social_metadata": "social metadata"
}
@data = @mints_user.create_story(data)
132 133 134 |
# File 'lib/user/content/stories.rb', line 132 def create_story(data) return @client.raw("post", "/content/stories", nil, data_transform(data)) end |
#delete_story(id) ⇒ Object
Delete story.
Delete a story.
Parameters
- id
-
(Integer) – Story id.
Example
@data = @mints_user.delete_story(6)
161 162 163 |
# File 'lib/user/content/stories.rb', line 161 def delete_story(id) return @client.raw("delete", "/content/stories/#{id}") end |
#duplicate_story(id, data) ⇒ Object
Duplicate story.
Duplicate a story.
Parameters
- id
-
(Integer) – Story id.
- data
-
(Hash) – Data to be submited.
Example
data = {
"options": []
}
@data = @mints_user.duplicate_story(1, data.to_json)
71 72 73 |
# File 'lib/user/content/stories.rb', line 71 def duplicate_story(id, data) return @client.raw("post", "/content/stories/#{id}/duplicate", nil, data) end |
#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_user.get_stories
Second Example
= {
"fields": "id, title"
}
@data = @mints_user.get_stories()
Third Example
= {
"fields": "id, title"
}
@data = @mints_user.get_stories(, true)
96 97 98 |
# File 'lib/user/content/stories.rb', line 96 def get_stories( = nil, use_post = true) return get_query_results("/content/stories", , use_post) end |
#get_stories_support_data ⇒ Object
Get stories support data.
Get support data used in stories.
Example
@data = @mints_user.get_stories_support_data
55 56 57 |
# File 'lib/user/content/stories.rb', line 55 def get_stories_support_data return @client.raw("get", "/content/stories/support-data") end |
#get_story(id, options = nil) ⇒ Object
Get story.
Get a story info.
Parameters
- id
-
(Integer) – Story id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_user.get_story(1)
Second Example
= {
"fields": "id, title"
}
@data = @mints_user.get_story(1, )
115 116 117 |
# File 'lib/user/content/stories.rb', line 115 def get_story(id, = nil) return @client.raw("get", "/content/stories/#{id}", ) end |
#publish_story(id, data) ⇒ Object
Publish story.
Publish a story.
Parameters
- id
-
(Integer) – Story id.
- data
-
(Hash) – Data to be submited.
Example
data = {
"scheduled_at": "2021-09-06T20:29:16+00:00"
}
@data = @mints_user.publish_story(2, data)
18 19 20 |
# File 'lib/user/content/stories.rb', line 18 def publish_story(id, data) return @client.raw("put", "/content/stories/#{id}/publish", nil, data_transform(data)) end |
#revert_published_story(id) ⇒ Object
Revert published story.
Revert a published story.
Parameters
- id
-
(Integer) – Story id.
Example
@data = @mints_user.revert_published_story(1)
46 47 48 |
# File 'lib/user/content/stories.rb', line 46 def revert_published_story(id) return @client.raw("get", "/content/stories/#{id}/revert-published-data") end |
#schedule_story(id, data) ⇒ Object
Schedule story.
Schedule a story in a specified date.
Parameters
- id
-
(Integer) – Story id.
- data
-
(Hash) – Data to be submited.
Example
data = {
"scheduled_at": "2021-09-06T20:29:16+00:00"
}
@data = @mints_user.schedule_story(1, data)
34 35 36 |
# File 'lib/user/content/stories.rb', line 34 def schedule_story(id, data) return @client.raw("put", "/content/stories/#{id}/schedule", nil, data_transform(data)) end |
#update_story(id, data) ⇒ Object
Update story.
Update a story info.
Parameters
- id
-
(Integer) – Story id.
- data
-
(Hash) – Data to be submited.
Example
data = {
"title": "New Story Modified",
"slug": "new-story"
}
@data = @mints_user.update_story(5, data)
149 150 151 |
# File 'lib/user/content/stories.rb', line 149 def update_story(id, data) return @client.raw("put", "/content/stories/#{id}", nil, data_transform(data)) end |