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 (also: #follow)
- #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 (also: #unfollow)
- #update_user(values, options = {}) ⇒ Object
- #user(username = nil, options = {}) ⇒ Object
- #watched(user = login, options = {}) ⇒ Object
Instance Method Details
#add_email(email, options = {}) ⇒ Object
68 69 70 |
# File 'lib/octokit/client/users.rb', line 68 def add_email(email, ={}) post("user/email/add", .merge({:email => email}))['emails'] end |
#add_key(title, key, options = {}) ⇒ Object
56 57 58 |
# File 'lib/octokit/client/users.rb', line 56 def add_key(title, key, ={}) post("user/key/add", .merge({:title => title, :key => key}))['public_keys'] end |
#emails(options = {}) ⇒ Object
64 65 66 |
# File 'lib/octokit/client/users.rb', line 64 def emails(={}) get("user/emails", )['emails'] end |
#follow!(user, options = {}) ⇒ Object Also known as: follow
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
52 53 54 |
# File 'lib/octokit/client/users.rb', line 52 def keys(={}) get("user/keys", )['public_keys'] end |
#remove_email(email, options = {}) ⇒ Object
72 73 74 |
# File 'lib/octokit/client/users.rb', line 72 def remove_email(email, ={}) post("user/email/remove", .merge({:email => email}))['emails'] end |
#remove_key(id, options = {}) ⇒ Object
60 61 62 |
# File 'lib/octokit/client/users.rb', line 60 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 Also known as: unfollow
43 44 45 |
# File 'lib/octokit/client/users.rb', line 43 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
48 49 50 |
# File 'lib/octokit/client/users.rb', line 48 def watched(user=login, ={}) get("repos/watched/#{user}", )['repositories'] end |