Class: Weibo2::Interface::Friendships

Inherits:
Base
  • Object
show all
Defined in:
lib/weibo2/interface/friendships.rb

Overview

Friendships API

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #post, #request

Constructor Details

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

Instance Method Details

#create(opts = {}) ⇒ Object

no test below 关注一个用户

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要关注的用户ID

  • :screen_name (String)

    需要关注的用户昵称

See Also:



157
158
159
# File 'lib/weibo2/interface/friendships.rb', line 157

def create(opts={})
  post 'friendships/create.json', :body => opts
end

#create_batch(uids) ⇒ Object

根据用户UID批量关注用户 [Privilege]

Parameters:

  • uids (String)

    要关注的用户UID,用半角逗号分隔,最多不超过20个

See Also:



166
167
168
# File 'lib/weibo2/interface/friendships.rb', line 166

def create_batch(uids)
  post 'friendships/create_batch.json', :body => {:uids => uids}
end

#destroy(opts = {}) ⇒ Object

取消关注一个用户

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要取消关注的用户ID

  • :screen_name (String)

    需要取消关注的用户昵称

See Also:



177
178
179
# File 'lib/weibo2/interface/friendships.rb', line 177

def destroy(opts={})
  post 'friendships/destroy.json', :body => opts
end

#followers(opts = {}) ⇒ Object

获取用户的粉丝列表

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要查询的用户UID

  • :screen_name (String)

    需要查询的用户昵称

  • :count (int)

    单页返回的记录条数,默认为50,最大不超过200

  • :cursor (int)

    返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0

See Also:



93
94
95
# File 'lib/weibo2/interface/friendships.rb', line 93

def followers(opts={})
  get 'friendships/followers.json', :params => opts
end

#followers_active(uid, opts = {}) ⇒ Object

获取用户的活跃粉丝列表

Parameters:

  • uid (int64)

    需要查询的用户UID

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

Options Hash (opts):

  • :count (int)

    返回的记录条数,默认为20,最大不超过200

See Also:



116
117
118
# File 'lib/weibo2/interface/friendships.rb', line 116

def followers_active(uid, opts={})
  get 'friendships/followers/active.json', :params => {:uid => uid}.merge(opts)
end

#followers_ids(opts = {}) ⇒ Object

获取用户粉丝的用户UID列表

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要查询的用户UID

  • :screen_name (String)

    需要查询的用户昵称

  • :count (int)

    单页返回的记录条数,默认为500,最大不超过5000

  • :cursor (int)

    返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0

See Also:



106
107
108
# File 'lib/weibo2/interface/friendships.rb', line 106

def followers_ids(opts={})
  get 'friendships/followers/ids.json', :params => opts
end

#friends(opts = {}) ⇒ Object

获取用户的关注列表

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要查询的用户UID

  • :screen_name (String)

    需要查询的用户昵称

  • :count (int)

    单页返回的记录条数,默认为50,最大不超过200

  • :cursor (int)

    返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0

See Also:



19
20
21
# File 'lib/weibo2/interface/friendships.rb', line 19

def friends(opts={})
  get 'friendships/friends.json', :params => opts
end

#friends_bilateral(uid, opts = {}) ⇒ Object

获取用户的双向关注列表,即互粉列表

Parameters:

  • uid (int64)

    需要获取双向关注列表的用户UID

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

Options Hash (opts):

  • :count (int)

    单页返回的记录条数,默认为50

  • :page (int)

    返回结果的页码,默认为1

  • :sort (int)

    排序类型,0:按关注时间最近排序,默认为0

See Also:



45
46
47
# File 'lib/weibo2/interface/friendships.rb', line 45

def friends_bilateral(uid, opts={})
  get 'friendships/friends/bilateral.json', :params => {:uid => uid}.merge(opts)
end

#friends_bilateral_ids(uid, opts = {}) ⇒ Object

获取用户双向关注的用户ID列表,即互粉UID列表

Parameters:

  • uid (int64)

    需要获取双向关注列表的用户UID

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

Options Hash (opts):

  • :count (int)

    单页返回的记录条数,默认为50,最大不超过2000

  • :page (int)

    返回结果的页码,默认为1

  • :sort (int)

    排序类型,0:按关注时间最近排序,默认为0

See Also:



58
59
60
# File 'lib/weibo2/interface/friendships.rb', line 58

def friends_bilateral_ids(uid, opts={})
  get 'friendships/friends/bilateral/ids.json', :params => {:uid => uid}.merge(opts)
end

#friends_chain_followers(uid, opts = {}) ⇒ Object

获取当前登录用户的关注人中又关注了指定用户的用户列表

Parameters:

  • uid (int64)

    指定的关注目标用户UID

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

Options Hash (opts):

  • :count (int)

    单页返回的记录条数,默认为50

  • :page (int)

    返回结果的页码,默认为1

See Also:



128
129
130
# File 'lib/weibo2/interface/friendships.rb', line 128

def friends_chain_followers(uid, opts={})
  get 'friendships/friends_chain/followers.json', :params => {:uid => uid}.merge(opts)
end

#friends_ids(opts = {}) ⇒ Object

获取用户关注的用户UID列表

Parameters:

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

Options Hash (opts):

  • :uid (int64)

    需要查询的用户UID

  • :screen_name (String)

    需要查询的用户昵称

  • :count (int)

    单页返回的记录条数,默认为500,最大不超过5000

  • :cursor (int)

    返回结果的游标,下一页用返回值里的next_cursor,上一页用previous_cursor,默认为0

See Also:



71
72
73
# File 'lib/weibo2/interface/friendships.rb', line 71

def friends_ids(opts={})
  get 'friendships/friends/ids.json', :params => opts
end

#friends_in_common(uid, opts = {}) ⇒ Object

获取两个用户之间的共同关注人列表

Parameters:

  • uid (int64)

    需要获取共同关注关系的用户UID

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

Options Hash (opts):

  • :suid (int64)

    需要获取共同关注关系的用户UID,默认为当前登录用户

  • :count (int)

    单页返回的记录条数,默认为50

  • :page (int)

    返回结果的页码,默认为1

See Also:



32
33
34
# File 'lib/weibo2/interface/friendships.rb', line 32

def friends_in_common(uid, opts={})
  get 'friendships/friends/in_common.json', :params => {:uid => uid}.merge(opts)
end

#friends_remark_batch(uids) ⇒ Object

批量获取当前登录用户的关注人的备注信息 [Privilege]

Parameters:

  • uids (String)

    需要获取备注的用户UID,用半角逗号分隔,最多不超过50个

See Also:



80
81
82
# File 'lib/weibo2/interface/friendships.rb', line 80

def friends_remark_batch(uids)
  get 'friendships/friends/remark_batch.json', :params => {:uids => uids}
end

#remark_update(uid, remark) ⇒ Object

更新当前登录用户所关注的某个好友的备注信息 [Privilege]

Parameters:

  • uid (int64)

    需要修改备注信息的用户UID

  • remark (String)

    备注信息

See Also:



187
188
189
# File 'lib/weibo2/interface/friendships.rb', line 187

def remark_update(uid, remark)
  post 'friendships/remark/update.json', :body => {:uid => uid, :remark => remark}
end

#show(opts = {}) ⇒ Object

获取两个用户之间的详细关注关系情况

Parameters:

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

Options Hash (opts):

  • :source_id (int64)

    源用户的UID

  • :source_screen_name (String)

    源用户的微博昵称

  • :target_id (int64)

    目标用户的UID

  • :target_screen_name (String)

    目标用户的微博昵称

See Also:



141
142
143
# File 'lib/weibo2/interface/friendships.rb', line 141

def show(opts={})
  get 'friendships/show.json', :params => opts
end