Module: Totter::Client::Users
- Included in:
- Totter::Client
- Defined in:
- lib/totter/client/users.rb
Overview
Client methods for working with users
Instance Method Summary collapse
-
#follow(user) ⇒ Boolean
Follow a user.
-
#followers(user_id) ⇒ Object
Array of [Hashie::Mash].
-
#following(user_id) ⇒ Object
Array of [Hashie::Mash].
-
#me ⇒ Hashie::Mash
Get the current user.
-
#unfollow(user) ⇒ Boolean
Unfollow a user.
-
#update_me(options = {}, preferences = {}) ⇒ Object
Updates the authenticating user.
-
#user(user) ⇒ Hashie::Mash
Get a single user.
-
#votes(user_id) ⇒ Object
Array of [Hashie::Mash].
Instance Method Details
#follow(user) ⇒ Boolean
Follow a user.
Requires authenticatied client.
58 59 60 |
# File 'lib/totter/client/users.rb', line 58 def follow(user) boolean_from_response(:post, "users/#{user}/follow") end |
#followers(user_id) ⇒ Object
Returns Array of [Hashie::Mash].
79 80 81 |
# File 'lib/totter/client/users.rb', line 79 def followers(user_id) get("users/#{user_id}/followers").body end |
#following(user_id) ⇒ Object
Returns Array of [Hashie::Mash].
87 88 89 |
# File 'lib/totter/client/users.rb', line 87 def following(user_id) get("users/#{user_id}/following").body end |
#me ⇒ Hashie::Mash
Get the current user
Requires authenticatied client.
13 14 15 |
# File 'lib/totter/client/users.rb', line 13 def me get('me').body end |
#unfollow(user) ⇒ Boolean
Unfollow a user.
Requires authenticatied client.
71 72 73 |
# File 'lib/totter/client/users.rb', line 71 def unfollow(user) boolean_from_response(:post, "users/#{user}/unfollow") end |
#update_me(options = {}, preferences = {}) ⇒ Object
Updates the authenticating user
42 43 44 45 46 47 |
# File 'lib/totter/client/users.rb', line 42 def update_me( = {}, preferences = {}) data = { :user => .merge({:preferences => preferences}) } put("me", data).body end |
#user(user) ⇒ Hashie::Mash
Get a single user
23 24 25 |
# File 'lib/totter/client/users.rb', line 23 def user(user) get("users/#{user}").body end |
#votes(user_id) ⇒ Object
Returns Array of [Hashie::Mash].
95 96 97 |
# File 'lib/totter/client/users.rb', line 95 def votes(user_id) get("users/#{user_id}/votes").body end |