Class: Octocat::API
- Inherits:
-
Object
- Object
- Octocat::API
- Defined in:
- lib/octocat/api.rb
Constant Summary collapse
- API_ROOT_URL =
'https://api.github.com/'
Instance Method Summary collapse
- #compare_branch(project, current_branch) ⇒ Object
- #new_pr(project, current_branch) ⇒ Object
- #open_branch(project, current_branch) ⇒ Object
- #open_pr(project, current_branch) ⇒ Object
- #pull_requests(project) ⇒ Object
Instance Method Details
#compare_branch(project, current_branch) ⇒ Object
26 27 28 |
# File 'lib/octocat/api.rb', line 26 def compare_branch(project, current_branch) `open #{compare_url_for_branch(project, current_branch)}` end |
#new_pr(project, current_branch) ⇒ Object
14 15 16 |
# File 'lib/octocat/api.rb', line 14 def new_pr(project, current_branch) `open #{pr_url_for(project, current_branch)}` end |
#open_branch(project, current_branch) ⇒ Object
22 23 24 |
# File 'lib/octocat/api.rb', line 22 def open_branch(project, current_branch) `open #{branch_url_for(project, current_branch)}` end |
#open_pr(project, current_branch) ⇒ Object
18 19 20 |
# File 'lib/octocat/api.rb', line 18 def open_pr(project, current_branch) `open #{pull_request_url_for_branch(project, current_branch)}` end |
#pull_requests(project) ⇒ Object
8 9 10 11 12 |
# File 'lib/octocat/api.rb', line 8 def pull_requests(project) password = `/usr/bin/security find-internet-password -g -a halogenandtoast -s github.com -w`.chomp connection = open("#{API_ROOT_URL}repos/#{project}/pulls", http_basic_authentication: ["halogenandtoast", password]) JSON.parse(connection.read) end |