Skip to content

Instantly share code, notes, and snippets.

@mchail
Created October 30, 2015 21:52
Show Gist options
  • Save mchail/effbd3fe41c6291e5d89 to your computer and use it in GitHub Desktop.
Save mchail/effbd3fe41c6291e5d89 to your computer and use it in GitHub Desktop.
find Jordan's last PR
require 'json'
require 'httparty'
class FindJordansPR
def auth
{
username: :mchail,
password: ENV['pw']
}
end
def get(path)
response = HTTParty.get("https://api.github.com/#{path}", basic_auth: auth)
JSON.parse(response.body)
end
def prs
all_prs = []
["nowspots", "perfectaudience"].each do |org|
repos = get("orgs/#{org}/repos")
repo_names = repos.map do |repo|
repo["name"]
end
repo_names.each do |repo|
all_prs += get("repos/#{org}/#{repo}/pulls")
end
end
all_prs
end
def prs_by_name
prs.group_by do |pr|
pr["user"]["login"]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment