Module: Octokit::Client::Users
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/users.rb
Constant Summary collapse
- EMAIL_RE =
/[\w.!#\$%+-]+@[\w-]+(?:\.[\w-]+)+/
Instance Method Summary collapse
- #add_email(email, options = {}) ⇒ Object
- #add_key(title, key, options = {}) ⇒ Object
- #emails(options = {}) ⇒ Object
- #follow(user, options = {}) ⇒ Object
- #followers(user = login, options = {}) ⇒ Object
- #following(user = login, options = {}) ⇒ Object
- #follows?(*args) ⇒ Boolean
- #keys(options = {}) ⇒ Object
- #remove_email(email, options = {}) ⇒ Object
- #remove_key(id, options = {}) ⇒ Object
- #search_users(search, options = {}) ⇒ Object
- #unfollow(user, options = {}) ⇒ Object
- #update_user(values, options = {}) ⇒ Object
- #user(username = nil, options = {}) ⇒ Object
- #watched(user = login, options = {}) ⇒ Object
Instance Method Details
#add_email(email, options = {}) ⇒ Object
66 67 68 |
# File 'lib/octokit/client/users.rb', line 66 def add_email(email, ={}) post("user/email/add", .merge({:email => email}))['emails'] end |
#add_key(title, key, options = {}) ⇒ Object
54 55 56 |
# File 'lib/octokit/client/users.rb', line 54 def add_key(title, key, ={}) post("user/key/add", .merge({:title => title, :key => key}))['public_keys'] end |
#emails(options = {}) ⇒ Object
62 63 64 |
# File 'lib/octokit/client/users.rb', line 62 def emails(={}) get("user/emails", )['emails'] end |
#follow(user, options = {}) ⇒ Object
38 39 40 |
# File 'lib/octokit/client/users.rb', line 38 def follow(user, ={}) post("user/follow/#{user}", )['users'] end |
#followers(user = login, options = {}) ⇒ Object
22 23 24 |
# File 'lib/octokit/client/users.rb', line 22 def followers(user=login, ={}) get("user/show/#{user}/followers", )['users'] end |
#following(user = login, options = {}) ⇒ Object
26 27 28 |
# File 'lib/octokit/client/users.rb', line 26 def following(user=login, ={}) get("user/show/#{user}/following", )['users'] end |
#follows?(*args) ⇒ Boolean
30 31 32 33 34 35 36 |
# File 'lib/octokit/client/users.rb', line 30 def follows?(*args) target = args.pop user = args.first user ||= login return if user.nil? following(user).include?(target) end |
#keys(options = {}) ⇒ Object
50 51 52 |
# File 'lib/octokit/client/users.rb', line 50 def keys(={}) get("user/keys", )['public_keys'] end |
#remove_email(email, options = {}) ⇒ Object
70 71 72 |
# File 'lib/octokit/client/users.rb', line 70 def remove_email(email, ={}) post("user/email/remove", .merge({:email => email}))['emails'] end |
#remove_key(id, options = {}) ⇒ Object
58 59 60 |
# File 'lib/octokit/client/users.rb', line 58 def remove_key(id, ={}) post("user/key/remove", .merge({:id => id}))['public_keys'] end |
#search_users(search, options = {}) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/octokit/client/users.rb', line 6 def search_users(search, ={}) if search.match(EMAIL_RE) get("user/email/#{search}", )['user'] else get("user/search/#{search}", )['users'] end end |
#unfollow(user, options = {}) ⇒ Object
42 43 44 |
# File 'lib/octokit/client/users.rb', line 42 def unfollow(user, ={}) post("user/unfollow/#{user}", )['users'] end |
#update_user(values, options = {}) ⇒ Object
18 19 20 |
# File 'lib/octokit/client/users.rb', line 18 def update_user(values, ={}) post("user/show/#{login}", .merge({:values => values}))['user'] end |
#user(username = nil, options = {}) ⇒ Object
14 15 16 |
# File 'lib/octokit/client/users.rb', line 14 def user(username=nil, ={}) get(["user/show", username].compact.join('/'), )['user'] end |
#watched(user = login, options = {}) ⇒ Object
46 47 48 |
# File 'lib/octokit/client/users.rb', line 46 def watched(user=login, ={}) get("repos/watched/#{user}", )['repositories'] end |