Sha256: 32dea1b2322bffe6ed786b6c7c5dce47e75cb6bc8c96664a28fa2c0709123a86

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 Bytes

Contents

module Furik
  class Events
    def initialize(client)
      @client = client
      @login = client.login
    end

    def events_with_grouping(from, to, &block)
      @client.user_events(@login).each.with_object({}) { |event, memo|
        if event && aggressives.include?(event.type)
          if from <= event.created_at.localtime.to_date && event.created_at.localtime.to_date <= to
            memo[event.repo.name] ||= []
            memo[event.repo.name] << event
          end
        end
      }.each do |repo, events|
        block.call(repo, events) if block
      end
    end

    def aggressives
      %w(
        IssuesEvent
        PullRequestEvent
        PullRequestReviewCommentEvent
        IssueCommentEvent
        CommitCommentEvent
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
furik-0.2.0 lib/furik/events.rb
furik-0.1.4 lib/furik/events.rb
furik-0.1.3 lib/furik/events.rb
furik-0.1.2 lib/furik/events.rb
furik-0.1.1 lib/furik/events.rb
furik-0.1.0 lib/furik/events.rb