Module: Snoo::User
- Defined in:
- lib/snoo/users.rb
Overview
Methods for interacting with users, such as adding and removing friends, getting user info, etc
Instance Method Summary collapse
-
#friend(name, friend_id, note = nil) ⇒ Object
Friend a user.
-
#get_friends ⇒ Object
Get a list of friends.
-
#get_user_info(username) ⇒ Object
Get info about a user account.
-
#get_user_listing(username, opts = {}) ⇒ Object
Get a listing of user posts.
-
#unfriend(id) ⇒ Object
Unfriend a user.
Instance Method Details
#friend(name, friend_id, note = nil) ⇒ Object
Friend a user
12 13 14 |
# File 'lib/snoo/users.rb', line 12 def friend name, friend_id, note = nil friend_wrapper(api_name = name, api_container = @userid, api_note = note, api_type = "friend") end |
#get_friends ⇒ Object
Get a list of friends
27 28 29 30 |
# File 'lib/snoo/users.rb', line 27 def get_friends logged_in? get('/prefs/friends.json') end |
#get_user_info(username) ⇒ Object
Get info about a user account
35 36 37 |
# File 'lib/snoo/users.rb', line 35 def get_user_info username get("/user/#{username}/about.json") end |
#get_user_listing(username, opts = {}) ⇒ Object
Get a listing of user posts. Some options may be restricted
49 50 51 52 53 54 55 |
# File 'lib/snoo/users.rb', line 49 def get_user_listing username, opts = {} opts[:type] = 'overview' if opts[:type].nil? url = "/user/%s%s.json" % [username, ('/' + opts[:type] if opts[:type] != 'overview')] opts.delete :type query = opts get(url, query: query) end |
#unfriend(id) ⇒ Object
Unfriend a user
20 21 22 |
# File 'lib/snoo/users.rb', line 20 def unfriend id unfriend_wrapper api_id = id, api_container = @userid, api_type = "friend" end |