Class: GitHelper::GitHubClient

Inherits:
Object
  • Object
show all
Defined in:
lib/git_helper/github_client.rb

Instance Method Summary collapse

Instance Method Details

#create_pull_request(repo_name, options) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/git_helper/github_client.rb', line 13

def create_pull_request(repo_name, options)
  opts_as_string = format_options(options)
  run(
    repo_name.split('/').first,
    'POST',
    "/repos/#{repo_name}/pulls",
    opts_as_string
  )
end

#merge_pull_request(repo_name, pull_request_id, options) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/git_helper/github_client.rb', line 23

def merge_pull_request(repo_name, pull_request_id, options)
  opts_as_string = format_options(options)
  run(
    repo_name.split('/').first,
    'PUT',
    "/repos/#{repo_name}/pulls/#{pull_request_id}/merge",
    opts_as_string
  )
end

#pull_request(repo_name, pull_request_id) ⇒ Object



9
10
11
# File 'lib/git_helper/github_client.rb', line 9

def pull_request(repo_name, pull_request_id)
  run(repo_name.split('/').first, nil, "/repos/#{repo_name}/pulls/#{pull_request_id}")
end

#repository(repo_name) ⇒ Object



5
6
7
# File 'lib/git_helper/github_client.rb', line 5

def repository(repo_name)
  run(repo_name.split('/').first, nil, "/repos/#{repo_name}")
end