Class: AbideDevUtils::Comply::ReportScraper

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/comply.rb

Overview

Class that uses Selenium WebDriver to gather scan reports from Puppet Comply

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, config = nil, **opts) ⇒ ReportScraper

Returns a new instance of ReportScraper.



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/abide_dev_utils/comply.rb', line 60

def initialize(url, config = nil, **opts)
  @url = url
  @config = config
  @opts = opts
  @timeout = fetch_option(:timeout, 10).to_i
  @username = fetch_option(:username, 'comply')
  @status = fetch_option(:status)
  @ignorelist = fetch_option(:ignorelist, [])
  @onlylist = fetch_option(:onlylist, [])
  @max_pagination = fetch_option(:max_pagination, 5).to_i
  @screenshot_on_error = fetch_option(:screenshot_on_error, false)
  @page_source_on_error = fetch_option(:page_source_on_error, false)
end

Instance Attribute Details

#ignorelistObject (readonly)

Returns the value of attribute ignorelist.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def ignorelist
  @ignorelist
end

#max_paginationObject (readonly)

Returns the value of attribute max_pagination.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def max_pagination
  @max_pagination
end

#onlylistObject (readonly)

Returns the value of attribute onlylist.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def onlylist
  @onlylist
end

#page_source_on_errorObject (readonly)

Returns the value of attribute page_source_on_error.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def page_source_on_error
  @page_source_on_error
end

#screenshot_on_errorObject (readonly)

Returns the value of attribute screenshot_on_error.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def screenshot_on_error
  @screenshot_on_error
end

#statusObject (readonly)

Returns the value of attribute status.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def status
  @status
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def timeout
  @timeout
end

#usernameObject (readonly)

Returns the value of attribute username.



51
52
53
# File 'lib/abide_dev_utils/comply.rb', line 51

def username
  @username
end

Instance Method Details

#build_report(password) ⇒ Object



74
75
76
77
78
79
# File 'lib/abide_dev_utils/comply.rb', line 74

def build_report(password)
  connect(password)
  scrape_report
ensure
  driver.quit
end

#file_dirObject



81
82
83
# File 'lib/abide_dev_utils/comply.rb', line 81

def file_dir
  @file_dir ||= File.expand_path('~/abide_dev_utils')
end

#file_dir=(path) ⇒ Object



85
86
87
# File 'lib/abide_dev_utils/comply.rb', line 85

def file_dir=(path)
  @file_dir = new_file_dir(path)
end