Class: Relaton::Itu::Scraper
- Inherits:
-
Object
- Object
- Relaton::Itu::Scraper
- Defined in:
- lib/relaton/itu/scraper.rb
Overview
Scraper.
Constant Summary collapse
- 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
Instance Attribute Summary collapse
-
#hit ⇒ Object
readonly
Returns the value of attribute hit.
-
#imp ⇒ Object
readonly
Returns the value of attribute imp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hit, imp: false) ⇒ Scraper
constructor
A new instance of Scraper.
-
#parse_page ⇒ Relaton::Itu::ItemData?
Parse page.
Constructor Details
#initialize(hit, imp: false) ⇒ Scraper
Returns a new instance of Scraper.
28 29 30 31 |
# File 'lib/relaton/itu/scraper.rb', line 28 def initialize(hit, imp: false) @hit = hit @imp = imp end |
Instance Attribute Details
#hit ⇒ Object (readonly)
Returns the value of attribute hit.
11 12 13 |
# File 'lib/relaton/itu/scraper.rb', line 11 def hit @hit end |
#imp ⇒ Object (readonly)
Returns the value of attribute imp.
11 12 13 |
# File 'lib/relaton/itu/scraper.rb', line 11 def imp @imp end |
Class Method Details
.parse_page(hit, imp: false) ⇒ Object
33 34 35 |
# File 'lib/relaton/itu/scraper.rb', line 33 def self.parse_page(hit, imp: false) new(hit, imp: imp).parse_page end |
Instance Method Details
#parse_page ⇒ Relaton::Itu::ItemData?
Parse page.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/relaton/itu/scraper.rb', line 39 def parse_page # rubocop:disable Metrics/AbcSize, Metrics/MethodLength return unless parser.doc Relaton::Itu::ItemData.new( fetched: Date.today.to_s, type: "standard", docidentifier: docid, edition: edition, language: ["en"], script: ["Latn"], title: parser.fetch_titles, status: parser.fetch_status, date: parser.fetch_dates, abstract: parser.fetch_abstract, source: parser.fetch_source, relation: parser.fetch_relations, contributor: fetch_contributors, copyright: fetch_copyright, place: [Relaton::Bib::Place.new(city: "Geneva")], ext: Relaton::Itu::Ext.new( doctype: Relaton::Itu::Doctype.new(content: hit.hit[:type]), flavor: "itu", ), ) end |