Class: 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

Methods included from DataCreator

#create_many_orgs, #create_many_repos, #create_many_users, #create_org, #create_org_repos, #create_single_repo, #create_user, #create_user_repos, #parse_data

Constructor Details

#initialize(hash) ⇒ User

Returns a new instance of User.



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

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.



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

def email
  @email
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Class Method Details

.fetch_all_usersObject



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

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



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

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