Sha256: e72b09d804f2adfdb6f863201a5c803563c42f35cc2a5035c59f211e9116f1af
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 Bytes
Contents
require "hub_link/api/pull_request" require "hub_link/batch" module HubLink class Stream GITHUB_BATCH_SIZE = 14 def initialize(repos, start_date: 64.weeks.ago) @repos = repos.split(",") @start_date = start_date.to_date end def in_batches(&block) queries.each do |query| yield Batch.new(query) end end private attr_accessor :repos, :start_date def queries start_date.step(end_date, GITHUB_BATCH_SIZE).map do |date| "type:pr created:#{date}..#{date + GITHUB_BATCH_SIZE} #{repo_query}" end end def end_date Date.tomorrow end def repo_query @_repo_query ||= build_repo_query end def build_repo_query repos.map do |r| "repo:#{r}" end.join(" ") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hub_link-0.1.0 | lib/hub_link/stream.rb |