Class: PrComet::Github::Client
- Inherits:
-
Object
- Object
- PrComet::Github::Client
- Defined in:
- lib/pr_comet/github/client.rb
Overview
GitHub API Client
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#add_labels(issue_number, *labels) ⇒ Object
Description of #add_labels.
-
#create_pull_request(base:, head:, title:, body:) ⇒ Integer
Create a pull request.
-
#initialize(access_token, remote_url) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(access_token, remote_url) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/pr_comet/github/client.rb', line 9 def initialize(access_token, remote_url) @client = Octokit::Client.new(access_token: access_token) @repository = remote_url.match(REPOSITORY_MATCHER)[:repository] end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
7 8 9 |
# File 'lib/pr_comet/github/client.rb', line 7 def repository @repository end |
Instance Method Details
#add_labels(issue_number, *labels) ⇒ Object
Description of #add_labels
31 32 33 |
# File 'lib/pr_comet/github/client.rb', line 31 def add_labels(issue_number, *labels) client.add_labels_to_an_issue(repository, issue_number, labels) end |
#create_pull_request(base:, head:, title:, body:) ⇒ Integer
Create a pull request
21 22 23 24 25 |
# File 'lib/pr_comet/github/client.rb', line 21 def create_pull_request(base:, head:, title:, body:) response = client.create_pull_request(repository, base, head, title, body) response.number end |