module Gitter::API::Room::ClientMethods
Gitter::API::Room
based methods that are available on any Gitter::API::Client
instance
Public Instance Methods
find_room(uri)
click to toggle source
Find a room based off of uri
Parameters¶ ↑
Example¶ ↑
client.join_room "gitterhq/sandbox" #=> <#Gitter::API::Room name="gitterhq/sandbox" ...>
:return: Gitter::API::Room
# File lib/gitter/api/room.rb, line 236 def find_room uri payload = { "uri" => uri }.to_json data = self.post "#{api_prefix}/rooms", payload Room.new(self, data) end
join_room(uri)
click to toggle source
Join a room from the top level client using the api user
Parameters¶ ↑
Example¶ ↑
client.join_room "gitterhq/sandbox" #=> <#Gitter::API::Room name="gitterhq/sandbox" ...>
:return: Gitter::API::Room
# File lib/gitter/api/room.rb, line 256 def join_room uri has_room = rooms.detect { |room| room.uri == uri } return has_room if has_room @rooms = nil # clear rooms cache self.class.find_room(uri).join end
rooms(refresh = false)
click to toggle source
Memoized version of User#rooms
for the api client user
Parameters¶ ↑
- refresh (Boolean)
-
set to true refresh memoization
:return: Gitter::API::Room::Collection
# File lib/gitter/api/room.rb, line 217 def rooms refresh = false return @rooms unless @rooms.nil? || refresh @rooms = user.rooms end