Class: Hubkit::IssuePaginator

Inherits:
Paginator show all
Includes:
Enumerable
Defined in:
lib/hubkit/issue_paginator.rb

Overview

Returns the list of issues for a repo, handling pagination for you

Instance Method Summary collapse

Methods inherited from Paginator

#each

Constructor Details

#initialize(org:, repo:, state: 'open') ⇒ IssuePaginator

Initialize a new paginator for issues from the API

Parameters:

  • org (String)

    the github organization which contains the repo for which we'll gather issues

  • repo (String)

    the github repo name for which we'll gather issues

  • state (optional String)

    if missing or open, the paginator will only have open issues returned. If 'all', the paginator will give you open and closed issues.


13
14
15
16
17
18
19
20
21
# File 'lib/hubkit/issue_paginator.rb', line 13

def initialize(org:, repo:, state: 'open')
  @org = org
  @repo = repo
  super() do |i|
    Cooldowner.with_cooldown do
      Github.issues.list(user: @org, repo: @repo, state: state, page: i)
    end
  end
end