class Consummo::UrlResolver

Public Instance Methods

resolve(url) click to toggle source
# File lib/consummo/enrichers/url_resolver.rb, line 5
def resolve(url)
  return url if url.blank?
  begin
    response = HTTParty.get(url, follow_redirects: true)
    response.request.last_uri
  rescue Errno::ECONNREFUSED, URI::InvalidURIError, HTTParty::RedirectionTooDeep
    url
  end
end