Follow a user
github = Github.new oauth_token: '...' github.users.followers.follow 'user-name' github.users.followers.follow user: 'user-name'
# File lib/github_api/users/followers.rb, line 80 def follow(*args) arguments(args, :required => [:user]) put_request("/user/following/#{user}", arguments.params) end
List who a user is following
github = Github.new github.users.followers.following 'user-name' github.users.followers.following 'user-name' { |user| ... }
List who the authenicated user is following
github = Github.new oauth_token: '...' github.users.followers.following
# File lib/github_api/users/followers.rb, line 46 def following(*args) params = arguments(args).params response = if user_name = arguments.remaining.first get_request("/users/#{user_name}/following", params) else get_request("/user/following", params) end return response unless block_given? response.each { |el| yield el } end
Check if you are following a user
github = Github.new oauth_token: '...' github.users.followers.following? 'user-name' github.users.followers.following? user: 'user-name'
# File lib/github_api/users/followers.rb, line 65 def following?(*args) arguments(args, :required => [:user]) get_request("/user/following/#{user}", arguments.params) true rescue Github::Error::NotFound false end
List a user's followers
github = Github.new github.users.followers.list 'user-name' github.users.followers.list 'user-name' { |user| ... }
List the authenticated user's followers
github = Github.new oauth_token: '...' github.users.followers github.users.followers { |user| ... }
# File lib/github_api/users/followers.rb, line 19 def list(*args) params = arguments(args).params response = if user_name = arguments.remaining.first get_request("/users/#{user_name}/followers", params) else get_request("/user/followers", params) end return response unless block_given? response.each { |el| yield el } end
Unfollow a user
github = Github.new oauth_token: '...' github.users.followers.unfollow 'user-name' github.users.followers.unfollow user: 'user-name'
# File lib/github_api/users/followers.rb, line 92 def unfollow(*args) arguments(args, :required => [:user]) delete_request("/user/following/#{user}", arguments.params) end