Class: Dradis::Plugins::Upload::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/dradis/plugins/upload/importer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Importer

Returns a new instance of Importer.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dradis/plugins/upload/importer.rb', line 23

def initialize(args={})
  @options = args

  @default_user_id = args[:default_user_id] || -1
  @logger = args.fetch(:logger, Rails.logger)
  @plugin = args[:plugin] || default_plugin
  @project = args.key?(:project_id) ? Project.find(args[:project_id]) : nil
  @state = args.fetch(:state, :published)

  @content_service   = args.fetch(:content_service, default_content_service)
  @mapping_service   = default_mapping_service

  post_initialize(args)
end

Instance Attribute Details

#content_serviceObject

Returns the value of attribute content_service.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def content_service
  @content_service
end

#default_user_idObject

Returns the value of attribute default_user_id.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def default_user_id
  @default_user_id
end

#loggerObject

Returns the value of attribute logger.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def logger
  @logger
end

#mapping_serviceObject

Returns the value of attribute mapping_service.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def mapping_service
  @mapping_service
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def options
  @options
end

#pluginObject

Returns the value of attribute plugin.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def plugin
  @plugin
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/dradis/plugins/upload/importer.rb', line 8

def project
  @project
end

Class Method Details

.templatesObject



19
20
21
# File 'lib/dradis/plugins/upload/importer.rb', line 19

def self.templates
  { evidence: 'evidence', issue: 'issue' }
end

Instance Method Details

#import(args = {}) ⇒ Object



38
39
40
# File 'lib/dradis/plugins/upload/importer.rb', line 38

def import(args={})
  raise "The import() method is not implemented in this plugin [#{self.class.name}]."
end

#post_initialize(args = {}) ⇒ Object

This method can be overwriten by plugins to do initialization tasks.



43
44
# File 'lib/dradis/plugins/upload/importer.rb', line 43

def post_initialize(args={})
end