Class: Relaton::Ogc::Scraper
- Inherits:
-
Object
- Object
- Relaton::Ogc::Scraper
- Defined in:
- lib/relaton/ogc/scraper.rb
Constant Summary collapse
- TYPES =
{ "AS" => { type: "abstract-specification-topic" }, "BP" => { type: "best-practice", subtype: "general" }, "CAN" => { type: "standard", subtype: "general", stage: "draft" }, "CR" => { type: "change-request-supporting-document" }, "CP" => { type: "community-practice" }, "CS" => { type: "community-standard" }, "DP" => { type: "discussion-paper" }, "DP-Draft" => { type: "discussion-paper", stage: "draft" }, "IPR" => { type: "engineering-report" }, "IS" => { type: "standard", subtype: "implementation" }, "ISC" => { type: "standard", subtype: "implementation" }, "ISx" => { type: "standard", subtype: "extension" }, "Notes" => { type: "other" }, "ORM" => { type: "reference-model" }, "PC" => { type: "standard", subtype: "profile" }, "PER" => { type: "engineering-report" }, "POL" => { type: "standard" }, "Primer" => { type: "other" }, "Profile" => { type: "standard", subtype: "profile" }, "RFC" => { type: "standard", stage: "draft" }, "SAP" => { type: "standard", subtype: "profile" }, "WhitePaper" => { type: "white-paper" }, "ATB" => { type: "other" }, "RP" => { type: "discussion-paper" }, }.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hit, errors = Hash.new(true)) ⇒ Scraper
constructor
A new instance of Scraper.
- #parse ⇒ Relaton::Ogc::ItemData
Constructor Details
#initialize(hit, errors = Hash.new(true)) ⇒ Scraper
Returns a new instance of Scraper.
39 40 41 42 |
# File 'lib/relaton/ogc/scraper.rb', line 39 def initialize(hit, errors = Hash.new(true)) @hit = hit @errors = errors end |
Class Method Details
.parse_page(hit, errors = Hash.new(true)) ⇒ Object
33 34 35 |
# File 'lib/relaton/ogc/scraper.rb', line 33 def self.parse_page(hit, errors = Hash.new(true)) new(hit, errors).parse end |
Instance Method Details
#parse ⇒ Relaton::Ogc::ItemData
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/relaton/ogc/scraper.rb', line 45 def parse # rubocop:disable Metrics/AbcSize,Metrics/MethodLength type = fetch_type(@hit["type"]) contribs = fetch_contributor(@hit) contribs << fetch_editorialgroup_contributor ItemData.new( type: "standard", title: fetch_title(@hit["title"]), docidentifier: fetch_docid(@hit["identifier"]), source: fetch_link(@hit), status: fetch_status(type[:stage]), edition: fetch_edition(@hit["identifier"]), abstract: fetch_abstract(@hit["description"]), contributor: contribs, language: ["en"], script: ["Latn"], date: fetch_date(@hit["date"]), ext: Ext.new( doctype: fetch_doctype(type[:type]), subdoctype: type[:subtype], flavor: "ogc", ), ) end |