Sha256: 489c65b2fe9eb4f951effc3d220553542985ed089ba6d8fe3d79b0a7189fab07

Contents?: true

Size: 939 Bytes

Versions: 5

Compression:

Stored size: 939 Bytes

Contents

require 'csv'

module NexposeTicketing

class Store
    def initialize()
      @solutions = {}
    end

    # For now we don't cache anything
    def self.store_exists?
      return false
    end

    def set_path(csv_path)
      @csv_path = csv_path
    end

    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

    def get_solution(solution_id)
      @solutions.fetch(solution_id, {})
    end

    def get_solutions(solution_ids)
      sols = []

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

      sols
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nexpose_ticketing-1.5.2 lib/nexpose_ticketing/store.rb
nexpose_ticketing-1.5.1 lib/nexpose_ticketing/store.rb
nexpose_ticketing-1.5.0 lib/nexpose_ticketing/store.rb
nexpose_ticketing-1.4.2 lib/nexpose_ticketing/store.rb
nexpose_ticketing-1.4.1 lib/nexpose_ticketing/store.rb