Class: GitWand::GitHub::API::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#tokenObject (readonly)

Returns the value of attribute token.



22
23
24
# File 'lib/git_wand/github/api/client.rb', line 22

def token
  @token
end

#usernameObject (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_infoObject



29
30
31
32
33
34
35
# File 'lib/git_wand/github/api/client.rb', line 29

def 
  response = get(resource: "user")
  result = Result.new
  result.success = response[:status][:code] == "200"
  result.body = response[:body]
  result
end