Class: TidaSinaWeibo::AutoTokenSwitchApiWrapper
- Inherits:
-
Object
- Object
- TidaSinaWeibo::AutoTokenSwitchApiWrapper
- Defined in:
- lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#request_data ⇒ Object
readonly
Returns the value of attribute request_data.
-
#rest_client ⇒ Object
readonly
Returns the value of attribute rest_client.
-
#token_provider ⇒ Object
readonly
Returns the value of attribute token_provider.
Instance Method Summary collapse
- #comments_show(post_id, page = 1) ⇒ Object
- #friendships_followers(uid, cursor) ⇒ Object
- #friendships_followers_ids(uid, cursor) ⇒ Object
-
#initialize(tp, rc = nil) ⇒ AutoTokenSwitchApiWrapper
constructor
A new instance of AutoTokenSwitchApiWrapper.
- #queryid(mid) ⇒ Object
- #querymid(id, batch = false) ⇒ Object
- #querymids(ids) ⇒ Object
- #status_repost_timeline(post_id, page = 1) ⇒ Object
- #status_show(wb_post_id) ⇒ Object
- #status_update(content) ⇒ Object
- #status_upload(content, image_path) ⇒ Object
- #status_user_timeline(uid, page = 1, count = 100) ⇒ Object
- #tags(uid) ⇒ Object
- #user_domain_show(domain) ⇒ Object
- #user_show(uid, is_number_id = true) ⇒ Object
Constructor Details
#initialize(tp, rc = nil) ⇒ AutoTokenSwitchApiWrapper
Returns a new instance of AutoTokenSwitchApiWrapper.
13 14 15 16 17 18 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 13 def initialize(tp, rc = nil) rc = RestClientWrapper.new if rc.nil? @rest_client = rc @token_provider = tp @access_token = tp.token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
8 9 10 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 8 def access_token @access_token end |
#request_data ⇒ Object (readonly)
Returns the value of attribute request_data.
9 10 11 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 9 def request_data @request_data end |
#rest_client ⇒ Object (readonly)
Returns the value of attribute rest_client.
11 12 13 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 11 def rest_client @rest_client end |
#token_provider ⇒ Object (readonly)
Returns the value of attribute token_provider.
10 11 12 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 10 def token_provider @token_provider end |
Instance Method Details
#comments_show(post_id, page = 1) ⇒ Object
36 37 38 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 36 def comments_show(post_id, page = 1) get_request(ApiSettings.api.comments.show, :params => {:id => post_id, :page => page, :count => 50}) end |
#friendships_followers(uid, cursor) ⇒ Object
56 57 58 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 56 def friendships_followers(uid, cursor) get_request(ApiSettings.api.friendships.followers, :params => {:uid => uid, :cursor => cursor}) end |
#friendships_followers_ids(uid, cursor) ⇒ Object
60 61 62 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 60 def friendships_followers_ids(uid, cursor) get_request(ApiSettings.api.friendships.followers_ids, :params => {:uid => uid, :cursor => cursor}) end |
#queryid(mid) ⇒ Object
68 69 70 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 68 def queryid(mid) get_request(ApiSettings.api.status.queryid, {:params => {:mid => mid, :type => 1, :isBase62 => 1}}) end |
#querymid(id, batch = false) ⇒ Object
72 73 74 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 72 def querymid(id, batch = false) get_request(ApiSettings.api.status.querymid, {:params => {:id => id, :type => 1, :is_batch => batch ? 1 : 0}}) end |
#querymids(ids) ⇒ Object
76 77 78 79 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 76 def querymids(ids) ids_str = ids.join(',') querymid(ids_str, true) end |
#status_repost_timeline(post_id, page = 1) ⇒ Object
32 33 34 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 32 def status_repost_timeline(post_id, page = 1) get_request(ApiSettings.api.status.repost_timeline, :params => {:id => post_id, :page => page, :count => 50}) end |
#status_show(wb_post_id) ⇒ Object
40 41 42 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 40 def status_show(wb_post_id) get_request(ApiSettings.api.status.show, :params => {:id => wb_post_id}) end |
#status_update(content) ⇒ Object
20 21 22 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 20 def status_update(content) post_request(ApiSettings.api.status.update, :status => content) end |
#status_upload(content, image_path) ⇒ Object
24 25 26 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 24 def status_upload(content, image_path) post_request(ApiSettings.api.status.upload, :status => content, :pic => File.new(image_path, 'rb')) end |
#status_user_timeline(uid, page = 1, count = 100) ⇒ Object
28 29 30 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 28 def status_user_timeline(uid, page = 1, count = 100) get_request(ApiSettings.api.status.user_timeline, :params => {:uid => uid, :page => page, :count => count}) end |
#tags(uid) ⇒ Object
64 65 66 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 64 def (uid) get_request(ApiSettings.api., :params => {:uid => uid}) end |
#user_domain_show(domain) ⇒ Object
52 53 54 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 52 def user_domain_show(domain) get_request(ApiSettings.api.user.domain_show, :params => {:domain => domain}) end |
#user_show(uid, is_number_id = true) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/tida_sina_weibo/auto_token_switch_api_wrapper.rb', line 44 def user_show(uid, is_number_id = true) if is_number_id get_request(ApiSettings.api.user.show, {:params => {:uid => uid}}) else get_request(ApiSettings.api.user.show, {:params => {:screen_name => uid}}) end end |