Sha256: d66683f48fe4d3fcf37992e95043e3db7f8cbf4aeb00d62c0b6142c218f8210e
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'chronicle/etl' module Chronicle module Safari class SafariTransformer < Chronicle::ETL::Transformer register_connector do |r| r.provider = 'safari' r.description = 'a history item' end def transform @data = @extraction.data build_browsed end def id # IDs from local db aren't global or stable across multiple installs end def timestamp Time.parse(@data[:visit_time_utc]) end private def build_browsed record = ::Chronicle::ETL::Models::Activity.new({ verb: 'browsed', provider: 'safari', end_at: timestamp }) record.dedupe_on << [:provider, :verb, :end_at] record.actor = build_actor record.involved = build_involved record end def build_involved record = ::Chronicle::ETL::Models::Entity.new({ title: @data[:title], provider_url: @data[:url], }) record.dedupe_on << [:provider_url] record end def build_actor record = ::Chronicle::ETL::Models::Entity.new({ represents: 'identity', provider: 'icloud', provider_id: @extraction.meta[:icloud_account][:dsid], title: @extraction.meta[:icloud_account][:display_name], slug: @extraction.meta[:icloud_account][:id] }) record.dedupe_on << [:provider, :represents, :slug] record end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chronicle-safari-0.1.2 | lib/chronicle/safari/safari_transformer.rb |