Class: Killbill::Zendesk::ZendeskPlugin

Inherits:
Plugin::Notification
  • Object
show all
Defined in:
lib/zendesk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#updaterObject (readonly)

For testing



16
17
18
# File 'lib/zendesk.rb', line 16

def updater
  @updater
end

Instance Method Details

#after_requestObject



23
24
25
26
# File 'lib/zendesk.rb', line 23

def after_request
  # return DB connections to the Pool if required
  ::ActiveRecord::Base.connection.close if ::ActiveRecord::Base.connection_pool.active_connection?
end

#on_event(event) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/zendesk.rb', line 28

def on_event(event)
  if @updater.nil?
    logger.warn "ZendeskPlugin wasn't started properly - check logs"
    return
  end
  @updater.update(event.) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
end

#start_pluginObject



18
19
20
21
# File 'lib/zendesk.rb', line 18

def start_plugin
  super
  @updater = Killbill::Zendesk::UserUpdaterInitializer.instance.initialize!(@conf_dir, @kb_apis, @logger)
end