importing stuff into qbox with tire
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tire.configure do | |
url QBOX_ENDPOINT | |
end | |
Tire.index(INDEX_NAME) do | |
delete_if_exists | |
create | |
end | |
json_filepaths.each do |filepath| | |
json = File.read(filepath) | |
emails = JSON.parse(json) | |
emails.map! do |email_hash| | |
email_hash.merge(type: 'email') | |
end | |
Tire.index(INDEX_NAME) do | |
import emails | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment