Module: Ronnie::Client::Users
- Included in:
- Ronnie::Client
- Defined in:
- lib/ronnie/client/users.rb
Instance Method Summary collapse
-
#find_user(email, options = {}) ⇒ Object
Find User by E-mail Address.
-
#follow(user_id, options = {}) ⇒ Object
Follow a User.
-
#followers(user_id = nil, options = {}) ⇒ Object
Retrieve Followers of a User.
-
#following(user_id = nil, options = {}) ⇒ Object
Retrieve Users Following Another User.
-
#follows?(user_id, options = {}) ⇒ Boolean
Authorized User is Following a User.
-
#search_users(query, options = {}) ⇒ Object
Search Users.
-
#unfollow(user_id, options = {}) ⇒ Object
Unfollow a User.
-
#user(user_id = nil, options = {}) ⇒ Object
Retrieve User.
Instance Method Details
#find_user(email, options = {}) ⇒ Object
Find User by E-mail Address
20 21 22 |
# File 'lib/ronnie/client/users.rb', line 20 def find_user(email, ={}) post('findUser', { email: email }) end |
#follow(user_id, options = {}) ⇒ Object
Follow a User
Requires authorized client.
77 78 79 |
# File 'lib/ronnie/client/users.rb', line 77 def follow(user_id, ={}) post('addFriend', { user: user_id }) end |
#followers(user_id = nil, options = {}) ⇒ Object
Retrieve Followers of a User
40 41 42 43 44 |
# File 'lib/ronnie/client/users.rb', line 40 def followers(user_id=nil, ={}) user_id = user_id ? user_id : user[:key] post('userFollowers', { user: user_id }) end |
#following(user_id = nil, options = {}) ⇒ Object
Retrieve Users Following Another User
53 54 55 56 57 |
# File 'lib/ronnie/client/users.rb', line 53 def following(user_id=nil, ={}) user_id = user_id ? user_id : user[:key] post('userFollowing', { user: user_id }) end |
#follows?(user_id, options = {}) ⇒ Boolean
Authorized User is Following a User
Requires authorized client.
66 67 68 |
# File 'lib/ronnie/client/users.rb', line 66 def follows?(user_id, ={}) !following.select { |f| f[:key] == user_id }.empty? ? true : false end |
#search_users(query, options = {}) ⇒ Object
Search Users
29 30 31 |
# File 'lib/ronnie/client/users.rb', line 29 def search_users(query, ={}) post('search', { query: query, types: 'User' }) end |
#unfollow(user_id, options = {}) ⇒ Object
Unfollow a User
Requires authorized client.
88 89 90 |
# File 'lib/ronnie/client/users.rb', line 88 def unfollow(user_id, ={}) post('removeFriend', { user: user_id }) end |
#user(user_id = nil, options = {}) ⇒ Object
Retrieve User
11 12 13 |
# File 'lib/ronnie/client/users.rb', line 11 def user(user_id=nil, ={}) user_id ? post('get', { keys: user_id }) : post('currentUser') end |