Sha256: d55671b4d67b90eca077441b4a45ad8009fd2436a4d1a16940d82c071957b800
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
module Lita module Adapters class Campfire < Adapter require_configs :subdomain, :apikey, :rooms OPTIONAL_CONFIG_OPTIONS = %i(debug tinder_options) attr_reader :connector def initialize(robot) super options = { subdomain: config.subdomain, apikey: config.apikey, rooms: rooms, } options.merge!(optional_config_options) @connector = Connector.new( robot, options ) end def run connector.connect connector.join_rooms sleep rescue Interrupt disconnect end def send_messages(target, messages) connector.send_messages(target.room, messages) end def set_topic(target, topic) connector.set_topic(target.room, topic) end def shut_down disconnect end private def config Lita.config.adapter end def rooms Array(config.rooms) end def disconnect connector.disconnect end def optional_config_options OPTIONAL_CONFIG_OPTIONS.each_with_object({}) do |config_option, options| config_option_value = config.public_send(config_option) options[config_option] = config_option_value if config_option_value end end end Lita.register_adapter(:campfire, Campfire) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lita-campfire-0.2.1 | lib/lita/adapters/campfire.rb |
lita-campfire-0.2.0 | lib/lita/adapters/campfire.rb |
lita-campfire-0.1.4 | lib/lita/adapters/campfire.rb |