Sha256: 0a063cf05f4b83e3c52f074824a37af7792f9022ffcb7307574416a377d10388

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

require 'chronicle/etl'
require 'faraday'
module Chronicle
  module Zulip
    class PrivateMessageExtractor < Chronicle::ETL::Extractor
      register_connector do |r|
        r.provider = 'zulip'
        r.description = 'zulip direct messages'
        r.identifier = 'private-message'
      end

      setting :access_token, required: true
      setting :username, required: true
      setting :realm, required: true

      def prepare
        @proxy = Chronicle::Zulip::Proxy.new(username: @config.username, realm: @config.realm, access_token: @config.access_token)
      end

      def extract
        @proxy.all_private_messages(since: @config.since, limit: @config.limit) do |message|
          yield Chronicle::ETL::Extraction.new(data: message)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chronicle-zulip-0.1.2 lib/chronicle/zulip/private_message_extractor.rb