Class: Renren2::Interface::Share

Inherits:
Base
  • Object
show all
Defined in:
lib/renren2/interface/share.rb

Overview

Share Interface

Instance Method Summary collapse

Methods inherited from Base

#check_scope, #get, #initialize, #post, #request

Constructor Details

This class inherits a constructor from Renren2::Interface::Base

Instance Method Details

#add_comment(share_id, user_id, content, opts = {}) ⇒ Object

Note:

require “publish_comment、publish_share” scope

对某个分享进行评论

Parameters:

  • share_id (int)

    被回复分享的ID

  • user_id (int)

    被回复分享所有者的用户ID

  • content (String)

    回复的内容

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :to_user_id (int)

    被回复用户的ID

See Also:



49
50
51
52
53
# File 'lib/renren2/interface/share.rb', line 49

def add_comment(share_id, user_id, content, opts={})
  check_scope "publish_comment"
  check_scope "publish_share"
  post 'share.addComment', :body => {:share_id => share_id, :user_id => user_id, :content => content}.merge(opts)
end

#get_comments(user_id, share_id) ⇒ Object

Note:

require “read_user_share、read_user_comment” scope

获取某个分享的评论

Parameters:

  • user_id (int)

    分享所有者的ID

  • share_id (int)

    所要取得评论的分享的ID

See Also:



33
34
35
36
37
# File 'lib/renren2/interface/share.rb', line 33

def get_comments(user_id, share_id)
  check_scope "read_user_share"
  check_scope "read_user_comment"
  post 'share.getComments', :body => {:user_id => user_id, :share_id => share_id}
end

#share(type, opts = {}) ⇒ Object

Note:

require “publish_share” scope

发布分享,例如分享视频、音乐、链接、日志、相册、照片等

Parameters:

  • type (int)

    分享的类型:日志为1、照片为2、链接为6、相册为8、视频为10、音频为11、分享为20

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :ugc_id (int)

    分享人人网站内内容的ID。如日志、照片、相册、分享的ID

  • :user_id (int)

    分享人人网站内内容所有者的ID。如日志、照片、相册、分享所有者的用户ID

  • :url (String)

    分享人人网站外内容的URL

  • :comment (String)

    分享内容时,用户的评论内容

See Also:



21
22
23
24
# File 'lib/renren2/interface/share.rb', line 21

def share(type, opts={})
  check_scope "publish_share"
  post 'share.share', :body => {:type => type}.merge(opts)
end