Class: GitWand::GitHub::API::Client
- Inherits:
-
Object
- Object
- GitWand::GitHub::API::Client
- Includes:
- GitWand::GitHub::API::Commands::Branch, GitWand::GitHub::API::Commands::File, GitWand::GitHub::API::Commands::Issue, GitWand::GitHub::API::Commands::PullRequest, GitWand::GitHub::API::Commands::Repository
- Defined in:
- lib/git_wand/github/api/client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #current_user_info ⇒ Object
-
#initialize(username:, token:) ⇒ Client
constructor
A new instance of Client.
Methods included from GitWand::GitHub::API::Commands::File
#create_file, #delete_file, #get_file, #update_file
Methods included from GitWand::GitHub::API::Commands::Branch
#create_branch, #delete_branch, #get_branch
Methods included from GitWand::GitHub::API::Commands::PullRequest
#create_pull_request, #create_pull_request_from_issue, #get_pull_request, #list_pull_requests, #merge_pull_request, #raw_create_pull_request
Methods included from GitWand::GitHub::API::Commands::Issue
#create_issue, #get_issue, #list_repository_issues
Methods included from GitWand::GitHub::API::Commands::Repository
#create_repository, #delete_repository
Constructor Details
#initialize(username:, token:) ⇒ Client
Returns a new instance of Client.
24 25 26 27 |
# File 'lib/git_wand/github/api/client.rb', line 24 def initialize(username:, token:) @username = username @token = token end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
22 23 24 |
# File 'lib/git_wand/github/api/client.rb', line 22 def token @token end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
22 23 24 |
# File 'lib/git_wand/github/api/client.rb', line 22 def username @username end |
Instance Method Details
#current_user_info ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/git_wand/github/api/client.rb', line 29 def current_user_info response = get(resource: "user") result = Result.new result.success = response[:status][:code] == "200" result.body = response[:body] result end |