Module: Douban::Client::Event
- Included in:
- Douban::Client
- Defined in:
- lib/douban_api/client/event.rb
Overview
Instance Method Summary collapse
-
#created_events(user_id = nil, options = {}) ⇒ Array<Hashie::Mash>
获取用户创建的活动.
-
#event(id) ⇒ Hashie::Mash
获取活动.
-
#event_participants(id, options = {}) ⇒ Array<Hashie::Mash>
获取参加活动的用户.
-
#event_wishers(id, options = {}) ⇒ Array<Hashie::Mash>
获取活动感兴趣的用户.
-
#events(loc_id, options = {}) ⇒ Array<Hashie::Mash>
获取活动列表.
-
#loc(id) ⇒ Hashie::Mash
获取城市.
-
#loc_list(options = {}) ⇒ Array<Hashie::Mash>
获取城市列表.
-
#participants_event(id, options = {}) ⇒ Hashie::Mash
参加活动.
-
#participated_events(user_id = nil) ⇒ Array<Hashie::Mash>
获取用户参加的活动.
-
#unparticipants_event(id) ⇒ Hashie::Mash
不参加活动.
-
#unwish_event(id) ⇒ Hashie::Mash
对活动不感兴趣.
-
#wish_event(id) ⇒ Hashie::Mash
对活动感兴趣.
-
#wished_events(user_id = nil) ⇒ Array<Hashie::Mash>
获取用户参加的活动.
Instance Method Details
#created_events(user_id = nil, options = {}) ⇒ Array<Hashie::Mash>
获取用户创建的活动
59 60 61 62 63 64 65 66 67 |
# File 'lib/douban_api/client/event.rb', line 59 def created_events(user_id=nil, ={}) if user_id.nil? response = get("v2/event/user_created/#{get_user_id}", ) else response = get("v2/event/user_created/#{user_id}", ) end response["events"] end |
#event(id) ⇒ Hashie::Mash
获取活动
16 17 18 |
# File 'lib/douban_api/client/event.rb', line 16 def event(id) response = get "v2/event/#{id}" end |
#event_participants(id, options = {}) ⇒ Array<Hashie::Mash>
获取参加活动的用户
29 30 31 32 |
# File 'lib/douban_api/client/event.rb', line 29 def event_participants(id, ={}) response = get("v2/event/#{id}/participants", ) response["users"] end |
#event_wishers(id, options = {}) ⇒ Array<Hashie::Mash>
获取活动感兴趣的用户
43 44 45 46 |
# File 'lib/douban_api/client/event.rb', line 43 def event_wishers(id, ={}) response = get("v2/event/#{id}/wishers", ) response["users"] end |
#events(loc_id, options = {}) ⇒ Array<Hashie::Mash>
获取活动列表
124 125 126 127 |
# File 'lib/douban_api/client/event.rb', line 124 def events(loc_id, ={}) response = get("v2/event/list", .merge(:loc => loc_id)) response["events"] end |
#loc(id) ⇒ Hashie::Mash
获取城市
138 139 140 |
# File 'lib/douban_api/client/event.rb', line 138 def loc(id) response = get "v2/loc/#{id}" end |
#loc_list(options = {}) ⇒ Array<Hashie::Mash>
获取城市列表
150 151 152 153 |
# File 'lib/douban_api/client/event.rb', line 150 def loc_list(={}) response = get("v2/loc/list", ) response["locs"] end |
#participants_event(id, options = {}) ⇒ Hashie::Mash
参加活动
166 167 168 |
# File 'lib/douban_api/client/event.rb', line 166 def participants_event(id, ={}) post "v2/event/#{id}/participants", end |
#participated_events(user_id = nil) ⇒ Array<Hashie::Mash>
获取用户参加的活动
80 81 82 83 84 85 86 87 88 |
# File 'lib/douban_api/client/event.rb', line 80 def participated_events(user_id=nil) if user_id.nil? response = get "v2/event/user_participated/#{get_user_id}" else response = get "v2/event/user_participated/#{user_id}" end response["events"] end |
#unparticipants_event(id) ⇒ Hashie::Mash
不参加活动
179 180 181 |
# File 'lib/douban_api/client/event.rb', line 179 def unparticipants_event(id) delete "v2/event/#{id}/participants" end |
#unwish_event(id) ⇒ Hashie::Mash
对活动不感兴趣
205 206 207 |
# File 'lib/douban_api/client/event.rb', line 205 def unwish_event(id) delete "v2/event/#{id}/wishers" end |
#wish_event(id) ⇒ Hashie::Mash
对活动感兴趣
192 193 194 |
# File 'lib/douban_api/client/event.rb', line 192 def wish_event(id) post "v2/event/#{id}/wishers" end |
#wished_events(user_id = nil) ⇒ Array<Hashie::Mash>
获取用户参加的活动
101 102 103 104 105 106 107 108 109 |
# File 'lib/douban_api/client/event.rb', line 101 def wished_events(user_id=nil) if user_id.nil? response = get "v2/event/user_wished/#{get_user_id}" else response = get "v2/event/user_wished/#{user_id}" end response["events"] end |