Sha256: ffd37cf316f6ba5d8f85ec37fee892753596c02469324bb530bb3739e9881f0c
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module StackExchange module StackOverflow class Comment < Base setup_delegators :@struct, :comment_id, :creation_date, :owner, :post_id, :post_type, :score, :body class << self def find(id, options = {}) request('/comments/:id/', id, options) end def find_by_question_id(id, options = {}) request('/questions/:id/comments', id, options) end 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 def find_by_mentioned_user_id(id, options = {}) request('/users/:id/mentioned', id, options) end 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 end def id @struct.comment_id end def mentioned_user @struct.reply_to_user end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pilha-0.2.2 | lib/pilha/stack_overflow/comment.rb |