class Apperol::GithubClient

Public Instance Methods

client() click to toggle source
# File lib/apperol/github_client.rb, line 19
def client
  @client ||= Net::HTTP.new(url.hostname, url.port).tap do |http|
    http.use_ssl = true
  end
end
get(path) click to toggle source
# File lib/apperol/github_client.rb, line 12
def get(path)
  req = Net::HTTP::Get.new(url + path)
  req.basic_auth *Apperol::Creds.github
  res = client.request(req)
  Apperol::Response.new(res.code, res.body, headers: res.to_hash)
end
tarball(repository, branch = "master") click to toggle source
# File lib/apperol/github_client.rb, line 6
def tarball(repository, branch = "master")
  tarball_path = "/repos/#{repository}/tarball/#{branch}"
  res = get(tarball_path)
  res.header("Location")
end
url() click to toggle source
# File lib/apperol/github_client.rb, line 25
def url
  URI("https://api.github.com")
end