Class: GithubApi
- Inherits:
-
Object
- Object
- GithubApi
- Includes:
- HTTParty
- Defined in:
- lib/kraken-build/github-api.rb
Instance Method Summary collapse
- #get_branches(options = {}) ⇒ Object
-
#initialize(config) ⇒ GithubApi
constructor
A new instance of GithubApi.
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( = {}) .merge!(@headers) response = self.class.get("/repos/#{@owner}/#{@repository}/branches?access_token=#{@oauth_token}", ) response.map{|branch| branch["name"]} end |