Sha256: 4ef63ef505d5d73907aa7ee0b9df79b33dd283005d188a706b6980316c88fbf3

Contents?: true

Size: 950 Bytes

Versions: 7

Compression:

Stored size: 950 Bytes

Contents

class Ghn
  class Collector
    attr_reader :client, :repo_full_name, :follow_issuecomment, :participating

    def initialize(client, repo_full_name = nil, options = {})
      @client = client
      @repo_full_name = repo_full_name
      @follow_issuecomment = options[:follow_issuecomment] || false
      @participating = options[:participating] || false
    end

    def collect(page = 1)
      notifications = if repo_full_name
                        client.repo_notifications(repo_full_name, page: page, participating: participating)
                      else
                        client.notifications(page: page, participating: participating)
                      end
      @count = notifications.count
      notifications.map { |notification|
        Notification.new(notification, follow_issuecomment).type_class.new(notification, follow_issuecomment).url
      }.compact
    end

    def has_next?
      @count == 50
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ghn-2.4.1 lib/ghn/collector.rb
ghn-2.4.0 lib/ghn/collector.rb
ghn-2.3.0 lib/ghn/collector.rb
ghn-2.2.0 lib/ghn/collector.rb
ghn-2.1.2 lib/ghn/collector.rb
ghn-2.1.1 lib/ghn/collector.rb
ghn-2.1.0 lib/ghn/collector.rb