misc_rbtools/classes/nvd_downloader.rb

30 lines
501 B
Ruby
Raw Normal View History

require 'rest-client'
class NvdDownloader
attr_accessor :base_url, :years
MIN_YEAR = '2002'
MAX_YEAR = '2019'
AVAILABLE_YEARS = (MIN_YEAR..MAX_YEAR).to_a
def initialize
@base_url = "https://nvd.nist.gov/feeds/json/cve/1.0/"
@years = self.years
end
def years
year = NvdDownloader::AVAILABLE_YEARS.map do |year|
[year.to_i, year]
end.to_h
end
def year(year)
years[year]
end
def get(url)
end
end