Module: Gitter::Client::Users
- Included in:
- Gitter::Client
- Defined in:
- lib/gitter/client/users.rb
Instance Method Summary collapse
- #current_user ⇒ Object
- #user_channels(user_id) ⇒ Object
- #user_orgs(user_id) ⇒ Object
- #user_read_messages(user_id, room_id, chat_ids) ⇒ Object
- #user_repos(user_id) ⇒ Object
- #user_rooms(user_id) ⇒ Object
Instance Method Details
#current_user ⇒ Object
8 9 10 |
# File 'lib/gitter/client/users.rb', line 8 def current_user Hashie::Mash.new(self.class.get("/user", headers: @headers)[0]) end |
#user_channels(user_id) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/gitter/client/users.rb', line 40 def user_channels(user_id) channel_list = [] self.class.get("/user/#{user_id}/channels", headers: @headers).each do |channel| channel_list << Hashie::Mash.new(channel) end channel_list end |
#user_orgs(user_id) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/gitter/client/users.rb', line 24 def user_orgs(user_id) org_list = [] self.class.get("/user/#{user_id}/orgs", headers: @headers).each do |org| org_list << Hashie::Mash.new(org) end org_list end |
#user_read_messages(user_id, room_id, chat_ids) ⇒ Object
20 21 22 |
# File 'lib/gitter/client/users.rb', line 20 def (user_id, room_id, chat_ids) Hashie::Mash.new(self.class.post("/user/#{user_id}/rooms/#{room_id}/unreadItems", headers: @headers, body: { chat: chat_ids }.to_json)) end |
#user_repos(user_id) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/gitter/client/users.rb', line 32 def user_repos(user_id) repo_list = [] self.class.get("/user/#{user_id}/repos", headers: @headers).each do |repo| repo_list << Hashie::Mash.new(repo) end repo_list end |
#user_rooms(user_id) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gitter/client/users.rb', line 12 def user_rooms(user_id) room_list = [] self.class.get("/user/#{user_id}/rooms", headers: @headers).each do |room| room_list << Hashie::Mash.new(room) end room_list end |