Class: Users

Inherits:
Object
  • Object
show all
Defined in:
lib/github/users/users.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#emailsObject

Returns the value of attribute emails.



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

def emails
  @emails
end

#followersObject

Returns the value of attribute followers.



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

def followers
  @followers
end

#githubObject

Returns the value of attribute github.



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

def github
  @github
end

#keysObject

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