class NexposeTicketing::Store

Public Class Methods

new() click to toggle source
# File lib/nexpose_ticketing/store.rb, line 6
def initialize()
  @solutions = {}
end
store_exists?() click to toggle source

For now we don't cache anything

# File lib/nexpose_ticketing/store.rb, line 11
def self.store_exists?
  return false
end

Public Instance Methods

fill_store() click to toggle source
# File lib/nexpose_ticketing/store.rb, line 19
def fill_store
  # Should this be a single transaction?
  CSV.foreach(@csv_path, headers: true) do |row|
    @solutions[row['solution_id']] = { nexpose_id: row['nexpose_id'],
                                       summary: row['summary'],
                                       fix: row['fix'],
                                       url: row['url'] }
  end
end
get_solution(solution_id) click to toggle source
# File lib/nexpose_ticketing/store.rb, line 29
def get_solution(solution_id)
  @solutions.fetch(solution_id, {})
end
get_solutions(solution_ids) click to toggle source
# File lib/nexpose_ticketing/store.rb, line 33
def get_solutions(solution_ids)
  sols = []

  solution_ids.each do |s|
    sol = @solutions[s]
    next if sol.nil?
    sols << sol
  end

  sols
end
set_path(csv_path) click to toggle source
# File lib/nexpose_ticketing/store.rb, line 15
def set_path(csv_path)
  @csv_path = csv_path
end