class MrBump::GitApi

This class makes calls to the github API

Attributes

client[RW]

Public Class Methods

new(token) click to toggle source
# File lib/mr_bump/git_api.rb, line 11
def initialize(token)
  @client = Octokit::Client.new(access_token: token)
end

Public Instance Methods

merge_pr(repo_url, pr_id) click to toggle source
# File lib/mr_bump/git_api.rb, line 23
def merge_pr(repo_url, pr_id)
  client.merge_pull_request(repo_url, pr_id)
end
prs(repo_url) click to toggle source
# File lib/mr_bump/git_api.rb, line 15
def prs(repo_url)
  @prs ||= client.pull_requests(repo_url, state: 'open')
end
sorted_prs(repo_url) click to toggle source
# File lib/mr_bump/git_api.rb, line 19
def sorted_prs(repo_url)
  prs(repo_url).map { |x| '#' + x[:number].to_s + ' - ' + x[:title].to_s + "\n" }.first(10).join
end