Class: EventMachine::Campfire
- Inherits:
-
Object
- Object
- EventMachine::Campfire
- Includes:
- Connection, Messages, Rooms, Users
- Defined in:
- lib/em-campfire.rb,
lib/em-campfire/cache.rb,
lib/em-campfire/rooms.rb,
lib/em-campfire/users.rb,
lib/em-campfire/version.rb,
lib/em-campfire/messages.rb,
lib/em-campfire/connection.rb
Defined Under Namespace
Modules: Connection, Messages, Rooms, Users Classes: Cache
Constant Summary collapse
- VERSION =
"1.1.2"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#ignore_timestamps ⇒ Object
Returns the value of attribute ignore_timestamps.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Attributes included from Rooms
Attributes included from Connection
Instance Method Summary collapse
- #cache ⇒ Object
- #cache=(a_cache) ⇒ Object
- #ignore_timestamps? ⇒ Boolean
-
#initialize(options = {}) ⇒ Campfire
constructor
A new instance of Campfire.
Methods included from Messages
Methods included from Users
#fetch_user_data_for_self, #fetch_user_data_for_user_id, #is_me?
Methods included from Rooms
#join, #room_data_for_all_rooms, #room_data_from_room_id, #stream
Methods included from Connection
Constructor Details
#initialize(options = {}) ⇒ Campfire
Returns a new instance of Campfire.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/em-campfire.rb', line 22 def initialize( = {}) raise ArgumentError, "You must pass an API key" unless [:api_key] raise ArgumentError, "You must pass a subdomain" unless [:subdomain] .each do |k,v| s = "#{k}=" if respond_to?(s) send(s, v) else raise ArgumentError, "#{k.inspect} is not a valid option" end end fetch_user_data_for_self end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
15 16 17 |
# File 'lib/em-campfire.rb', line 15 def api_key @api_key end |
#ignore_timestamps ⇒ Object
Returns the value of attribute ignore_timestamps.
15 16 17 |
# File 'lib/em-campfire.rb', line 15 def @ignore_timestamps end |
#logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'lib/em-campfire.rb', line 15 def logger @logger end |
#subdomain ⇒ Object
Returns the value of attribute subdomain.
15 16 17 |
# File 'lib/em-campfire.rb', line 15 def subdomain @subdomain end |
#verbose ⇒ Object
Returns the value of attribute verbose.
15 16 17 |
# File 'lib/em-campfire.rb', line 15 def verbose @verbose end |
Instance Method Details
#cache ⇒ Object
43 44 45 |
# File 'lib/em-campfire.rb', line 43 def cache @cache ||= EventMachine::Campfire::Cache.new end |
#cache=(a_cache) ⇒ Object
38 39 40 41 |
# File 'lib/em-campfire.rb', line 38 def cache=(a_cache) raise(ArgumentError, "You must pass a conforming cache object") unless a_cache.respond_to(:set) && a_cache.respond_to(:get) @cache = a_cache end |
#ignore_timestamps? ⇒ Boolean
60 61 62 |
# File 'lib/em-campfire.rb', line 60 def self. || false end |