class RelatonUn::Hit
Hit
.
Constants
- BODY
There is distribution PRO (A/47/PV.102/CORR.1, A/47/PV.54)
Public Instance Methods
fetch()
click to toggle source
Parse page. @return [RelatonUn::UnBibliographicItem]
# File lib/relaton_un/hit.rb, line 53 def fetch @fetch ||= un_bib_item end
Private Instance Methods
bibdate(type, on)
click to toggle source
@param type [String] @param on [String] @return [RelatonBib::BibliographicDate]
# File lib/relaton_un/hit.rb, line 106 def bibdate(type, on) RelatonBib::BibliographicDate.new type: type, on: on end
fetch_classification()
click to toggle source
@return [Array<RelatonBib::Classification>]
# File lib/relaton_un/hit.rb, line 144 def fetch_classification [RelatonBib::Classification.new(type: "area", value: "UNDOC")] end
fetch_date()
click to toggle source
@return [Array<RelatonBib::BibliographicDate>]
# File lib/relaton_un/hit.rb, line 96 def fetch_date d = [] d << bibdate("published", hit[:date_pub]) if hit[:date_pub] d << bibdate("issued", hit[:date_rel]) if hit[:date_rel] d end
fetch_distribution()
click to toggle source
@return [String]
# File lib/relaton_un/hit.rb, line 126 def fetch_distribution UnBibliographicItem::DISTRIBUTIONS[hit[:distribution]] end
fetch_docid()
click to toggle source
@return [Array<RelatonBib::DocumentIdentifier>]
# File lib/relaton_un/hit.rb, line 84 def fetch_docid hit[:symbol].map do |s| RelatonBib::DocumentIdentifier.new(id: s, type: "UN") end end
fetch_editorialgroup()
click to toggle source
@return [RelatonUn::EditorialGroup, NilClass]
# File lib/relaton_un/hit.rb, line 131 def fetch_editorialgroup # rubocop:disable Metrics/AbcSize tc = hit[:ref].match(/^\S+/).to_s.split(/\/|-/).reduce([]) do |m, v| if BODY[v] then m << BODY[v] elsif v.match?(/(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/) then m << v else m end end.uniq return unless tc.any? RelatonUn::EditorialGroup.new tc end
fetch_keyword()
click to toggle source
@return [Array<String>]
# File lib/relaton_un/hit.rb, line 116 def fetch_keyword hit[:keyword].split(", ") end
fetch_link()
click to toggle source
@return [Array<RelatonBib::TypedUri>]
# File lib/relaton_un/hit.rb, line 111 def fetch_link hit[:link].map { |l| RelatonBib::TypedUri.new(**l) } end
fetch_session()
click to toggle source
@return [RelatonUn::Session]
# File lib/relaton_un/hit.rb, line 121 def fetch_session Session.new(session_number: hit[:session], agenda_id: hit[:agenda]) end
fetch_title()
click to toggle source
@return [Array<RelatonBib::TypedTitleString>]
# File lib/relaton_un/hit.rb, line 91 def fetch_title RelatonBib::TypedTitleString.from_string hit[:title], "en", "Latn" end
un_bib_item()
click to toggle source
@return [RelatonUn::UnBibliographicItem]
# File lib/relaton_un/hit.rb, line 62 def un_bib_item # rubocop:disable Metrics/AbcSize UnBibliographicItem.new( type: "standard", fetched: Date.today.to_s, docid: fetch_docid, docnumber: hit[:ref], language: ["en"], script: ["Latn"], title: fetch_title, date: fetch_date, link: fetch_link, keyword: fetch_keyword, session: fetch_session, distribution: fetch_distribution, editorialgroup: fetch_editorialgroup, classification: fetch_classification, job_number: hit[:job_number], ) end