Module: Lapse::Client::Users
- Included in:
- Lapse::Client
- Defined in:
- lib/lapse/client/users.rb
Overview
Client methods for working with users
Instance Method Summary collapse
-
#authenticate(twitter_access_token) ⇒ Hashie::Mash
Authenticates a user.
- #follow(user_id) ⇒ Object
-
#me ⇒ Hashie::Mash
Get the current user.
- #unfollow(user_id) ⇒ Object
- #user(user_id) ⇒ Object
Instance Method Details
#authenticate(twitter_access_token) ⇒ Hashie::Mash
Authenticates a user
Requires authenticatied client.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lapse/client/users.rb', line 13 def authenticate(twitter_access_token) result = post('authenticate', twitter_access_token: twitter_access_token) hash = { :user => result.body, :access_token => result.headers['x-access-token'] } case @result_format when :mashie Hashie::Mash.new(hash) else hash end end |
#follow(user_id) ⇒ Object
44 45 46 |
# File 'lib/lapse/client/users.rb', line 44 def follow(user_id) boolean_from_response(:post, "users/#{user_id}/follow") end |
#me ⇒ Hashie::Mash
Get the current user
Requires authenticatied client.
36 37 38 |
# File 'lib/lapse/client/users.rb', line 36 def me get('me').body end |
#unfollow(user_id) ⇒ Object
48 49 50 |
# File 'lib/lapse/client/users.rb', line 48 def unfollow(user_id) boolean_from_response(:post, "users/#{user_id}/unfollow") end |
#user(user_id) ⇒ Object
40 41 42 |
# File 'lib/lapse/client/users.rb', line 40 def user(user_id) get("users/#{user_id}").body end |