class RepoHttpHandler

Public Class Methods

new() click to toggle source
# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 13
def initialize
  @@responseStatus=false
  @@uri_builder=UriBuilder.new

end
set_auth_token(token) click to toggle source
# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 20
def self.set_auth_token (token)
  @@app_token=token
end

Public Instance Methods

get_contributors_of_a_repository(username,repo_name) { |JSON| ... } click to toggle source

Get all contributors of a given repository

Attributes

  • username -> username of the account

  • repo_name -> name of repository

# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 69
def get_contributors_of_a_repository(username,repo_name) # :yields: JSON
  uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::CONTRIBUTORS,username,repo_name))
  http= HttpHandler.initiate_http(uri)
  begin
    response=HttpHandler.get_response(http,uri)
  rescue ArgumentError
    puts "Request failed with code: #{response.code}"
  else
    @@responseStatus=true
    return response
  end
end
get_languages_of_a_repository(username, repo_name) { |JSON| ... } click to toggle source

Retrieves all the major languages used in a repository

Attributes

  • username -> username of github repo

  • repo_name -> name of repository to get languages

# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 29
def get_languages_of_a_repository(username, repo_name) # :yields: JSON
  uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::LANGUAGES,username,repo_name))
  http=HttpHandler.initiate_http(uri)

  begin
    response=HttpHandler.get_response(http,uri)
  rescue ArgumentError
    puts "Request failed with code: #{response.code}"
  else
    @@responseStatus=true
    return response
  end
end
get_readme_of_a_repository(username,repo_name) { |JSON| ... } click to toggle source

Get README of given repository

Attributes

  • username -> username of the account

  • repo_name -> name of repository

# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 87
def get_readme_of_a_repository(username,repo_name) # :yields: JSON
  uri=URI.parse(@@uri_builder.get_repo_content(Api_options::REPO::README,username,repo_name))
  http=HttpHandler.initiate_http(uri)
  begin
    response=HttpHandler.get_response(http,uri)
  rescue ArgumentError
    puts "Request failed with code: #{response.code}"
  else
    @@responseStatus=true
    return response
  end
end
get_response_status() click to toggle source
# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 44
def get_response_status
  @@responseStatus
end
get_user_repos(username) { |JSON| ... } click to toggle source

Get a list of repositories for the given user

Attributes

  • username -> username of the account

# File lib/github_api_ruby_lib/http/repo_http_handler.rb, line 51
def get_user_repos(username) # :yields: JSON
  uri=URI.parse(@@uri_builder.user_repos_url(username,@@app_token))
  http=HttpHandler.initiate_http(uri)
  begin
    response=HttpHandler.get_response(http,uri)
  rescue ArgumentError
    puts "Request failed with code: #{response.code}"
  else
    @@responseStatus=true
    return response
  end
end