Module: SourceMonitor::ImportSessions::EntryNormalizer

Defined in:
lib/source_monitor/import_sessions/entry_normalizer.rb

Class Method Summary collapse

Class Method Details

.normalize(entry) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/source_monitor/import_sessions/entry_normalizer.rb', line 8

def normalize(entry)
  entry = entry.to_h

  {
    id: string_for(entry[:id] || entry["id"] || entry[:feed_url] || entry["feed_url"]),
    feed_url: entry[:feed_url].presence || entry["feed_url"].presence,
    title: entry[:title].presence || entry["title"].presence,
    website_url: entry[:website_url].presence || entry["website_url"].presence,
    status: entry[:status].presence || entry["status"].presence || "valid",
    error: entry[:error].presence || entry["error"].presence,
    raw_outline_index: entry[:raw_outline_index] || entry["raw_outline_index"],
    health_status: entry[:health_status].presence || entry["health_status"].presence,
    health_error: entry[:health_error].presence || entry["health_error"].presence
  }
end