Class: SaeClient2
- Inherits:
-
Object
- Object
- SaeClient2
- Defined in:
- lib/sae_client2.rb
Instance Attribute Summary collapse
-
#oauth ⇒ Object
readonly
Returns the value of attribute oauth.
Instance Method Summary collapse
- #create_friendship ⇒ Object
- #followers(cursor = -1,, count = 200) ⇒ Object
- #friends(cursor = -1,, count = 200) ⇒ Object
-
#initialize(key, secret, access_token, refresh_token, weibo_uid = nil) ⇒ SaeClient2
constructor
A new instance of SaeClient2.
- #tags ⇒ Object
- #update(status) ⇒ Object
- #upload(status, pic_path, lat = nil, long = nil) ⇒ Object
- #user_timeline ⇒ Object
- #users_show ⇒ Object
Constructor Details
#initialize(key, secret, access_token, refresh_token, weibo_uid = nil) ⇒ SaeClient2
Returns a new instance of SaeClient2.
4 5 6 7 |
# File 'lib/sae_client2.rb', line 4 def initialize(key, secret, access_token, refresh_token, weibo_uid = nil) @oauth = SaeOauth2.new(key, secret, access_token, refresh_token) @weibo_uid = weibo_uid end |
Instance Attribute Details
#oauth ⇒ Object (readonly)
Returns the value of attribute oauth.
2 3 4 |
# File 'lib/sae_client2.rb', line 2 def oauth @oauth end |
Instance Method Details
#create_friendship ⇒ Object
25 26 27 |
# File 'lib/sae_client2.rb', line 25 def create_friendship self.oauth.post("https://api.weibo.com/2/friendships/create.json", {:uid => @weibo_uid}) end |
#followers(cursor = -1,, count = 200) ⇒ Object
17 18 19 |
# File 'lib/sae_client2.rb', line 17 def followers(cursor = -1, count = 200) self.oauth.get("https://api.weibo.com/2/friendships/followers.json", {:cursor => cursor, :count => count, :uid => @weibo_uid}) end |
#friends(cursor = -1,, count = 200) ⇒ Object
21 22 23 |
# File 'lib/sae_client2.rb', line 21 def friends(cursor = -1, count = 200) self.oauth.get("https://api.weibo.com/2/friendships/friends.json", {:cursor => cursor, :count => count, :uid => @weibo_uid}) end |
#tags ⇒ Object
33 34 35 |
# File 'lib/sae_client2.rb', line 33 def self.oauth.get("https://api.weibo.com/2/tags.json", {:uid => @weibo_uid}) end |
#update(status) ⇒ Object
9 10 11 |
# File 'lib/sae_client2.rb', line 9 def update(status) self.oauth.post("https://api.weibo.com/2/statuses/update.json", {:status => status}) end |
#upload(status, pic_path, lat = nil, long = nil) ⇒ Object
13 14 15 |
# File 'lib/sae_client2.rb', line 13 def upload(status, pic_path, lat = nil, long = nil) self.oauth.post('https://api.weibo.com/2/statuses/upload.json', {:status => status, :pic => File.new(File.(pic_path))}) end |
#user_timeline ⇒ Object
37 38 39 |
# File 'lib/sae_client2.rb', line 37 def user_timeline self.oauth.get("https://api.weibo.com/2/statuses/user_timeline.json", {:uid => @weibo_uid}) end |
#users_show ⇒ Object
29 30 31 |
# File 'lib/sae_client2.rb', line 29 def users_show self.oauth.get("https://api.weibo.com/2/users/show.json", {:uid => @weibo_uid}) end |