Sha256: c195fcf50b88efb0503ec1d4f05f3464f84a0c801fd706198dfb8bab1e4902b0

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

module Spanx
  module Notifier
    class Base

      # Takes an instance of the Spanx::BlockedIp struct.
      # Overwrite this a subclass to define real behavior
      def publish(blocked_ip)
        raise 'Abstract Method Not Implemented'
      end

      protected

        def generate_block_ip_message(blocked_ip)
          violated_period = blocked_ip.period_check
          "#{blocked_ip.identifier} blocked @ #{Time.at(blocked_ip.timestamp)} " \
            "for #{violated_period.block_ttl/60}mins, for #{blocked_ip.sum} requests over " \
            "#{violated_period.period_seconds/60}mins, with #{violated_period.max_allowed} allowed."
        end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spanx-0.3.0 lib/spanx/notifier/base.rb
spanx-0.1.1 lib/spanx/notifier/base.rb
spanx-0.1.0 lib/spanx/notifier/base.rb