summaryrefslogtreecommitdiff
path: root/lib/nickserver/request_handlers/invalid_email_handler.rb
blob: eaf8156000535ea06e38394c9b14e2e8f9319a04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'nickserver/email_address'
require 'nickserver/error_response'

module Nickserver
  module RequestHandlers
    class InvalidEmailHandler
      def call(request)
        return unless request.email
        email = EmailAddress.new(request.email)
        ErrorResponse.new("Not a valid address") if email.invalid?
      end

    end
  end
end