Module: SortedSearch::GitHub

Defined in:
lib/sorted_search/github.rb

Overview

Github API client

Constant Summary collapse

HOSTNAME =
"api.github.com"

Class Method Summary collapse

Class Method Details

.get_repo(owner, repo, &completion) ⇒ Object

returns Typhoeus::Request object, that can be added to Hydra completion block will be called with parsed response, or nil if request failed



16
17
18
19
20
21
# File 'lib/sorted_search/github.rb', line 16

def self.get_repo(owner, repo, &completion)
  token = SortedSearch::Credentials.token
  request = Typhoeus::Request.new("https://#{HOSTNAME}/repos/#{owner}/#{repo}", headers: { Authorization: "token #{token}" })
  request.on_complete(&self.parse_block(&completion))
  request
end