class SemamoreOctoClient

Attributes

branch[R]
client[R]
repo[R]

Public Class Methods

new(token, options: { auto_paginate: true }) click to toggle source
# File lib/semamore_octo_client.rb, line 4
def initialize(token, options: { auto_paginate: true })
  @client = Octokit::Client.new(options.merge(access_token: token))
end

Public Instance Methods

current_pr(repo, branch) click to toggle source
# File lib/semamore_octo_client.rb, line 13
def current_pr(repo, branch)
  p 'Selecting current PR...'
  open_prs(repo).select {|pr| pr[:head][:ref] == branch}.first
end
current_pr_files(repo, branch) click to toggle source
# File lib/semamore_octo_client.rb, line 8
def current_pr_files(repo, branch)
  p 'Fetching current PR changed files...'
  client.pull_request_files(repo, current_pr(repo, branch)[:number])
end
open_prs(repo) click to toggle source
# File lib/semamore_octo_client.rb, line 18
def open_prs(repo)
  p 'Fetching open PRs...'
  client.pull_requests(repo, :state => "open")
end