Class: Esbit::Campfire
- Inherits:
-
Object
- Object
- Esbit::Campfire
- Defined in:
- lib/esbit/campfire.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#subdomain ⇒ Object
readonly
Returns the value of attribute subdomain.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #find_room_by_id(room_id) ⇒ Object
- #find_room_by_name(room_name) ⇒ Object
-
#initialize(subdomain, token) ⇒ Campfire
constructor
A new instance of Campfire.
- #room(room_id) ⇒ Object
- #rooms ⇒ Object
Constructor Details
#initialize(subdomain, token) ⇒ Campfire
Returns a new instance of Campfire.
5 6 7 8 9 |
# File 'lib/esbit/campfire.rb', line 5 def initialize(subdomain, token) @subdomain = subdomain @token = token @connection = Esbit::Connection.new(self) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/esbit/campfire.rb', line 3 def connection @connection end |
#subdomain ⇒ Object (readonly)
Returns the value of attribute subdomain.
3 4 5 |
# File 'lib/esbit/campfire.rb', line 3 def subdomain @subdomain end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
3 4 5 |
# File 'lib/esbit/campfire.rb', line 3 def token @token end |
Instance Method Details
#find_room_by_id(room_id) ⇒ Object
21 22 23 |
# File 'lib/esbit/campfire.rb', line 21 def find_room_by_id(room_id) self.rooms.find { |room| room.id == room_id } end |
#find_room_by_name(room_name) ⇒ Object
25 26 27 |
# File 'lib/esbit/campfire.rb', line 25 def find_room_by_name(room_name) self.rooms.find { |room| room.name == room_name } end |
#room(room_id) ⇒ Object
17 18 19 |
# File 'lib/esbit/campfire.rb', line 17 def room(room_id) @connection.get 'rooms', id: room_id end |