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.



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

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.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def ignorelist
  @ignorelist
end

#max_paginationObject (readonly)

Returns the value of attribute max_pagination.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def max_pagination
  @max_pagination
end

#onlylistObject (readonly)

Returns the value of attribute onlylist.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def onlylist
  @onlylist
end

#page_source_on_errorObject (readonly)

Returns the value of attribute page_source_on_error.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def page_source_on_error
  @page_source_on_error
end

#screenshot_on_errorObject (readonly)

Returns the value of attribute screenshot_on_error.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def screenshot_on_error
  @screenshot_on_error
end

#statusObject (readonly)

Returns the value of attribute status.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def status
  @status
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def timeout
  @timeout
end

#usernameObject (readonly)

Returns the value of attribute username.



49
50
51
# File 'lib/abide_dev_utils/comply.rb', line 49

def username
  @username
end

Instance Method Details

#build_report(password) ⇒ Object



72
73
74
75
76
77
# File 'lib/abide_dev_utils/comply.rb', line 72

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

#file_dirObject



79
80
81
# File 'lib/abide_dev_utils/comply.rb', line 79

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

#file_dir=(path) ⇒ Object



83
84
85
# File 'lib/abide_dev_utils/comply.rb', line 83

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