Class: Gitwrap::User
- Inherits:
-
GithubConnection
- Object
- GithubConnection
- Gitwrap::User
- Defined in:
- lib/gitwrap/users.rb
Constant Summary
Constants inherited from GithubConnection
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(hash) ⇒ User
Returns a new instance of User.
7 8 9 10 11 12 |
# File 'lib/gitwrap/users.rb', line 7 def initialize(hash) @name = hash['name'] @location = hash['location'] @email = hash['email'] @username = hash['login'] end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
3 4 5 |
# File 'lib/gitwrap/users.rb', line 3 def email @email end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'lib/gitwrap/users.rb', line 3 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/gitwrap/users.rb', line 3 def name @name end |
#username ⇒ Object
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_users ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/gitwrap/users.rb', line 20 def self.fetch_all_users data = open("#{BASE_URL}users?since=#{$current_id}").read() data = JSON.parse(data) data.each {|user| $all_users << new(user)} $current_id += $all_users.length-1 $all_users end |
.fetch_single_user(username) ⇒ Object
14 15 16 17 18 |
# File 'lib/gitwrap/users.rb', line 14 def self.fetch_single_user(username) data = open("#{BASE_URL}users/#{username}").read() data = JSON.parse(data) user = new(data) end |