Sha256: a0399368f90feb512864f7eaadd5c648429658289fcd54bd4750c3718ffcd557

Contents?: true

Size: 809 Bytes

Versions: 5

Compression:

Stored size: 809 Bytes

Contents

require 'active_record'
require 'sinatra'

require 'killbill'

require 'helloworld/user'
require 'helloworld/user_listener'
require 'helloworld/initializer'

module Killbill::HelloWorld
  class HelloWorldPlugin < Killbill::Plugin::Notification

    def start_plugin
      super
      @listener = Killbill::HelloWorld::Initializer.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)
      if @listener.nil?
        logger.warn "HelloWorldPlugin wasn't started properly - check logs"
        return
      end
      @listener.update(event.account_id, event.tenant_id) if [:ACCOUNT_CREATION, :ACCOUNT_CHANGE].include?(event.event_type)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
killbill-helloworld-4.0.0 lib/helloworld.rb
killbill-helloworld-3.0.1 lib/helloworld.rb
killbill-helloworld-3.0.0 lib/helloworld.rb
killbill-helloworld-2.0.0 lib/helloworld.rb
killbill-helloworld-1.0.0 lib/helloworld.rb