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

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.



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