module Dradis::Plugins::ContentService::ContentBlocks
Public Instance Methods
all_content_blocks()
click to toggle source
# File lib/dradis/plugins/content_service/content_blocks.rb, line 5 def all_content_blocks case scope when :all project.content_blocks when :published project.content_blocks.published else raise 'Unsupported scope!' end end
create_content_block(args={})
click to toggle source
# File lib/dradis/plugins/content_service/content_blocks.rb, line 16 def create_content_block(args={}) block_group = args.fetch(:block_group, default_content_block_group) content = args.fetch(:content, default_content_block_content) state = args.fetch(:state, :published) user_id = args.fetch(:user_id) content_block = ContentBlock.new( content: content, block_group: block_group, project_id: project.id, state: state, user_id: user_id ) if content_block.valid? content_block.save return content_block else try_rescue_from_length_validation( model: content_block, field: :content, text: content, msg: 'Error in create_content_block()', tail: plugin_details ) end end
Private Instance Methods
default_content_block_content()
click to toggle source
# File lib/dradis/plugins/content_service/content_blocks.rb, line 47 def default_content_block_content "create_content_block() invoked by #{plugin} without a :content parameter" end
default_content_block_group()
click to toggle source
# File lib/dradis/plugins/content_service/content_blocks.rb, line 51 def default_content_block_group "create_content_block() invoked by #{plugin} without a :block_group parameter" end