module Totter::Client::Users

Client methods for working with users

Public Instance Methods

follow(user) click to toggle source

Follow a user.

Requires authenticatied client.

@param user [String] Username or ID of the user to follow. @return [Boolean] True if follow was successful, false otherwise. @see Totter::Client @example

client.follow('gotwalt')
# File lib/totter/client/users.rb, line 58
def follow(user)
  boolean_from_response(:post, "users/#{user}/follow")
end
followers(user_id) click to toggle source

@return Array of [Hashie::Mash] @param user_id [String] ID of the user @example

client.followers('5')
# File lib/totter/client/users.rb, line 79
def followers(user_id)
  get("users/#{user_id}/followers").body
end
following(user_id) click to toggle source

@return Array of [Hashie::Mash] @param user_id [String] ID of the user @example

client.following('5')
# File lib/totter/client/users.rb, line 87
def following(user_id)
  get("users/#{user_id}/following").body
end
me() click to toggle source

Get the current user

Requires authenticatied client.

@return [Hashie::Mash] @see Totter::Client @example

client.me
# File lib/totter/client/users.rb, line 13
def me
  get('me').body
end
unfollow(user) click to toggle source

Unfollow a user.

Requires authenticatied client.

@param user [String] Username or ID of the user to unfollow. @return [Boolean] True if unfollow was successful, false otherwise. @see Totter::Client @example

client.unfollow('kyle')
# File lib/totter/client/users.rb, line 71
def unfollow(user)
  boolean_from_response(:post, "users/#{user}/unfollow")
end
update_me(options = {}, preferences = {}) click to toggle source

Updates the authenticating user

@param options [Hash] Properties to be updated @option options [String] :given_name The given name of the user @option options [String] :family_name The Family name of the user @option options [String] :email The email address of the user @option options [String] :username The username of the user @param preferences [Hash] Preferences to be set @option preferences [Boolean] :notification_friends Notify when friends post a decision @option preferences [Boolean] :notification_invitee_votes Notify when invitee votes @option preferences [Boolean] :notification_comments Notify when someone comments on user's decision @option preferences [Boolean] :notification_following_votes Notify when user is following other_user who votes @option preferences [Boolean] :notification_other_votes Notify using throttled notifier when non-invited users vote on your post @option preferences [Boolean] :notification_after_votes Notify when other_user votes after user has already voted on a decision @option preferences [Boolean] :notification_following Notify when other_user starts follwing user

# File lib/totter/client/users.rb, line 42
def update_me(options = {}, preferences = {})
  data = {
    :user => options.merge({:preferences => preferences})
  }
  put("me", data).body
end
user(user) click to toggle source

Get a single user

@param user [String] A Seeaw username or ID. @return [Hashie::Mash] @example

Totter.user('soffes')
# File lib/totter/client/users.rb, line 23
def user(user)
  get("users/#{user}").body
end
votes(user_id) click to toggle source

@return Array of [Hashie::Mash] @param user_id [String] ID of the user @example

client.user_votes('5')
# File lib/totter/client/users.rb, line 95
def votes(user_id)
  get("users/#{user_id}/votes").body
end