Sha256: f2d10deb7ad64bed97a95cd55283b29fbb177f148892bc61d58070264fff41f9
Contents?: true
Size: 841 Bytes
Versions: 2
Compression:
Stored size: 841 Bytes
Contents
require 'octokit' module PrLog # Adapter for Github Api class GithubRepository def initialize(name, access_token) @name = name @client = Octokit::Client.new(access_token: access_token) end def pull_requests_with_milestone(milestone) fail_if_empty(get_issues(milestone_query(milestone))) end private def milestone_query(milestone) "repo:#{@name} type:pr is:merged milestone:#{milestone}" end def fail_if_empty(result) return result if result.any? raise(NoPullRequestsForMilestone, 'No pull requests for milestone') end def get_issues(query) @client.search_issues(query, per_page: 1000)['items'].map(&:to_hash) rescue Octokit::UnprocessableEntity raise(GithubRepositoryNotFound, 'Github repository not found') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pr_log-0.3.0 | lib/pr_log/github_repository.rb |
pr_log-0.2.0 | lib/pr_log/github_repository.rb |