Module: Content

Includes:
Assets, BlockTemplates, Blocks, Instances, PrintVersions, Stories, StoryTemplates, Templates
Included in:
Cxf::User
Defined in:
lib/user/content/content.rb

Instance Method Summary collapse

Methods included from Templates

#create_template, #get_template, #get_templates, #update_template

Methods included from Instances

#create_instance, #create_instance_version, #delete_instance, #duplicate_instance, #get_instance, #get_instances, #update_instance

Methods included from BlockTemplates

#create_block_template, #get_block_template, #get_block_templates, #update_block_template

Methods included from Blocks

#create_block, #delete_block, #duplicate_block, #get_block, #get_blocks, #update_block

Methods included from StoryTemplates

#create_story_template, #get_story_template, #get_story_template_support_data, #get_story_templates, #get_story_templates_support_data, #update_story_template

Methods included from PrintVersions

#create_print_version, #delete_print_version, #duplicate_print_version, #get_print_version, #get_print_versions, #publish_print_version, #update_print_version

Methods included from Stories

#create_story, #delete_story, #duplicate_story, #get_stories, #get_story, #update_story

Methods included from Assets

#create_asset, #create_asset_size, #delete_asset, #download_asset, #generate_asset_variation, #get_asset, #get_asset_doc_types, #get_asset_info, #get_asset_link_info, #get_asset_public_route, #get_asset_size, #get_asset_sizes, #get_asset_thumbnails, #get_asset_usage, #get_asset_variation, #get_assets, #update_asset, #upload_asset

Instance Method Details

#create_keyword(data) ⇒ Object

Create keyword.

Create a keyword with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Keyword'
}
@data = @cxf_user.create_keyword(data.to_json)


71
72
73
# File 'lib/user/content/content.rb', line 71

def create_keyword(data)
  @client.raw('post', '/content/keywords', nil, data)
end

#create_stage(data) ⇒ Object

Create stage.

Create a stage with data.

Parameters

data

(Hash) – Data to be submitted.

Example

config_json = {
  count: 1
}
event_json = {
  rset: 'DTSTART:20190214T000000Z',
  duration: 1
}
data = {
  title: 'New Stage',
  description: 'New Stage Description',
  config_json: config_json.to_json,
  event_json: event_json.to_json
}
@data = @cxf_user.create_stage(data.to_json)


142
143
144
# File 'lib/user/content/content.rb', line 142

def create_stage(data)
  @client.raw('post', '/content/stages', nil, data)
end

#get_keyword(id) ⇒ Object

Get keyword.

Get a keyword.

Parameters

id

(Integer) – Keyword id.



56
57
58
# File 'lib/user/content/content.rb', line 56

def get_keyword(id)
  @client.raw('get', "/content/keywords/#{id}")
end

#get_keywords(options = nil) ⇒ Object

Get keywords.

Get a collection of keywords.

Parameters

options

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

First Example

@data = @cxf_user.get_keywords

Second Example

options = { fields: 'title' }
@data = @cxf_user.get_keywords(options)


46
47
48
# File 'lib/user/content/content.rb', line 46

def get_keywords(options = nil)
  @client.raw('get', '/content/keywords', options)
end

#get_public_images_urlObject

Get public images url.

Get public images url.

Example

@data = @cxf_user.get_public_images_url


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

def get_public_images_url
  @client.raw('get', '/content/public-images-url')
end

#get_stage(id) ⇒ Object

Get stage.

Get a stage.

Parameters

id

(Integer) – Stage id.

Example

@data = @cxf_user.get_stage(1)


117
118
119
# File 'lib/user/content/content.rb', line 117

def get_stage(id)
  @client.raw('get', "/content/stages/#{id}")
end

#get_stages(options = nil) ⇒ Object

Get stages.

Get a collection of stages.

Parameters

options

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

First Example

@data = @cxf_user.get_stages

Second Example

options = { fields: 'title' }
@data = @cxf_user.get_stages(options)


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

def get_stages(options = nil)
  @client.raw('get', '/content/stages', options)
end

#update_keyword(id, data) ⇒ Object

Update keyword.

Update a keyword info.

Parameters

id

(Integer) – Keyword id.

data

(Hash) – Data to be submitted.

Example



84
85
86
87
# File 'lib/user/content/content.rb', line 84

def update_keyword(id, data)
  # FIXME: Keyword controller doesnt receive data
  @client.raw('put', "/content/keywords/#{id}", nil, data)
end

#update_stage(id, data) ⇒ Object

Update stage.

Update a stage info.

Parameters

id

(Integer) – Stage id.

data

(Hash) – Data to be submitted.

Example

config_json = {
  count: 2
}
event_json = {
  rset: 'DTSTART:20190214T000000Z',
  duration: 2
}
data = {
  stageProps: {
    title: 'New Stage Modified',
    description: 'New Stage Description Modified'
  },
  config_json: config_json.to_json,
  event_json: event_json.to_json
}
@data = @cxf_user.update_stage(3, data.to_json)


170
171
172
173
# File 'lib/user/content/content.rb', line 170

def update_stage(id, data)
  # TODO: Inform StageController.update method has been modified
  @client.raw('put', "/content/stages/#{id}", nil, data)
end