Class: Weibo2::Interface::Favorites

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

Overview

Favorites 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

#by_tags(tid, opts = {}) ⇒ Object

根据标签获取当前登录用户该标签下的收藏列表

Parameters:

  • tid (int64)

    需要查询的标签ID

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

Options Hash (opts):

  • :count (int)

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

  • :page (int)

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

See Also:



38
39
40
# File 'lib/weibo2/interface/favorites.rb', line 38

def by_tags(tid, opts={})
  get 'favorites/by_tags.json', :params => {:tid => tid}.merge(opts)
end

#create(id) ⇒ Object

test no pass below 添加一条微博到收藏里

Parameters:

  • id (int64)

    要收藏的微博ID

See Also:



63
64
65
# File 'lib/weibo2/interface/favorites.rb', line 63

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

#destroy(id) ⇒ Object

取消收藏一条微博

Parameters:

  • id (int64)

    要取消收藏的微博ID

See Also:



72
73
74
# File 'lib/weibo2/interface/favorites.rb', line 72

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

#destroy_batch(ids) ⇒ Object

根据收藏ID批量取消收藏

Parameters:

  • ids (String)

    要取消收藏的收藏ID,用半角逗号分隔,最多不超过10个

See Also:



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

def destroy_batch(ids)
  post 'favorites/destroy_batch.json', :body => {:ids => ids}
end

#favorites(opts = {}) ⇒ Object

获取当前登录用户的收藏列表

Parameters:

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

Options Hash (opts):

  • :count (int)

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

  • :page (int)

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

See Also:



17
18
19
# File 'lib/weibo2/interface/favorites.rb', line 17

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

#show(id) ⇒ Object

根据收藏ID获取指定的收藏信息

Parameters:

  • id (int64)

    需要查询的收藏ID

See Also:



26
27
28
# File 'lib/weibo2/interface/favorites.rb', line 26

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

#tags(opts = {}) ⇒ Object

获取当前登录用户的收藏标签列表

Parameters:

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

Options Hash (opts):

  • :count (int)

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

  • :page (int)

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

See Also:



49
50
51
# File 'lib/weibo2/interface/favorites.rb', line 49

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

#tags_destroy_batch(tid) ⇒ Object

删除当前登录用户所有收藏下的指定标签

Parameters:

  • tid (int64)

    需要删除的标签ID

See Also:



109
110
111
# File 'lib/weibo2/interface/favorites.rb', line 109

def tags_destroy_batch(tid)
  post 'favorites/tags/destroy_batch.json', :body => {:tid => tid}
end

#tags_update(id, opt = {}) ⇒ Object

更新一条收藏的收藏标签

Parameters:

  • id (int64)

    需要更新的收藏ID

  • opts (Hash)

See Also:



91
92
93
# File 'lib/weibo2/interface/favorites.rb', line 91

def tags_update(id, opt={})
  post 'favorites/tags/update.json', :body => {:id => id}.merge(opts)
end

#tags_update_batch(tid, tag) ⇒ Object

更新当前登录用户所有收藏下的指定标签

Parameters:

  • tid (int64)

    需要更新的标签ID

  • tag (String)

    需要更新的标签内容

See Also:



100
101
102
# File 'lib/weibo2/interface/favorites.rb', line 100

def tags_update_batch(tid, tag)
  post 'favorites/tags/update_batch.json', :body => {:tid => tid, :tag => tag}
end