Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.54 KB | None | 0 0
  1. require 'csv'
  2. require 'pry'
  3. require_relative 'searchers'
  4.  
  5. count = 0
  6. searcher = ColoradoSearcher.new
  7. source_file = File.join(__dir__, "csv/source.csv")
  8. target_file = File.join(__dir__, "csv/results.csv")
  9.  
  10. # Match
  11. CSV.open(target_file, "w") do |csv|
  12.   csv << ["id", "phone"]
  13.   CSV.foreach(source_file, headers: true) do |row|
  14.     license_number = row["PROVIDER ID"]
  15.     phone = searcher.search_by_license(license_number)
  16.     count += 1
  17.     puts "##{count}: #{license_number} => #{phone}"
  18.     csv << [license_number, phone]
  19.   end
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement