Class: GithubCLI::API
- Inherits:
-
Object
- Object
- GithubCLI::API
- Defined in:
- lib/github_cli/api.rb
Overview
The API class is the main entry point for creating GithubCLI APIs.
Direct Known Subclasses
Assignee, Authorization, Blob, Collaborator, Commit, Content, Download, Email, Event, Follower, Fork, Gist, Hook, Issue, Key, Label, Member, Merging, Milestone, Organization, PullRequest, Reference, Repository, Search, Starring, Status, Tag, Team, Tree, User, Watching
Defined Under Namespace
Classes: All
Constant Summary collapse
- ENDPOINT =
''- @@api =
nil
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/github_cli/api.rb', line 13 def config @config end |
Class Method Details
.configure_api ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/github_cli/api.rb', line 21 def configure_api @@api = Github.new @@api.oauth_token = GithubCLI.config['auth.token'] @@api.basic_auth = GithubCLI.config['auth.basic'] @@api.endpoint = GithubCLI.config['core.endpoint'] || @@api.endpoint if ENV['TEST_HOST'] @@api.endpoint = 'http://' + ENV['TEST_HOST'] end @@api end |
.github_api ⇒ Object
15 16 17 18 19 |
# File 'lib/github_cli/api.rb', line 15 def github_api @@api ||= begin @@api = configure_api end end |
.output(format = :table, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/github_cli/api.rb', line 32 def output(format=:table, &block) response = block.call formatter = Formatter.new response, :format => format formatter.render_output end |