Class: Reviewlette::GithubConnection
- Inherits:
-
Object
- Object
- Reviewlette::GithubConnection
- Defined in:
- lib/reviewlette/github_connection.rb
Constant Summary collapse
- GITHUB_CONFIG =
YAML.load_file("#{File.dirname(__FILE__)}/../../config/.github.yml")
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#repo ⇒ Object
Returns the value of attribute repo.
Instance Method Summary collapse
- #add_assignee(repo, number, title, body, name) ⇒ Object
- #comment_on_issue(repo, number, name, trello_card_url) ⇒ Object
- #get_branch_name(pr_id, repo) ⇒ Object
- #gh_connection ⇒ Object
-
#initialize ⇒ GithubConnection
constructor
A new instance of GithubConnection.
- #list_issues(repo) ⇒ Object
- #list_pulls(repo) ⇒ Object
- #pull_merged?(repo, number) ⇒ Boolean
Constructor Details
#initialize ⇒ GithubConnection
Returns a new instance of GithubConnection.
12 13 14 |
# File 'lib/reviewlette/github_connection.rb', line 12 def initialize gh_connection end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/reviewlette/github_connection.rb', line 10 def client @client end |
#repo ⇒ Object
Returns the value of attribute repo.
10 11 12 |
# File 'lib/reviewlette/github_connection.rb', line 10 def repo @repo end |
Instance Method Details
#add_assignee(repo, number, title, body, name) ⇒ Object
32 33 34 |
# File 'lib/reviewlette/github_connection.rb', line 32 def add_assignee(repo, number, title, body, name) @client.update_issue(repo, number, title, body, :assignee => name) end |
#comment_on_issue(repo, number, name, trello_card_url) ⇒ Object
36 37 38 |
# File 'lib/reviewlette/github_connection.rb', line 36 def comment_on_issue(repo, number, name, trello_card_url) @client.add_comment(repo, number, "@#{name} is your reviewer :thumbsup: check #{trello_card_url}") end |
#get_branch_name(pr_id, repo) ⇒ Object
20 21 22 |
# File 'lib/reviewlette/github_connection.rb', line 20 def get_branch_name(pr_id, repo) @client.pull_requests(repo)[pr_id].head.ref end |
#gh_connection ⇒ Object
16 17 18 |
# File 'lib/reviewlette/github_connection.rb', line 16 def gh_connection @client = Octokit::Client.new(:access_token => GITHUB_CONFIG['token']) end |
#list_issues(repo) ⇒ Object
40 41 42 |
# File 'lib/reviewlette/github_connection.rb', line 40 def list_issues(repo) @client.list_issues(repo) end |
#list_pulls(repo) ⇒ Object
24 25 26 |
# File 'lib/reviewlette/github_connection.rb', line 24 def list_pulls(repo) @client.pull_requests(repo) end |
#pull_merged?(repo, number) ⇒ Boolean
28 29 30 |
# File 'lib/reviewlette/github_connection.rb', line 28 def pull_merged?(repo, number) client.pull_merged?(repo, number) end |