Class: Relaton::Un::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton/un/parser.rb

Constant Summary collapse

DISTRIBUTIONS =
{ "GEN" => "general", "LTD" => "limited",
"DER" => "restricted", "PRO" => "provisional" }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(hit) ⇒ Parser

Returns a new instance of Parser.



9
10
11
# File 'lib/relaton/un/parser.rb', line 9

def initialize(hit)
  @hit = hit
end

Instance Method Details

#parseRelaton::Un::ItemData



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/relaton/un/parser.rb', line 14

def parse # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  ItemData.new(
    type: "standard",
    fetched: Date.today.to_s,
    docidentifier: fetch_docid,
    docnumber: @hit["symbol"],
    language: ["en"],
    script: ["Latn"],
    title: fetch_title,
    date: fetch_date,
    source: fetch_link,
    keyword: fetch_keyword,
    ext: Ext.new(
      session: fetch_session,
      distribution: fetch_distribution,
      job_number: fetch_job_number,
    ),
  )
end