module Totter::Client::Comments

Client methods for working with avatars.

Public Instance Methods

comments(user_id, decision_id) click to toggle source

Gets comments for a given decision

@param user_id [Numeric] The decision's user id @param decision_id [Numeric] The decision's id @return [Array] @example

Totter.comments(1, 1)
# File lib/totter/client/comments.rb, line 12
def comments(user_id, decision_id)
  get("users/#{user_id}/decisions/#{decision_id}/comments").body
end
create_comment(user_id, decision_id, message) click to toggle source

Creates a new comment

@param user_id [Numeric] The decision's user id @param decision_id [Numeric] The decision's id @param message [String] The comment body @return [Hashie::Mash] @example

Totter.create_comment(1, 1, 'I love boots!')
# File lib/totter/client/comments.rb, line 24
def create_comment(user_id, decision_id, message)
  options = {
    :comment => {
      :message => message
    }
  }
  post("users/#{user_id}/decisions/#{decision_id}/comments", options).body
end
destroy_comment(user_id, decision_id, comment_id) click to toggle source

Destroys a comment

@param user_id [Numeric] The decision's user id @param decision_id [Numeric] The decision's id @param comment_id [Numeric] The comment id @return [Boolean] @example

Totter.destroy_comment(1, 1, 15)
# File lib/totter/client/comments.rb, line 41
def destroy_comment(user_id, decision_id, comment_id)
  boolean_from_response(:delete, "users/#{user_id}/decisions/#{decision_id}/comments/#{comment_id}")
end