class Github::Developer

Main class to set up a Github User

Attributes

avatar_url[R]
bio[R]
blog[R]
company[R]
email[R]
followers[R]
following[R]
id[R]
location[R]
name[R]
public_repos[R]
username[R]

Public Class Methods

find(username:) click to toggle source
# File lib/gitget/github_developer.rb, line 54
def self.find(username:)
  user_data = Github::API.user_info(username)
  return nil if user_data['message'] == 'Not Found'
  new(data: user_data)
end
new(data: nil) click to toggle source
# File lib/gitget/github_developer.rb, line 9
def initialize(data: nil)
  load_data(data)
end

Public Instance Methods

load_data(repo_data) click to toggle source
# File lib/gitget/github_developer.rb, line 41
def load_data(repo_data)
  @username = repo_data['login']
  @id = repo_data['id']
  @public_repos = repo_data['public_repos']
  @avatar_url = repo_data['avatar_url']
  @name = repo_data['name']
  @company = repo_data['company']
  @blog = repo_data['blog']
  @location = repo_data['location']
  @email = repo_data['email']
  @bio = repo_data['bio']
end
repos() click to toggle source
# File lib/gitget/github_developer.rb, line 13
def repos
  return @repos if @repos

  repos_promises = Github::API.user_repos(@username).map do |repo_data|
      Concurrent::Promise.execute {Github::Repository.new(data: repo_data)}
  end
  @repos = repos_promises.map(&:value)
  @repos
end
starred() click to toggle source
# File lib/gitget/github_developer.rb, line 35
def starred
  return @starred if @starred

  @starred = Github::API.user_starred @username
end