Sha256: b7397e3a17e0040fbaf1604ba49895e4a41ea94c64e2da8b3ad642606e02d498
Contents?: true
Size: 1.25 KB
Versions: 5
Compression:
Stored size: 1.25 KB
Contents
module StackExchange module StackOverflow class Comment < Base extend Forwardable def_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
5 entries across 5 versions & 1 rubygems