Sha256: 16a12517a3dd5d689735daf7a2d70f7b6e4a33d400f923e53301f7c9a3f5f149

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

module Ebanx
  module Command
    class Command
      attr_accessor :params, :request_method, :request_action, :response_type

      def valid?
        validate
      end

      protected
      def validate
        raise NotImplementedError
      end

      def validate_presence(name)
        raise ArgumentError unless @params.include? name
        true
      end

      def validate_presence_or(name1, name2)
        unless @params.include?(name1) || @params.include?(name2)
          raise ArgumentError
        end

        true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ebanx-0.1.0 lib/ebanx/command/command.rb