class Hubkit::EventPaginator

Returns all events for a GitHub issues– for example, labeling, unlabeling, closing, etc– and handle pagination for you

Public Class Methods

new(org:, repo:, issue_number: nil) click to toggle source

Initialize a new paginator for events from the API @param [String] org the github organization which contains the repo for

which we'll gather events

@param [String] repo the github repo name for which we'll gather events @param [optional Fixnum] issue_number if present, the number of the issue

for which we'll sfind events
Calls superclass method
# File lib/hubkit/event_paginator.rb, line 13
def initialize(org:, repo:, issue_number: nil)
  @org = org
  @repo = repo
  @issue_number = issue_number

  opts =
    if issue_number.present?
      { issue_number: issue_number }
    else
      {}
    end

  super() do |i|
    Cooldowner.with_cooldown do
      Hubkit.client.issues.events.list(
        @org,
        @repo,
        opts.merge(page: i),
      )
    end
  end
end