Sha256: e158630428a89665e6d5fcee25d7a41e1f8442e56808bca7671c785b947c14d2

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

require 'slack-ruby-client'

require_relative 'events'
require_relative 'event_adapter'
require 'roko/source/base/report_events'

# alias for Slack module defined in slack-ruby-client
SlackClient = Slack

module Roko
  module Source
    module Slack
      # report events from slack
      class ReportEvents < Roko::Source::Base::ReportEvents
        def client
          SlackClient.configure do |config|
            config.token = ENV['SLACK_API_TOKEN']
          end
          SlackClient::Web::Client.new
        end

        def fetch_service_event(client)
          Events.new(client).fetch(@start.to_s, @end.to_s)
        end

        def to_report_event(event)
          EventAdapter.to_report_event(event)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roko-0.2.1 lib/roko/source/slack/report_events.rb
roko-0.2.0 lib/roko/source/slack/report_events.rb