lib/lita/adapters/campfire.rb in lita-campfire-0.1.3 vs lib/lita/adapters/campfire.rb in lita-campfire-0.1.4
- old
+ new
@@ -1,21 +1,27 @@
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
- @connector = Connector.new(
- robot,
+ options = {
subdomain: config.subdomain,
apikey: config.apikey,
rooms: rooms,
- debug: config.debug
+ }
+
+ options.merge!(optional_config_options)
+
+ @connector = Connector.new(
+ robot,
+ options
)
end
def run
connector.connect
@@ -47,9 +53,16 @@
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
\ No newline at end of file