Sha256: 5bd54d5947fa0c12f3d52f436a5cdd97d96dce5f87141b1d358d5f1ad5e8e833

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

module Chronicle
  module Spotify
    class ListenTransformer < Chronicle::ETL::Transformer
      include Chronicle::Spotify::Builders

      register_connector do |r|
        r.provider = 'spotify'
        r.description = 'a spotify listen'
        r.identifier = 'listen'
      end

      def transform
        build_listen(
          timestamp: timestamp,
          track: @extraction.data[:track],
          actor: @extraction.meta[:actor]
        )
      end

      def id
        @extraction.data[:track][:id]
      end

      def timestamp
        Time.parse(@extraction.data[:played_at])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chronicle-spotify-0.1.0 lib/chronicle/spotify/listen_transformer.rb