weibo_focus 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +17 -0
- data/example/.sass-cache/0d4365dd4f25a1b2574fe0fe2e903692b6df08f1/screen.sassc +0 -0
- data/example/.sass-cache/80b2331c862c6e430e0af18caf62d12d982610f0/screen.sassc +0 -0
- data/example/.sass-cache/faf9751221db0b5ce76d45351b9591c3bfc59441/screen.sassc +0 -0
- data/example/Gemfile +7 -0
- data/example/Gemfile~ +7 -0
- data/example/config.ru +2 -0
- data/example/example.rb +84 -0
- data/example/example.rb~ +84 -0
- data/example/views/index.haml +42 -0
- data/example/views/layout.haml +12 -0
- data/example/views/screen.sass +13 -0
- data/example/weibo.rb +7 -0
- data/lib/weibo_focus/access_token.rb +20 -0
- data/lib/weibo_focus/api/v2/account.rb +31 -0
- data/lib/weibo_focus/api/v2/base.rb +64 -0
- data/lib/weibo_focus/api/v2/comments.rb +51 -0
- data/lib/weibo_focus/api/v2/common.rb +28 -0
- data/lib/weibo_focus/api/v2/favorites.rb +59 -0
- data/lib/weibo_focus/api/v2/friendships.rb +64 -0
- data/lib/weibo_focus/api/v2/location.rb +83 -0
- data/lib/weibo_focus/api/v2/notification.rb +12 -0
- data/lib/weibo_focus/api/v2/place.rb +123 -0
- data/lib/weibo_focus/api/v2/register.rb +14 -0
- data/lib/weibo_focus/api/v2/remind.rb +23 -0
- data/lib/weibo_focus/api/v2/search.rb +38 -0
- data/lib/weibo_focus/api/v2/short_url.rb +49 -0
- data/lib/weibo_focus/api/v2/statuses.rb +117 -0
- data/lib/weibo_focus/api/v2/suggestions.rb +45 -0
- data/lib/weibo_focus/api/v2/tags.rb +36 -0
- data/lib/weibo_focus/api/v2/trends.rb +39 -0
- data/lib/weibo_focus/api/v2/users.rb +30 -0
- data/lib/weibo_focus/base.rb +6 -0
- data/lib/weibo_focus/client.rb +102 -0
- data/lib/weibo_focus/config.rb +28 -4
- data/lib/weibo_focus/config.rb~ +30 -0
- data/lib/weibo_focus/oauth.rb +6 -0
- data/lib/weibo_focus/strategy/auth_code.rb +12 -0
- data/lib/weibo_focus/version.rb +1 -1
- data/lib/weibo_focus/version.rb~ +3 -0
- data/lib/weibo_focus.rb +20 -9
- data/lib/weibo_focus.rb~ +51 -0
- data/spec/weibo_spec.rb +44 -0
- data/weibo_focus.gemspec +11 -13
- data/weibo_focus.gemspec~ +25 -0
- metadata +128 -6
@@ -0,0 +1,28 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Common < Base
|
5
|
+
#read interfaces
|
6
|
+
def code_to_location(codes, opt={})
|
7
|
+
hashie get("common/code_to_location", :params => {:codes => codes}.merge(opt))
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_city(province, opt={})
|
11
|
+
hashie get("common/send", :params => {:province => province}.merge(opt))
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_province(country, opt={})
|
15
|
+
hashie get("common/send", :params => {:country => country}.merge(opt))
|
16
|
+
end
|
17
|
+
|
18
|
+
def get_country(opt={})
|
19
|
+
hashie get("common/send", :params => {:uids => uids, :tpl_id => tpl_id}.merge(opt))
|
20
|
+
end
|
21
|
+
|
22
|
+
def get_timezone(opt={})
|
23
|
+
hashie get("common/send", :params => {:uids => uids, :tpl_id => tpl_id}.merge(opt))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Favorites < Base
|
5
|
+
|
6
|
+
#read interfaces
|
7
|
+
def favorites(opt={})
|
8
|
+
hashie get("favorites.json", :params => opt)
|
9
|
+
end
|
10
|
+
|
11
|
+
def ids(opt={})
|
12
|
+
hashie get("favorites/ids.json", :params => opt)
|
13
|
+
end
|
14
|
+
|
15
|
+
def show(id, opt={})
|
16
|
+
hashie get("favorites/show.json", :params => {:id => id}.merge(opt))
|
17
|
+
end
|
18
|
+
|
19
|
+
def by_tags(tid, opt={})
|
20
|
+
hashie get("favorites/by_tags.json", :params => {:tid => tid}.merge(opt))
|
21
|
+
end
|
22
|
+
|
23
|
+
def tags(opt={})
|
24
|
+
hashie get("favorites/tags.json", :params => opt)
|
25
|
+
end
|
26
|
+
|
27
|
+
def by_tags_ids(tid, opt={})
|
28
|
+
hashie get("favorites/by_tags/ids.json", :params => {:tid => tid}.merge(opt))
|
29
|
+
end
|
30
|
+
|
31
|
+
#write interfaces
|
32
|
+
def create(id, opt={})
|
33
|
+
hashie post("favorites/create.json", :params => {:id => id}.merge(opt))
|
34
|
+
end
|
35
|
+
|
36
|
+
def destroy(id, opt={})
|
37
|
+
hashie post("favorites/destroy.json", :params => {:id => id}.merge(opt))
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy_batch(ids, opt={})
|
41
|
+
hashie post("favorites/destroy_batch.json", :params => {:ids => ids}.merge(opt))
|
42
|
+
end
|
43
|
+
|
44
|
+
def tags_update(id, tags, opt={})
|
45
|
+
hashie post("favorites/tags/update.json", :params => {:id => id, :tags => CGI::escape(tags)}.merge(opt))
|
46
|
+
end
|
47
|
+
|
48
|
+
def tags_update_batch(tid, tag, opt={})
|
49
|
+
hashie post("favorites/tags/update_batch.json", :params => {:tid => tid, :tag => CGI::escape(tag)}.merge(opt))
|
50
|
+
end
|
51
|
+
|
52
|
+
def tags_destroy_batch(tid, opt={})
|
53
|
+
hashie post("favorites/tags/destroy_batch.json", :params => {:tid => tid}.merge(opt))
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Friendships < Base
|
5
|
+
|
6
|
+
#read interfaces
|
7
|
+
def friends(opt={})
|
8
|
+
hashie get("friendships/friends.json", :params => opt)
|
9
|
+
end
|
10
|
+
|
11
|
+
def friends_in_common(uid, opt={})
|
12
|
+
hashie get("friendships/friends/in_common.json", :params => {:uid => uid}.merge(opt))
|
13
|
+
end
|
14
|
+
|
15
|
+
def friends_bilateral(uid, opt={})
|
16
|
+
hashie get("friendships/friends/bilateral.json", :params => {:uid => uid}.merge(opt))
|
17
|
+
end
|
18
|
+
|
19
|
+
def friends_bilateral_ids(uid, opt={})
|
20
|
+
hashie get("friendships/friends/bilateral/ids.json", :params => {:uid => uid}.merge(opt))
|
21
|
+
end
|
22
|
+
|
23
|
+
def friends_ids(opt={})
|
24
|
+
hashie get("friendships/friends/ids.json", :params => opt)
|
25
|
+
end
|
26
|
+
|
27
|
+
def followers(opt={})
|
28
|
+
hashie get("friendships/followers.json", :params => opt)
|
29
|
+
end
|
30
|
+
|
31
|
+
def followers_ids(opt={})
|
32
|
+
hashie get("friendships/followers/ids.json", :params => opt)
|
33
|
+
end
|
34
|
+
|
35
|
+
def followers_active(uid, opt={})
|
36
|
+
hashie get("friendships/followers/active.json", :params => {:uid => uid}.merge(opt))
|
37
|
+
end
|
38
|
+
|
39
|
+
def friends_chain_followers(uid, opt={})
|
40
|
+
hashie get("friendships/friends_chain/followers.json", :params => {:uid => uid}.merge(opt))
|
41
|
+
end
|
42
|
+
|
43
|
+
def show(opt={})
|
44
|
+
hashie get("friendships/show.json", :params => opt)
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
#write interfaces
|
49
|
+
def create(opt={})
|
50
|
+
hashie post("friendships/create.json", :params => opt)
|
51
|
+
end
|
52
|
+
|
53
|
+
def destroy(opt={})
|
54
|
+
hashie post("friendships/destroy.json", :params => opt)
|
55
|
+
end
|
56
|
+
|
57
|
+
def remark_update(uid, remark, opt={})
|
58
|
+
hashie post("friendships/remark/update.json", :params => {:uid => uid, :remark => remark}.merge(opt))
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Location < Base
|
5
|
+
|
6
|
+
#read interfaces
|
7
|
+
def base_get_map_image(opt={})
|
8
|
+
hashie get("location/base/get_map_image.json", :params => opt)
|
9
|
+
end
|
10
|
+
|
11
|
+
def geo_ip_to_geo(ip, opt={})
|
12
|
+
hashie get("location/geo/ip_to_geo.json", :params => {:ip => ip}.merge(opt))
|
13
|
+
end
|
14
|
+
|
15
|
+
def geo_address_to_geo(address, opt={})
|
16
|
+
hashie get("location/geo/address_to_geo.json", :params => {:address => address}.merge(opt))
|
17
|
+
end
|
18
|
+
|
19
|
+
def geo_geo_to_address(coordinate, opt={})
|
20
|
+
hashie get("location/geo/geo_to_address.json", :params => {:coordinate => coordinate}.merge(opt))
|
21
|
+
end
|
22
|
+
|
23
|
+
def geo_gps_to_offset(coordinate, opt={})
|
24
|
+
hashie get("location/geo/gps_to_offset.json", :params => {:coordinate => coordinate}.merge(opt))
|
25
|
+
end
|
26
|
+
|
27
|
+
def geo_is_domestic(coordinates, opt={})
|
28
|
+
hashie get("location/geo/is_domestic.json", :params => {:coordinate => coordinate}.merge(opt))
|
29
|
+
end
|
30
|
+
|
31
|
+
def pois_show_batch(srcids, opt={})
|
32
|
+
hashie get("location/pois/show_batch.json", :params => {:srcids => srcids}.merge(opt))
|
33
|
+
end
|
34
|
+
|
35
|
+
def pois_search_by_location(opt={})
|
36
|
+
hashie get("location/pois/search/by_location.json", :params => opt)
|
37
|
+
end
|
38
|
+
|
39
|
+
def pois_search_by_geo(opt={})
|
40
|
+
hashie get("location/pois/search/by_geo.json", :params => opt)
|
41
|
+
end
|
42
|
+
|
43
|
+
def pois_search_by_area(coordinates, opt={})
|
44
|
+
hashie get("location/pois/search/by_area.json", :params => {:coordinate => coordinate}.merge(opt))
|
45
|
+
end
|
46
|
+
|
47
|
+
#to implement
|
48
|
+
def mobile_get_location(opt={})
|
49
|
+
#hashie get("location/mobile/get_location.json", :params => opt)
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def line_drive_route(opt={})
|
54
|
+
hashie get("location/line/drive_route.json", :params => opt)
|
55
|
+
end
|
56
|
+
|
57
|
+
def line_bus_route(opt={})
|
58
|
+
hashie get("location/line/bus_route.json", :params => opt)
|
59
|
+
end
|
60
|
+
|
61
|
+
def line_bus_line(q, opt={})
|
62
|
+
hashie get("location/line/bus_line.json", :params => {:q => q}.merge(opt))
|
63
|
+
end
|
64
|
+
|
65
|
+
def line_bus_station(q, opt={})
|
66
|
+
hashie get("location/line/bus_station.json", :params => {:q => q}.merge(opt))
|
67
|
+
end
|
68
|
+
|
69
|
+
#write interfaces
|
70
|
+
def pois_add(srcid, name, address, city_name, category, longitude, latitude, opt={})
|
71
|
+
hashie post("location/pois/add.json", :params => {:srcid => srcid,
|
72
|
+
:name => name,
|
73
|
+
:address => address,
|
74
|
+
:city_name => city_name,
|
75
|
+
:category => category,
|
76
|
+
:longitude => longitude,
|
77
|
+
:latitude => latitude}.merge(opt))
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Place < Base
|
5
|
+
#read interfaces
|
6
|
+
def public_timeline(opt={})
|
7
|
+
hashie get("place/public_timeline.json", :params => opt)
|
8
|
+
end
|
9
|
+
|
10
|
+
def friends_timeline(opt={})
|
11
|
+
hashie get("place/friends_timeline.json", :params => opt)
|
12
|
+
end
|
13
|
+
|
14
|
+
def user_timeline(uid, opt={})
|
15
|
+
hashie get("place/user_timeline.json", :params => {:uid => uid}.merge(opt))
|
16
|
+
end
|
17
|
+
|
18
|
+
def poi_timeline(poiid, opt={})
|
19
|
+
hashie get("place/poi_timeline.json", :params => {:poiid => poiid}.merge(opt))
|
20
|
+
end
|
21
|
+
|
22
|
+
def nearby_timeline(lat, long, opt={})
|
23
|
+
hashie get("place/nearby_timeline.json", :params => {:lat => lat, :long => long}.merge(opt))
|
24
|
+
end
|
25
|
+
|
26
|
+
def statuses_show(id, opt={})
|
27
|
+
hashie get("place/statuses/show.json", :params => {:id => id}.merge(opt))
|
28
|
+
end
|
29
|
+
|
30
|
+
def users_show(uid, opt={})
|
31
|
+
hashie get("place/users/show.json", :params => {:uid => uid}.merge(opt))
|
32
|
+
end
|
33
|
+
|
34
|
+
def users_checkins(uid, opt={})
|
35
|
+
hashie get("place/users/checkins.json", :params => {:uid => uid}.merge(opt))
|
36
|
+
end
|
37
|
+
|
38
|
+
def users_photos(uid, opt={})
|
39
|
+
hashie get("place/users/photos.json", :params => {:uid => uid}.merge(opt))
|
40
|
+
end
|
41
|
+
|
42
|
+
def users_tips(uid, opt={})
|
43
|
+
hashie get("place/users/tips.json", :params => {:uid => uid}.merge(opt))
|
44
|
+
end
|
45
|
+
|
46
|
+
def users_todos(uid, opt={})
|
47
|
+
hashie get("place/users/todos.json", :params => {:uid => uid}.merge(opt))
|
48
|
+
end
|
49
|
+
|
50
|
+
def pois_show(poiid, opt={})
|
51
|
+
hashie get("place/pois/show.json", :params => {:poiid => poiid}.merge(opt))
|
52
|
+
end
|
53
|
+
|
54
|
+
def pois_users(poiid, opt={})
|
55
|
+
hashie get("place/pois/users.json", :params => {:poiid => poiid}.merge(opt))
|
56
|
+
end
|
57
|
+
|
58
|
+
def pois_tips(poiid, opt={})
|
59
|
+
hashie get("place/pois/tips.json", :params => {:poiid => poiid}.merge(opt))
|
60
|
+
end
|
61
|
+
|
62
|
+
def pois_photos(poiid, opt={})
|
63
|
+
hashie get("place/pois/photos.json", :params => {:poiid => poiid}.merge(opt))
|
64
|
+
end
|
65
|
+
|
66
|
+
def pois_search(keyword, opt={})
|
67
|
+
hashie get("place/pois/search.json", :params => {:keyword => keyword}.merge(opt))
|
68
|
+
end
|
69
|
+
|
70
|
+
def pois_category(opt={})
|
71
|
+
hashie get("place/pois/category.json", :params => opt)
|
72
|
+
end
|
73
|
+
|
74
|
+
def nearby_pois(lat, long, opt={})
|
75
|
+
hashie get("place/nearby/pois.json", :params => {:lat => lat, :long => long}.merge(opt))
|
76
|
+
end
|
77
|
+
|
78
|
+
def nearby_users(lat, long, opt={})
|
79
|
+
hashie get("place/nearby/users.json", :params => {:lat => lat, :long => long}.merge(opt))
|
80
|
+
end
|
81
|
+
|
82
|
+
def nearby_photos(lat, long, opt={})
|
83
|
+
hashie get("place/nearby/photos.json", :params => {:lat => lat, :long => long}.merge(opt))
|
84
|
+
end
|
85
|
+
|
86
|
+
def nearby_users_list(lat, long, opt={})
|
87
|
+
hashie get("place/nearby_users/list.json", :params => {:lat => lat, :long => long}.merge(opt))
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
#write interfaces
|
92
|
+
def pois_create(title, lat, long, city, opt={})
|
93
|
+
hashie post("place/pois/create.json", :params => {:title => title, :lat => lat, :long => long, :city => city}.merge(opt))
|
94
|
+
end
|
95
|
+
|
96
|
+
def pois_add_checkin(poiid, status, opt={})
|
97
|
+
hashie post("place/pois/add_checkin.json", :params => {:poiid => poiid, :status => status}.merge(opt))
|
98
|
+
end
|
99
|
+
|
100
|
+
def pois_add_photo(poiid, status, pic, opt={})
|
101
|
+
multipart = Base.build_multipart_bodies({"poiid" => poiid, "status" => status, "pic" => pic}.merge(opt))
|
102
|
+
hashie post("place/pois/add_photo.json", :headers => multipart[:headers], :body => multipart[:body])
|
103
|
+
end
|
104
|
+
|
105
|
+
def pois_add_tip(poiid, status, opt={})
|
106
|
+
hashie post("place/pois/add_tip.json", :params => {:poiid => poiid, :status => status}.merge(opt))
|
107
|
+
end
|
108
|
+
|
109
|
+
def pois_add_todo(poiid, status, opt={})
|
110
|
+
hashie post("place/pois/create.json", :params => {:poiid => poiid, :status => status}.merge(opt))
|
111
|
+
end
|
112
|
+
|
113
|
+
def nearby_users_create(lat, long, opt={})
|
114
|
+
hashie post("place/nearby_users/create.json", :params => {:lat => lat, :long => long}.merge(opt))
|
115
|
+
end
|
116
|
+
|
117
|
+
def nearby_users_destroy(opt={})
|
118
|
+
hashie post("place/nearby_users/destroy.json", :params => opt)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Register < Base
|
5
|
+
|
6
|
+
#read interfaces
|
7
|
+
def verify_nickname(nickname, opt={})
|
8
|
+
hashie get("register/verify_nickname.json", :params => {:nickname => CGI::escape(nickname)}.merge(opt))
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
module Weibo
|
4
|
+
module Api
|
5
|
+
module V2
|
6
|
+
class Remind < Base
|
7
|
+
|
8
|
+
#read interfaces
|
9
|
+
|
10
|
+
#http://open.weibo.com/wiki/2/remind/unread_count
|
11
|
+
#this interface is different, it has a different domain, and frequently changed, it should be usually called from javascript. so I removed all parameters.
|
12
|
+
def unread_count()
|
13
|
+
hashie RestClient.get "https://rm.api.weibo.com/2/remind/unread_count.json?access_token=#{@access_token.token}"
|
14
|
+
end
|
15
|
+
|
16
|
+
#write interfaces
|
17
|
+
def set_count()
|
18
|
+
hashie RestClient.post "https://rm.api.weibo.com/2/remind/set_count.json", :access_token => access_token.token
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Weibo
|
2
|
+
module Api
|
3
|
+
module V2
|
4
|
+
class Search < Base
|
5
|
+
|
6
|
+
#read interfaces
|
7
|
+
def suggestions_users(q, opt={})
|
8
|
+
hashie get("search/suggestions/users.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
9
|
+
end
|
10
|
+
|
11
|
+
def suggestions_statuses(q, opt={})
|
12
|
+
hashie get("search/suggestions/statuses.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
13
|
+
end
|
14
|
+
|
15
|
+
def suggestions_schools(q, opt={})
|
16
|
+
hashie get("search/suggestions/schools.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
17
|
+
end
|
18
|
+
|
19
|
+
def suggestions_companies(q, opt={})
|
20
|
+
hashie get("search/suggestions/companies.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
21
|
+
end
|
22
|
+
|
23
|
+
def suggestions_apps(q, opt={})
|
24
|
+
hashie get("search/suggestions/apps.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
25
|
+
end
|
26
|
+
|
27
|
+
def suggestions_at_users(q, type, opt={})
|
28
|
+
hashie get("search/suggestions/at_users.json", :params => {:q => CGI::escape(q), :type => type}.merge(opt))
|
29
|
+
end
|
30
|
+
|
31
|
+
def topics(q, opt={})
|
32
|
+
hashie get("search/topics.json", :params => {:q => CGI::escape(q)}.merge(opt))
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|