Module: Helpers

Defined in:
lib/phishtank/helpers.rb

Instance Method Summary collapse

Instance Method Details

#handle_url(url) ⇒ Object

Phishtank requires a full url. This function patches a domain lookup with a scheme



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/phishtank/helpers.rb', line 6

def handle_url(url)
  if url.index('http').nil?
    url = 'http://' + url
  end
  begin
    URI.parse(url)
  rescue URI::BadURIError
    raise Exception.new('Bad URL. Please pass a valid URL.')
  end
  url
end