Class: WhatsupGithub::Client
- Inherits:
-
Object
- Object
- WhatsupGithub::Client
- Includes:
- Singleton
- Defined in:
- lib/whatsup_github/client.rb
Overview
Create a singleton object for Client. Authorize with a GitHub token from $WHATSUP_GITHUB_ACCESS_TOKEN if available Otherwise, use credentials from ~/.netrc Otherwise, continue as a Guest
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #org_members(org) ⇒ Object
- #pull_request(repo, number) ⇒ Object
- #search_issues(query) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/whatsup_github/client.rb', line 17 def initialize @client = if WHATSUP_GITHUB_ACCESS_TOKEN Octokit::Client.new(access_token: WHATSUP_GITHUB_ACCESS_TOKEN) elsif File.exist? "#{ENV['HOME']}/.netrc" Octokit::Client.new(netrc: true) else Octokit::Client.new end end |
Instance Method Details
#org_members(org) ⇒ Object
36 37 38 |
# File 'lib/whatsup_github/client.rb', line 36 def org_members(org) @client.org_members(org) end |
#pull_request(repo, number) ⇒ Object
32 33 34 |
# File 'lib/whatsup_github/client.rb', line 32 def pull_request(repo, number) @client.pull_request(repo, number) end |
#search_issues(query) ⇒ Object
28 29 30 |
# File 'lib/whatsup_github/client.rb', line 28 def search_issues(query) @client.search_issues(query) end |