Module: StoryVersions

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

Instance Method Summary collapse

Instance Method Details

#create_story_version(data, options = nil) ⇒ Object

Create story version.

Create a story version with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Story',
  slug: 'new-story',
  social_metadata: 'social metadata'
}
@data = @mints_user.create_story_version(data)

61
62
63
# File 'lib/user/content/story_versions.rb', line 61

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

#delete_story_version(id) ⇒ Object

Delete story version.

Delete a story version.

Parameters

id

(Integer) – Story version id.

Example

@data = @mints_user.delete_story_version(6)

90
91
92
# File 'lib/user/content/story_versions.rb', line 90

def delete_story_version(id)
  @client.raw('delete', "/content/story-versions/#{id}")
end

#duplicate_story_version(id, data) ⇒ Object

Duplicate story version.

Duplicate a story version.

Parameters

id

(Integer) – Story version id.

data

(Hash) – Data to be submitted.

Example

data = { options: [] }
@data = @mints_user.duplicate_story_version(1, data.to_json)

104
105
106
# File 'lib/user/content/story_versions.rb', line 104

def duplicate_story_version(id, data)
  @client.raw('post', "/content/story-versions/#{id}/duplicate", nil, data)
end

#get_story_version(id, options = nil) ⇒ Object

Get story version.

Get a story version info.

Parameters

id

(Integer) – Story version id.

options

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

First Example

@data = @mints_user.get_story_version(1)

Second Example

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

44
45
46
# File 'lib/user/content/story_versions.rb', line 44

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

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

Get story versions.

Get a collection of story versions.

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_story_versions

Second Example

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

Third Example

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

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

def get_story_versions(options = nil, use_post = true)
  get_query_results('/content/story-versions', options, use_post)
end

#publish_story_version(id, data) ⇒ Object

Publish story version.

Publish a story version.

Parameters

id

(Integer) – Story version id.

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Story Modified',
  slug: 'new-story'
}
@data = @mints_user.publish_story_version(1, data.to_json)

121
122
123
# File 'lib/user/content/story_versions.rb', line 121

def publish_story_version(id, data)
  @client.raw('put', "/content/story-versions/#{id}/publish", nil, data)
end

#update_story_version(id, data, options = nil) ⇒ Object

Update story version.

Update a story version info.

Parameters

id

(Integer) – Story version id.

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Story Modified',
  slug: 'new-story'
}
@data = @mints_user.update_story_version(5, data)

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

def update_story_version(id, data, options = nil)
  @client.raw('put', "/content/story-versions/#{id}", options, data_transform(data))
end