module Totter class Client # Client methods for working with users module Users # Get the current user # # Requires authenticatied client. # # @return [Hashie::Mash] # @see Totter::Client # @example # client.me def me get 'me' end # Get a single user # # @param user [String] A Seeaw username or ID. # @return [Hashie::Mash] # @example # Seesaw.user('soffes') def user(user) get "users/#{user}" end # Updates a given user # # @param user_id [Numeric] A Seesaw user ID. # @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 def update_me(options = {}, preferences = {}) data = { user: options.merge({preferences: preferences}) } put "me", data end # 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') def follow(user) boolean_from_response :post, "users/#{user}/follow" end # 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') def unfollow(user) boolean_from_response :post, "users/#{user}/unfollow" end end end end