class RelatonW3c::W3cBibliography
Class methods for search W3C standards.
Public Class Methods
get(ref, _year = nil, _opts = {})
click to toggle source
@param ref [String] the W3C standard Code to look up @param year [String, NilClass] not used @param opts [Hash] options @return [RelatonW3c::W3cBibliographicItem]
# File lib/relaton_w3c/w3c_bibliography.rb, line 24 def get(ref, _year = nil, _opts = {}) warn "[relaton-w3c] (\"#{ref}\") fetching..." result = search(ref) return unless result.any? ret = result.first.fetch warn "[relaton-w3c] (\"#{ref}\") found #{ret.title.first.title.content}" ret end
search(text)
click to toggle source
@param text [String] @return [RelatonW3c::HitCollection]
# File lib/relaton_w3c/w3c_bibliography.rb, line 11 def search(text) HitCollection.new text rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Errno::ETIMEDOUT raise RelatonBib::RequestError, "Could not access #{HitCollection::DOMAIN}" end