lib/chronicle/github/activity_extractor.rb in chronicle-github-0.1.0 vs lib/chronicle/github/activity_extractor.rb in chronicle-github-0.2.0
- old
+ new
@@ -3,26 +3,24 @@
module Chronicle
module Github
class ActivityExtractor < Chronicle::ETL::Extractor
register_connector do |r|
- r.provider = 'github'
- r.description = 'user activity'
- r.identifier = 'activity'
+ r.source = :github
+ r.type = :activity
+ r.strategy = :api
+ r.description = 'github 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
@@ -32,10 +30,10 @@
break unless events.any?
events.each do |event|
count += 1
- yield Chronicle::ETL::Extraction.new(data: event, meta: { user: @user})
+ yield build_extraction(data: event, meta: { user: @user })
end
break unless @client.last_response.rels[:next]
events = @client.get(@client.last_response.rels[:next].href)