Sha256: b961ec5285b83710411814743b6a670f965f55154693f233e11a485a034a9336
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
module StackExchange module StackOverflow class Question < Base setup_delegators :@struct, :question_id, :tags, :creation_date, :last_activity_date, :up_vote_count, :down_vote_count, :view_count, :score, :community_owned, :title, :body, :answers, :answer_count, :accepted_answer_id, :favorite_count, :question_timeline_url, :question_comments_url, :question_answers_url, :owner class << self def all(options = {}) request('/questions', nil, options) end def find(id, options = {}) request('/questions/:id/', id, options).questions.first end def find_by_user_id(id, options = {}) request('/users/:id/questions', id, options) end def find_favorites_by_user_id(id, options = {}) request('/users/:id/favorites', id, options) end def find_by_tags(*tags) options = tags.last.is_a?(Hash) ? tags.pop : {} options.merge!(:conditions => { :tagged => tags.join('+') }) request('/questions', nil, options) end def unanswered(options = {}) request('/questions/unanswered', nil, options) end def parse(response) response['questions'].each do |comment| parse_with_class(comment, 'owner', User) end parse_with_class(response, 'questions', Question) OpenStruct.new response end end def id @struct.question_id end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pilha-0.2.2 | lib/pilha/stack_overflow/question.rb |