Class: CampfireChat::Client
- Inherits:
-
Object
- Object
- CampfireChat::Client
- Defined in:
- lib/campfire_chat/client.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#last_message_id ⇒ Object
Returns the value of attribute last_message_id.
Instance Method Summary collapse
-
#initialize(config = CampfireChat.config) ⇒ Client
constructor
A new instance of Client.
- #messages ⇒ Object
- #tinder ⇒ Object
Constructor Details
#initialize(config = CampfireChat.config) ⇒ Client
Returns a new instance of Client.
6 7 8 |
# File 'lib/campfire_chat/client.rb', line 6 def initialize(config = CampfireChat.config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/campfire_chat/client.rb', line 4 def config @config end |
#last_message_id ⇒ Object
Returns the value of attribute last_message_id.
5 6 7 |
# File 'lib/campfire_chat/client.rb', line 5 def @last_message_id end |
Instance Method Details
#messages ⇒ Object
14 15 16 17 18 19 |
# File 'lib/campfire_chat/client.rb', line 14 def = room.recent.select {|x| x.type == 'TextMessage' } = .select {|x| x.id.to_i > .to_i }.map {|m| (m) } self. = .last.id unless .empty? end |
#tinder ⇒ Object
10 11 12 |
# File 'lib/campfire_chat/client.rb', line 10 def tinder @tinder ||= Tinder::Campfire.new(config.subdomain, :token => config.token) end |