Sha256: 212d8401107ee030d79628a3f8428df8201160628871a8397def569cde30cde6
Contents?: true
Size: 758 Bytes
Versions: 2
Compression:
Stored size: 758 Bytes
Contents
require "hub_link/api/pull_request" require "hub_link/batch" module HubLink class Stream GITHUB_BATCH_SIZE = 7 # Days def initialize(repo, start_date: nil) @repo = repo @start_date = (start_date || date_of_first_pr).to_date end def in_batches(&block) queries.each do |query| yield Batch.new(query) end end private attr_accessor :repo, :start_date def date_of_first_pr Api::PullRequest.oldest(repo: repo)&.updated_at end def queries start_date.step(end_date, GITHUB_BATCH_SIZE).map do |date| "type:pr updated:#{date}..#{date + GITHUB_BATCH_SIZE} repo:#{repo}" end end def end_date Date.tomorrow end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hub_link-0.8.0 | lib/hub_link/stream.rb |
hub_link-0.7.0 | lib/hub_link/stream.rb |