class StackExchange::StackOverflow::Comment

Public Class Methods

find(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 10
def find(id, options = {})
  request('/comments/:id/', id, options)
end
find_by_mentioned_user_id(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 26
def find_by_mentioned_user_id(id, options = {})
  request('/users/:id/mentioned', id, options) 
end
find_by_question_id(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 14
def find_by_question_id(id, options = {})
  request('/questions/:id/comments', id, options)
end
find_by_user_id(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 18
def find_by_user_id(id, options = {})
  if options[:to_user]
    request('/users/:id/comments/:to_user', id, options)
  else
    request('/users/:id/comments', id, options)
  end
end
parse(response) click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 30
def parse(response)
  response['comments'].each do |comment|
    parse_with_class(comment, 'owner', User)
    parse_with_class(comment, 'reply_to_user', User)
  end
  parse_with_class(response, 'comments', Comment)
  OpenStruct.new response
end

Public Instance Methods

id() click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 40
def id
  @struct.comment_id
end
mentioned_user() click to toggle source
# File lib/pilha/stack_overflow/comment.rb, line 44
def mentioned_user
  @struct.reply_to_user
end