Class: Octopolo::GitHub::User

Inherits:
Object
  • Object
show all
Defined in:
lib/octopolo/github/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login) ⇒ User

Public: Instantiate a new User

login - The login (username) of the given user



11
12
13
# File 'lib/octopolo/github/user.rb', line 11

def initialize 
  self. = 
end

Instance Attribute Details

#loginObject

Returns the value of attribute login.



6
7
8
# File 'lib/octopolo/github/user.rb', line 6

def 
  @login
end

Class Method Details

.user_data(login) ⇒ Object

Private: The raw GitHub API data for the given login

Returns a Hashie::Mash containing the data



35
36
37
# File 'lib/octopolo/github/user.rb', line 35

def self.user_data 
  @cache[] ||= GitHub.user 
end

Instance Method Details

#author_nameObject

Public: The real name of the author

If the user has a name in GitHub, #author_name returns this. Otherwise returns the given login.

Returns a String containing the name



21
22
23
# File 'lib/octopolo/github/user.rb', line 21

def author_name
  user_data.name || 
end

#user_dataObject

Private: The raw GitHub API data for the user

Returns a Hashie::Mash containing the data



28
29
30
# File 'lib/octopolo/github/user.rb', line 28

def user_data
  User.user_data 
end