Sha256: 732b7e721c3697ec178f808db0caa77ebfb75c7895ab5e4fe28e1fad8dc91fe2

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

class Ghn
  class Collector
    def initialize(client, repo_full_name = nil)
      @client = client
      @repo_full_name = repo_full_name
    end

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

    def has_next?
      @count == 50
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ghn-2.0.0.pre4 lib/ghn/collector.rb
ghn-2.0.0.pre3 lib/ghn/collector.rb