class StackExchange::StackOverflow::Answer

Public Class Methods

find(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/answer.rb, line 11
def find(id, options = {})
  request('/answers/:id', id, options).answers.first
end
find_by_question_id(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/answer.rb, line 19
def find_by_question_id(id, options = {})
  request('/questions/:id/answers', id, options)
end
find_by_user_id(id, options = {}) click to toggle source
# File lib/pilha/stack_overflow/answer.rb, line 15
def find_by_user_id(id, options = {})
  request('/users/:id/answers', id, options)
end
parse(response) click to toggle source
# File lib/pilha/stack_overflow/answer.rb, line 23
def parse(response)
  response['answers'].each do |answer|
    parse_with_class(answer, 'comments', Comment)
    parse_with_class(answer, 'owner', User)
  end
  parse_with_class(response, 'answers', Answer)
  OpenStruct.new response
end

Public Instance Methods

id() click to toggle source
# File lib/pilha/stack_overflow/answer.rb, line 33
def id
  @struct.answer_id
end