Class: UsersFollowers

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(github) ⇒ UsersFollowers

Returns a new instance of UsersFollowers.



4
5
6
# File 'lib/github/users/users_followers.rb', line 4

def initialize(github)
  @github = github
end

Instance Attribute Details

#githubObject

Returns the value of attribute github.



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

def github
  @github
end

Instance Method Details

#checkIfFollowing(user) ⇒ Object



20
21
22
# File 'lib/github/users/users_followers.rb', line 20

def checkIfFollowing(user)
  @github.get('user/following/%s' % user)
end

#followUser(user) ⇒ Object



24
25
26
# File 'lib/github/users/users_followers.rb', line 24

def followUser(user)
  @github.put('user/following/%s' % user)
end

#listFollowers(user = nil) ⇒ Object



8
9
10
11
12
# File 'lib/github/users/users_followers.rb', line 8

def listFollowers(user=nil)
  url = (user != nil and user != @github.username) ?
      'users/%s/followers' % user : 'user/followers'
  @github.get(url)
end

#listFollowing(user = nil) ⇒ Object



14
15
16
17
18
# File 'lib/github/users/users_followers.rb', line 14

def listFollowing(user=nil)
  url = (user != nil and user != @github.username) ?
      'users/%s/following' % user : 'user/following'
  @github.get(url)
end

#unfollowUser(user) ⇒ Object



28
29
30
# File 'lib/github/users/users_followers.rb', line 28

def unfollowUser(user)
  @github.delete('user/following/%s' % user)
end