Class: Gitwrap::User

Inherits:
GithubConnection show all
Defined in:
lib/gitwrap/users.rb

Constant Summary

Constants inherited from GithubConnection

GithubConnection::BASE_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ User



6
7
8
9
10
11
# File 'lib/gitwrap/users.rb', line 6

def initialize(hash)
	@name = hash['name']
	@location = hash['location']
	@email = hash['email']
	@username = hash['login']
end

Instance Attribute Details

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/gitwrap/users.rb', line 3

def email
  @email
end

#locationObject

Returns the value of attribute location.



3
4
5
# File 'lib/gitwrap/users.rb', line 3

def location
  @location
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/gitwrap/users.rb', line 3

def name
  @name
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/gitwrap/users.rb', line 3

def username
  @username
end

Class Method Details

.fetch_all_usersObject



17
18
19
20
21
# File 'lib/gitwrap/users.rb', line 17

def self.fetch_all_users
	$all_users = User.new({}).create_many_users("#{BASE_URL}users?since=#{$current_id}")
	$current_id += $all_users.length-1
	$all_users
end

.fetch_single_user(username) ⇒ Object



13
14
15
# File 'lib/gitwrap/users.rb', line 13

def self.fetch_single_user(username)
	user = User.new({}).create_user("#{BASE_URL}users/#{username}")
end