lib/email_finder/email_resolver.rb
# Returns an index to the email pattern that is followed by the email samples
#  found in the Google searches.
Returns an index to the email pattern that is followed by the email samples
found in the Google searches.
Returns an index to the email pattern that is followed by the email samples found in the Google searches .
def pattern_index
      results = ::DistributedSearch::DistributedSearch.new.search(query)
      results['results'].each do |result|
        email = email_match(strip_html(result['content']))
        if email
          username, _domain = email.split('@')
          resolver = EmailPatternResolver.new(username)
          pattern  = resolver.pattern
          if pattern
            employee          = Employee.new(SAMPLE_FIRST_NAME, SAMPLE_LAST_NAME, SAMPLE_DOMAIN)
            resolved_username = EmailPatternResolver.name_for(SAMPLE_FIRST_NAME, SAMPLE_LAST_NAME, pattern)
            return employee.pattern_index_for(resolved_username)
          end
        end
      end
      nil
    end
def pattern_index results = :: DistributedSearch :: DistributedSearch . new . search ( query ) results [ 'results' ] . each do | result | email = email_match ( strip_html ( result [ 'content' ] ) ) if email username , _domain = email . split ( '@' ) resolver = EmailPatternResolver . new ( username ) pattern = resolver . pattern if pattern employee = Employee . new ( SAMPLE_FIRST_NAME , SAMPLE_LAST_NAME , SAMPLE_DOMAIN ) resolved_username = EmailPatternResolver . name_for ( SAMPLE_FIRST_NAME , SAMPLE_LAST_NAME , pattern ) return employee . pattern_index_for ( resolved_username ) end end end nil end
Returns an index to the email pattern that is followed by the email samples
found in the Google searches.
Returns an index to the email pattern that is followed by the email samples found in the Google searches .