Class: GithubApi

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/kraken-build/github-api.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ GithubApi

Returns a new instance of GithubApi.



4
5
6
7
8
9
10
# File 'lib/kraken-build/github-api.rb', line 4

def initialize(config)
  @oauth_token = config[:token]
  @owner = config[:owner]
  @repository = config[:repository]
  @headers = {:headers => {"User-Agent" => "Kraken-Build"}}
  self.class.base_uri "https://api.github.com"
end

Instance Method Details

#get_branches(options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/kraken-build/github-api.rb', line 12

def get_branches(options = {})
  options.merge!(@headers)
  response = self.class.get("/repos/#{@owner}/#{@repository}/branches?access_token=#{@oauth_token}", options)
  response.map{|branch| branch["name"]}
end