Class: PdkSync::GithubClient
- Inherits:
-
Object
- Object
- PdkSync::GithubClient
- Defined in:
- lib/pdksync/githubclient.rb
Instance Method Summary collapse
-
#create_pull_request(repo_name, create_pr_against, head, title, message) ⇒ Object
An Octokit pull request object for the newly created pull request.
-
#delete_branch(repo_name, branch_name) ⇒ Boolean
True on success, false on failure.
-
#initialize(access_token) ⇒ GithubClient
constructor
A new instance of GithubClient.
-
#labels(repo_name) ⇒ Array
List of available labels in the repository.
-
#repository?(repository) ⇒ Boolean
True if the repository exists, false otherwise.
-
#update_issue(repo_name, issue_number, options) ⇒ Object
An Octokit issue object of the updated issue.
Constructor Details
#initialize(access_token) ⇒ GithubClient
Returns a new instance of GithubClient.
13 14 15 16 |
# File 'lib/pdksync/githubclient.rb', line 13 def initialize(access_token) @client = Octokit::Client.new(access_token: access_token.to_s) @client.user.login end |
Instance Method Details
#create_pull_request(repo_name, create_pr_against, head, title, message) ⇒ Object
Returns An Octokit pull request object for the newly created pull request.
39 40 41 |
# File 'lib/pdksync/githubclient.rb', line 39 def create_pull_request(repo_name, create_pr_against, head, title, ) @client.create_pull_request(repo_name, create_pr_against, head, title, ) end |
#delete_branch(repo_name, branch_name) ⇒ Boolean
Returns true on success, false on failure.
72 73 74 |
# File 'lib/pdksync/githubclient.rb', line 72 def delete_branch(repo_name, branch_name) @client.delete_branch(repo_name, branch_name) end |
#labels(repo_name) ⇒ Array
Returns List of available labels in the repository.
48 49 50 |
# File 'lib/pdksync/githubclient.rb', line 48 def labels(repo_name) @client.labels(repo_name) end |
#repository?(repository) ⇒ Boolean
Returns true if the repository exists, false otherwise.
22 23 24 |
# File 'lib/pdksync/githubclient.rb', line 22 def repository?(repository) @client.repository?(repository) end |
#update_issue(repo_name, issue_number, options) ⇒ Object
Returns An Octokit issue object of the updated issue.
61 62 63 |
# File 'lib/pdksync/githubclient.rb', line 61 def update_issue(repo_name, issue_number, ) @client.update_issue(repo_name, issue_number, ) end |