Class: Killbill::Chartmogul::ChartmogulPlugin
- Inherits:
-
Plugin::Notification
- Object
- Plugin::Notification
- Killbill::Chartmogul::ChartmogulPlugin
- Defined in:
- lib/chart_mogul.rb
Instance Attribute Summary collapse
-
#initializer ⇒ Object
readonly
For testing.
Instance Method Summary collapse
-
#initialize ⇒ ChartmogulPlugin
constructor
A new instance of ChartmogulPlugin.
- #on_event(event) ⇒ Object
- #start_plugin ⇒ Object
Constructor Details
#initialize ⇒ ChartmogulPlugin
Returns a new instance of ChartmogulPlugin.
14 15 16 17 18 |
# File 'lib/chart_mogul.rb', line 14 def initialize super @config_key_name = 'PLUGIN_CONFIG_killbill-chartmogul'.to_sym end |
Instance Attribute Details
#initializer ⇒ Object (readonly)
For testing
12 13 14 |
# File 'lib/chart_mogul.rb', line 12 def initializer @initializer end |
Instance Method Details
#on_event(event) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/chart_mogul.rb', line 29 def on_event(event) if (event.event_type == :TENANT_CONFIG_CHANGE || event.event_type == :TENANT_CONFIG_DELETION) && event..to_sym == @config_key_name @logger.info("Invalidating plugin key='#{@config_key_name}', tenant='#{event.tenant_id}'") @initializer.recycle_updater(event.tenant_id) elsif !@initializer.nil? updater = @initializer.updater(event.tenant_id) updater.update(event.event_type, event.object_id, event.account_id, event.tenant_id) unless updater.nil? else @logger.warn "ChartMogul wasn't started properly - check logs" end end |
#start_plugin ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/chart_mogul.rb', line 20 def start_plugin @logger.progname = 'chartmogul-plugin' super @initializer = Killbill::Chartmogul::UpdaterInitializer.instance @initializer.initialize!(@config_key_name, "#{@conf_dir}/chartmogul.yml", @kb_apis, @logger) end |