Sha256: dee4ef6bd5fb7cc482d63552186e3b3d703b5a12f6e73b0356c4b5e55174d788

Contents?: true

Size: 744 Bytes

Versions: 13

Compression:

Stored size: 744 Bytes

Contents

require 'active_record'
require 'sinatra'

require 'killbill'
require 'zendesk_api'

require 'zendesk/zendesk_user'
require 'zendesk/user_updater'
require 'zendesk/user_updater_initializer'

module Killbill::Zendesk
  class ZendeskPlugin < Killbill::Plugin::Notification

    # For testing
    attr_reader :updater

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

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

    def on_event(event)
      @updater.update(event.account_id) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
killbill-zendesk-1.3.0 lib/zendesk.rb
killbill-zendesk-1.2.4 lib/zendesk.rb
killbill-zendesk-1.2.3 lib/zendesk.rb
killbill-zendesk-1.2.2 lib/zendesk.rb
killbill-zendesk-1.2.1 lib/zendesk.rb
killbill-zendesk-1.2.0 lib/zendesk.rb
killbill-zendesk-1.1.0 lib/zendesk.rb
killbill-zendesk-1.0.1 lib/zendesk.rb
killbill-zendesk-1.0.0 lib/zendesk.rb
killbill-zendesk-0.5.0 lib/zendesk.rb
killbill-zendesk-0.4.0 lib/zendesk.rb
killbill-zendesk-0.3.0 lib/zendesk.rb
killbill-zendesk-0.2.0 lib/zendesk.rb