Sha256: 8b7e6609257cece699b375802fb13c15cea6eb13e3dca2501a8e3201187ba357

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# -*- encoding : utf-8 -*-
module Douban
  class Client
    # 回复Api V2 
    # @see http://developers.douban.com/wiki/?title=comment_v2
    module Comment
      private 
      # 获取回复列表
      # @see http://developers.douban.com/wiki/?title=comment_v2#list
      def comments(target, id, options={})
        response = get("v2/#{target}/#{id}/comments", options)
        response["comments"]
      end

      # 新发讨论
      # @see http://developers.douban.com/wiki/?title=comment_v2#new
      def create_comment(target, id, content)
        post "v2/#{target}/#{id}/comments", {:content => content}
      end

      # 获取单条回复
      # @see http://developers.douban.com/wiki/?title=comment_v2#get
      def comment(target, target_id, comment_id)
        get "v2/#{target}/#{target_id}/comment/#{comment_id}"
      end
      
      # 删除回复
      # @see http://developers.douban.com/wiki/?title=comment_v2#delete
      def remove_comment(target, target_id, comment_id)
        delete("v2/#{target}/#{target_id}/comment/#{comment_id}")[:status] == 200
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
douban_api-0.1.6 lib/douban_api/client/comment.rb
douban_api-0.1.5 lib/douban_api/client/comment.rb
douban_api-0.1.4 lib/douban_api/client/comment.rb
douban_api-0.1.3 lib/douban_api/client/comment.rb