Sha256: b22516fd8318cfaca269a4a0386f3e64ef4debaf00b3fb5cdeb3204ce455b23d
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'chronicle/etl' require 'octokit' module Chronicle module Github class ActivityExtractor < Chronicle::ETL::Extractor register_connector do |r| r.provider = 'github' r.description = 'user activity' r.identifier = 'activity' end setting :access_token, required: true setting :username def prepare @client = ::Octokit::Client.new(access_token: @config.access_token) @access_token_owner = @client.user end def results_count end def extract events = @client.user_events(username) has_more = events.any? count = 0 while has_more events = events.first(@config.limit - count) if @config.limit events = events.filter { |event| event.created_at > @config.since } if @config.since break unless events.any? events.each do |event| count += 1 yield Chronicle::ETL::Extraction.new(data: event, meta: { user: @user}) end break unless @client.last_response.rels[:next] events = @client.get(@client.last_response.rels[:next].href) has_more = events.any? end end private def username @config.username || @access_token_owner.login end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chronicle-github-0.1.0 | lib/chronicle/github/activity_extractor.rb |