class Github::Repository

Main class to set up a Github User

Attributes

created_at[R]
forks[R]
forks_count[R]
full_name[R]
git_url[R]
has_downloads[R]
has_issues[R]
id[R]
is_fork[R]
is_private[R]
language[R]
name[R]
open_issues[R]
open_issues_count[R]
pushed_at[R]
size[R]
stargazers_count[R]
updated_at[R]
watchers[R]
watchers_count[R]

Public Class Methods

find(owner:, repo:) click to toggle source
# File lib/gitget/github_repository.rb, line 49
def self.find(owner:, repo:)
  repo_data = Github::API.repo_info(owner, repo)
  return nil if repo_data['message'] == 'Not Found'
  new(data: repo_data)\
end
new(data: nil) click to toggle source
# File lib/gitget/github_repository.rb, line 12
def initialize(data: nil)
  load_data(data)
end

Public Instance Methods

load_data(repo_data) click to toggle source
# File lib/gitget/github_repository.rb, line 33
def load_data(repo_data)
  @id = repo_data['id']
  @full_name = repo_data['full_name']
  @is_private = repo_data['is_private']
  @is_fork = repo_data['is_fork']
  @created_at = repo_data['created_at']
  @pushed_at = repo_data['pushed_at']
  @size = repo_data['size']
  @stargazers_count = repo_data['stargazers_count']
  @watchers_count = repo_data['watchers_count']
  @forks_count = repo_data['forks_count']
  @open_issues_count = repo_data['open_issues_count']
  @language = repo_data['language']
  @git_url = repo_data['git_url']
end
stats(stat_names: ['code_frequency']) click to toggle source
# File lib/gitget/github_repository.rb, line 16
def stats(stat_names: ['code_frequency'])
  return @stats if @stats

  @stats = {}
  stats_promises = {}

  stat_names.each do |stat|
    stats_promises[stat.to_sym] = Concurrent::Promise.execute {
      Github::API.repo_stat(@full_name, stat)
    }
  end
  stats_promises.each do |stat_name, stat_value|
    @stats[stat_name] = stat_value.value
  end
  @stats
end