Sha256: 38fa59d745c5f89afd44e88a874fa41c0205ec3e444a816642133745ea5cdc70

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

require 'omnihooks'
require 'active_support/core_ext/hash/conversions'
require "active_support/core_ext/hash/indifferent_access"
require 'active_support/core_ext/object/blank'

module OmniHooks
  module Strategies
    class CoreWarehouse
      include OmniHooks::Strategy
      option :name, 'core-warehouse'

      event do
        owner = request.params['owner']
        raise ArgumentError.new "Query parameter 'owner' must be included" if owner.blank?
        ActiveSupport::HashWithIndifferentAccess.new({ 
          owner: owner,
          event: raw_info 
        })
      end

      event_type do
        raw_info.keys.first
      end

      private

      def raw_info
        @raw_info ||= Hash.from_xml(request.body)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omnihooks-core-warehouse-0.1.0 lib/omnihooks/strategies/core_warehouse.rb