lib/nistbib/hit_collection.rb in nistbib-0.1.5 vs lib/nistbib/hit_collection.rb in nistbib-0.1.6
- old
+ new
@@ -21,10 +21,11 @@
attr_reader :year
# @param ref_nbr [String]
# @param year [String]
# @param opts [Hash]
+ # @option opts [String] :stage
def initialize(ref_nbr, year = nil, opts)
@text = ref_nbr
@year = year
from, to = nil
if year
@@ -33,10 +34,10 @@
to = d.next_year.prev_day.strftime "%m/%d/%Y"
end
url = "#{DOMAIN}/publications/search?keywords-lg=#{ref_nbr}"
url += "&dateFrom-lg=#{from}" if from
url += "&dateTo-lg=#{to}" if to
- url += "&status-lg=Draft" if /PD/ =~ opts[:stage]
+ url += "&status-lg=Draft,Withdrawn" if /PD/ =~ opts[:stage]
doc = Nokogiri::HTML OpenURI.open_uri(::Addressable::URI.parse(url).normalize)
hits = doc.css("table.publications-table > tbody > tr").map do |h|
link = h.at("td/div/strong/a")
serie = h.at("td[1]").text.strip
code = h.at("td[2]").text.strip