Class: Users
- Inherits:
-
Object
- Object
- Users
- Defined in:
- lib/github/users/users.rb
Instance Attribute Summary collapse
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#followers ⇒ Object
Returns the value of attribute followers.
-
#github ⇒ Object
Returns the value of attribute github.
-
#keys ⇒ Object
Returns the value of attribute keys.
Instance Method Summary collapse
- #getUser(user = nil) ⇒ Object
-
#initialize(github) ⇒ Users
constructor
A new instance of Users.
- #updateUser(name = nil, email = nil, blog = nil, company = nil, location = nil, hireable = FALSE, bio = nil) ⇒ Object
Constructor Details
#initialize(github) ⇒ Users
Returns a new instance of Users.
4 5 6 7 8 9 |
# File 'lib/github/users/users.rb', line 4 def initialize(github) @github = github @emails = UsersEmails.new(github) @followers = UsersFollowers.new(github) @keys = UsersKeys.new(github) end |
Instance Attribute Details
#emails ⇒ Object
Returns the value of attribute emails.
2 3 4 |
# File 'lib/github/users/users.rb', line 2 def emails @emails end |
#followers ⇒ Object
Returns the value of attribute followers.
2 3 4 |
# File 'lib/github/users/users.rb', line 2 def followers @followers end |
#github ⇒ Object
Returns the value of attribute github.
2 3 4 |
# File 'lib/github/users/users.rb', line 2 def github @github end |
#keys ⇒ Object
Returns the value of attribute keys.
2 3 4 |
# File 'lib/github/users/users.rb', line 2 def keys @keys end |
Instance Method Details
#getUser(user = nil) ⇒ Object
11 12 13 14 15 |
# File 'lib/github/users/users.rb', line 11 def getUser(user=nil) url = (user != nil and user != @github.username) ? 'users/%s' % user : 'user' @github.get(url) end |
#updateUser(name = nil, email = nil, blog = nil, company = nil, location = nil, hireable = FALSE, bio = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/github/users/users.rb', line 17 def updateUser(name=nil, email=nil, blog=nil, company=nil, location=nil, hireable=FALSE, bio=nil) params = { :name => name, :email => email, :blog => blog, :company => company, :location => location, :hireable => hireable, :bio => bio } params = @github.removeEmptyParams(params) data = params.to_json @github.patch('user', data) end |