Module: Content

Includes:
Assets, BlockTemplates, Blocks, Bundles, ContentBundles, ContentPrints, Instances, MessageTemplates, PrintVersions, Prints, Templates
Included in:
Cxf::User
Defined in:
lib/user/content/content.rb

Instance Method Summary collapse

Methods included from Prints

#create_print, #delete_print, #get_print, #get_prints, #update_print

Methods included from MessageTemplates

#create_message_template, #delete_message_template, #get_message_template, #get_message_templates, #send_message_template, #update_message_template

Methods included from Bundles

#create_bundle, #delete_bundle, #get_bundle, #get_bundles, #update_bundle

Methods included from Templates

#create_template, #create_template_variant_option, #delete_template_variant_option, #get_template, #get_templates, #update_template

Methods included from PrintVersions

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

Methods included from Instances

#add_variant_value_to_instance, #create_instance, #create_instance_version, #create_item_code_for_instance, #delete_instance, #delete_variant_value_from_instance, #duplicate_instance, #get_instance, #get_instances, #get_intance_variations, #update_instance

Methods included from ContentPrints

#create_content_print, #delete_content_print, #get_content_print, #get_content_prints, #update_content_print

Methods included from ContentBundles

#create_content_bundle, #delete_content_bundle, #get_content_bundle, #get_content_bundles, #update_content_bundle

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 Assets

#create_asset, #delete_asset, #get_asset, #get_asset_usage, #get_assets, #update_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)
[View source]

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

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)
[View source]

148
149
150
# File 'lib/user/content/content.rb', line 148

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.

[View source]

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

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)
[View source]

52
53
54
# File 'lib/user/content/content.rb', line 52

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
[View source]

32
33
34
# File 'lib/user/content/content.rb', line 32

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)
[View source]

123
124
125
# File 'lib/user/content/content.rb', line 123

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)
[View source]

111
112
113
# File 'lib/user/content/content.rb', line 111

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

[View source]

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

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)
[View source]

176
177
178
179
# File 'lib/user/content/content.rb', line 176

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