Class: DeployLog::Github::Api
- Inherits:
-
Object
- Object
- DeployLog::Github::Api
- Defined in:
- lib/deploy_log/github/api.rb
Instance Method Summary collapse
- #commits_for(id) ⇒ Object
-
#initialize(repo) ⇒ Api
constructor
A new instance of Api.
- #pull_request(id) ⇒ Object
- #pull_requests(options = {}) ⇒ Object
Constructor Details
#initialize(repo) ⇒ Api
Returns a new instance of Api.
10 11 12 13 14 15 |
# File 'lib/deploy_log/github/api.rb', line 10 def initialize(repo) @client = Octokit::Client.new(login: ENV['GITHUB_USER'], password: ENV['GITHUB_TOKEN']) @client.auto_paginate = true @repo = repo end |
Instance Method Details
#commits_for(id) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/deploy_log/github/api.rb', line 39 def commits_for(id) begin @client.pull_request_commits(@repo, id) rescue Octokit::NotFound => e Notify.error e. end end |
#pull_request(id) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/deploy_log/github/api.rb', line 31 def pull_request(id) begin @client.pull_request(@repo, id) rescue Octokit::NotFound => e Notify.error e. end end |
#pull_requests(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/deploy_log/github/api.rb', line 17 def pull_requests( = {}) default_opts = { state: :closed, per_page: 500, sort: 'long-running' } begin @client.pull_requests(@repo, default_opts.merge()) rescue Octokit::NotFound => e Notify.error e. end end |