Module: RelatonIec::Scrapper
- Defined in:
- lib/relaton_iec/scrapper.rb
Overview
Scrapper. rubocop:disable Metrics/ModuleLength
Constant Summary collapse
- DOMAIN =
"https://webstore.iec.ch"- TYPES =
{ "ISO" => "international-standard", "TS" => "technicalSpecification", "TR" => "technicalReport", "PAS" => "publiclyAvailableSpecification", "AWI" => "appruvedWorkItem", "CD" => "committeeDraft", "FDIS" => "finalDraftInternationalStandard", "NP" => "newProposal", "DIS" => "draftInternationalStandard", "WD" => "workingDraft", "R" => "recommendation", "Guide" => "guide", }.freeze
Class Method Summary collapse
-
.parse_page(hit_data) ⇒ Hash
Parse page.
Class Method Details
.parse_page(hit_data) ⇒ Hash
Parse page. rubocop:disable Metrics/AbcSize, Metrics/MethodLength
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/relaton_iec/scrapper.rb', line 51 def parse_page(hit_data) doc = get_page hit_data[:url] # Fetch edition. edition = doc.at("//th[contains(., 'Edition')]/following-sibling::td/span").text status, relations = fetch_status_relations hit_data[:url] RelatonIsoBib::IsoBibliographicItem.new( docid: [RelatonBib::DocumentIdentifier.new(id: hit_data[:code], type: "IEC")], structuredidentifier: fetch_structuredidentifier(doc), edition: edition, language: ["en"], script: ["Latn"], titles: fetch_titles(hit_data), type: fetch_type(doc), docstatus: status, ics: fetch_ics(doc), dates: fetch_dates(doc), contributors: fetch_contributors(hit_data[:code]), editorialgroup: fetch_workgroup(doc), abstract: fetch_abstract(doc), copyright: fetch_copyright(hit_data[:code], doc), link: fetch_link(doc, hit_data[:url]), relations: relations, ) end |