Class: Arxiv::Downloader::FeedParser
- Inherits:
-
Object
- Object
- Arxiv::Downloader::FeedParser
- Defined in:
- lib/arxiv/downloader/feed_parser.rb
Defined Under Namespace
Classes: AtomEntry, AtomFeed, Author
Instance Method Summary collapse
-
#initialize(xml) ⇒ FeedParser
constructor
A new instance of FeedParser.
- #metadata ⇒ Object
Constructor Details
#initialize(xml) ⇒ FeedParser
Returns a new instance of FeedParser.
34 35 36 37 |
# File 'lib/arxiv/downloader/feed_parser.rb', line 34 def initialize xml @feed = Feedjira.parse xml @categories = Categories.new end |
Instance Method Details
#metadata ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/arxiv/downloader/feed_parser.rb', line 39 def entry = @feed.entries.first arxiv_id = Identifier.new(entry.entry_id).id Metadata.new( arxiv_id: arxiv_id, arxiv_url: "https://arxiv.org/abs/#{arxiv_id}", pdf_url: "https://arxiv.org/pdf/#{arxiv_id}.pdf", title: entry.title, authors: entry..map(&:name), abstract: entry.summary.strip, published: entry.published.to_date, updated: entry.updated.to_date, primary_category: @categories.lookup(entry.primary_category_id), categories: entry.categories.map { |id| @categories.lookup id }, comment: entry.comment, doi: entry.doi, journal_ref: entry.journal_ref ) end |