Module: LitaLBCfg::Loader

Included in:
Lita::Handlers::Lbcfg
Defined in:
lib/lita-lbcfg/loader.rb

Instance Method Summary collapse

Instance Method Details

#_configObject

helper method for reliably pulling the right Lita config key



31
32
33
# File 'lib/lita-lbcfg/loader.rb', line 31

def _config
  Lita.config.handlers.lbcfg
end

#_register_client(credentials) ⇒ Object

helper method to register the client based on the credentials



36
37
38
39
40
41
42
43
# File 'lib/lita-lbcfg/loader.rb', line 36

def _register_client(credentials)
  DoubleDutch::SpaceCadet::Config.register(
    "#{credentials[:region]}-#{credentials[:env]}".downcase,
    credentials[:username].downcase,
    credentials[:key],
    credentials[:region].upcase
  )
end

#set_up_spacecadet(_) ⇒ Object

helper function to set up SpaceCadet meant to be used with the ‘on :loaded` event handler to use this, please add `include LitaLBCfg::Loader` to your handler



22
23
24
25
26
27
28
# File 'lib/lita-lbcfg/loader.rb', line 22

def set_up_spacecadet(_)
  creds = _config.credentials

  creds.each do |credentials|
    _register_client(credentials)
  end
end