class PrNotifier::Github
Attributes
client[R]
Public Class Methods
new(access_token:)
click to toggle source
# File lib/pr-notifier/github.rb, line 23 def initialize(access_token:) @client = Octokit::Client.new(access_token: access_token) end
Public Instance Methods
fetch_prs_by(repo)
click to toggle source
# File lib/pr-notifier/github.rb, line 27 def fetch_prs_by(repo) prs = client.pull_requests(repo, { state: "open" }) prs.map do |pr| PullRequest.new( repo: repo, repo_url: pr.head.repo.html_url, url: pr.html_url, title: pr.title, body: pr.body, reviewers: pr.requested_reviewers.map { |reviewer| reviewer[:login] }, assignees: pr.assignees.map { |assignee| assignee[:login] }, creator: pr.user[:login], created_at: pr.created_at, ) end end