Class: NexposeTicketing::Store
- Inherits:
-
Object
- Object
- NexposeTicketing::Store
- Defined in:
- lib/nexpose_ticketing/store.rb
Class Method Summary collapse
-
.store_exists? ⇒ Boolean
For now we don’t cache anything.
Instance Method Summary collapse
- #fill_store ⇒ Object
- #get_solution(solution_id) ⇒ Object
- #get_solutions(solution_ids) ⇒ Object
-
#initialize ⇒ Store
constructor
A new instance of Store.
- #set_path(csv_path) ⇒ Object
Constructor Details
#initialize ⇒ Store
Returns a new instance of Store.
6 7 8 |
# File 'lib/nexpose_ticketing/store.rb', line 6 def initialize() @solutions = {} end |
Class Method Details
.store_exists? ⇒ Boolean
For now we don’t cache anything
11 12 13 |
# File 'lib/nexpose_ticketing/store.rb', line 11 def self.store_exists? return false end |
Instance Method Details
#fill_store ⇒ Object
19 20 21 22 23 24 25 26 27 |
# 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) ⇒ Object
29 30 31 |
# File 'lib/nexpose_ticketing/store.rb', line 29 def get_solution(solution_id) @solutions.fetch(solution_id, {}) end |
#get_solutions(solution_ids) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# 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) ⇒ Object
15 16 17 |
# File 'lib/nexpose_ticketing/store.rb', line 15 def set_path(csv_path) @csv_path = csv_path end |