Sha256: 80a221cd5bbeba8ed079cb25e6d49cadb8ea15d860e62e6e44c6c0e7547a3a22

Contents?: true

Size: 923 Bytes

Versions: 2

Compression:

Stored size: 923 Bytes

Contents

module Workarea
  module Kount
    class Event
      def self.create(xml)
        name = xml.xpath('name').text

        case name
        when /^DMC_/           then DmcEvent.new(name, xml)
        when /^RISK_CHANGE_/   then RiskChangeEvent.new(name, xml)
        when /^WORKFLOW_/      then WorkflowEvent.new(name, xml)
        when /^SPECIAL_ALERT_/ then SpecialAlertEvent.new(name, xml)
        end
      end

      attr_reader :name, :xml

      def initialize(name, xml)
        @name = name
        @xml = xml
      end

      def key
        @key ||= xml.xpath('key').text
      end

      def old_value
        @old_value ||= xml.xpath('old_value').text
      end

      def new_value
        @new_value ||= xml.xpath('new_value').text
      end

      def agent
        @agent ||= xml.xpath('agent').text
      end

      def occurred
        @occurred ||= xml.xpath('occurred').text
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-kount-3.3.1 app/services/workarea/kount/event.rb
workarea-kount-3.3.0 app/services/workarea/kount/event.rb