class GitGraph::GitHub::Client

Attributes

client[R]

Public Class Methods

new() click to toggle source
# File lib/gitGraph/github/client.rb, line 13
def initialize
  @client = Octokit::Client.new(
    login:    GitGraph::Configuration.username,
    password: GitGraph::Configuration.password
  )

  @stored_users = {
    GitGraph::Configuration.username =>
    @client.user
  }

  @data_to_graph = {}
end

Public Instance Methods

+(user)
Alias for: add_user
-(user)
Alias for: remove_user
<<(user)
Alias for: add_user
[](key)
Alias for: get_user
add_user(user) click to toggle source
# File lib/gitGraph/github/client.rb, line 32
def add_user(user)
  user_to_add = @client.user(user)
  @stored_users[user_to_add.login] = user_to_add
end
Also aliased as: <<, +
change_chart_type(graphable_object_name, chart_type) click to toggle source
# File lib/gitGraph/github/client.rb, line 49
def change_chart_type(graphable_object_name, chart_type)
  @data_to_graph[graphable_object_name].chart_type = chart_type
end
compare_languages(chart, **options) click to toggle source
# File lib/gitGraph/github/client.rb, line 57
def compare_languages(chart, **options)
  options ||= {}
  title = options.delete(:title) || "Kilobytes Written per Language"
  data = GitGraph::GitHub::Feature.send(:compare_languages, self)
  graphable = GitGraph::GitHub::GraphableObject.new(data, chart, options, title)
  @data_to_graph[:languages] = graphable
end
each() { |name, user| ... } click to toggle source
# File lib/gitGraph/github/client.rb, line 53
def each
  @stored_users.each { |name, user| yield(name, user) }
end
get_user(key) click to toggle source
# File lib/gitGraph/github/client.rb, line 27
def get_user(key)
  @stored_users.fetch(key)
end
Also aliased as: []
remove_user(user) click to toggle source
# File lib/gitGraph/github/client.rb, line 39
def remove_user(user)
  @stored_users.delete(user)
end
Also aliased as: -
render(path) click to toggle source
# File lib/gitGraph/github/client.rb, line 65
def render(path)
  @data_to_graph.each { |key, data| GitGraph::Renderer.render(data, key, path) }
  GitGraph::Renderer.copy_files(path)
end
user_count() click to toggle source
# File lib/gitGraph/github/client.rb, line 44
def user_count
  @stored_users.count
end
Also aliased as: user_size
user_size()
Alias for: user_count