Module: Kameleoon::ClientFactory
- Defined in:
- lib/kameleoon/factory.rb
Overview
A Factory class for creating kameleoon clients
Constant Summary collapse
- CONFIGURATION_UPDATE_INTERVAL =
'60m'- CONFIG_PATH =
'/etc/kameleoon/client-ruby.yaml'- DEFAULT_TIMEOUT =
milli-seconds
2000
Class Method Summary collapse
- .create(site_code, config_path = CONFIG_PATH, client_id = nil, client_secret = nil) ⇒ Object
- .forget(site_code) ⇒ Object
Class Method Details
.create(site_code, config_path = CONFIG_PATH, client_id = nil, client_secret = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kameleoon/factory.rb', line 14 def self.create(site_code, config_path = CONFIG_PATH, client_id = nil, client_secret = nil) if @clients[site_code].nil? client = Client.new(site_code, config_path, CONFIGURATION_UPDATE_INTERVAL, DEFAULT_TIMEOUT, client_id, client_secret) client.send(:log, "Client created with site code: #{site_code}") client.send(:fetch_configuration) @clients.store(site_code, client) end @clients[site_code] end |
.forget(site_code) ⇒ Object
25 26 27 |
# File 'lib/kameleoon/factory.rb', line 25 def self.forget(site_code) @clients.delete(site_code) end |