Class: Chronicle::Pinboard::PinboardTransformer

Inherits:
ETL::Transformer
  • Object
show all
Defined in:
lib/chronicle/pinboard/pinboard_transformer.rb

Instance Method Summary collapse

Instance Method Details

#transform(record) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chronicle/pinboard/pinboard_transformer.rb', line 16

def transform(record)
  site = build_site(record.data)
  agent = build_agent(record.extraction.meta[:username])
  id = record.data[:hash]
  end_time = Time.parse(record.data[:time])

  actions = []

  actions << build_bookmark(site:, agent:, id:, end_time:)

  note = record.data[:extended]
  actions << build_comment(site:, agent:, id:, end_time:, note:) if note.size.positive?

  actions.compact
end