Skip to content

Instantly share code, notes, and snippets.

Created January 29, 2015 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/38eafd897b5690e1b182 to your computer and use it in GitHub Desktop.
Save anonymous/38eafd897b5690e1b182 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require "mysql"
require "pry"
require 'net/https'
require 'net/http'
begin
con = Mysql.new '10.0.3.18', 'devuser', 'password', 'dev'
rs = con.query("
SELECT
estimable_id
FROM
estimates
WHERE
estimates.responded_when IS null
AND final_email_reminder_date LIKE curdate()
AND final_reminder_sent = 0 ")
rs.each do |row|
eid = row[0]
#puts row.join("\s")
puts eid
uri = URI.parse('https://dev.website.com/scheduled_task/mailer/send_rfp_final_reminder/')
https = Net::HTTP.new(uri.host, uri.port)
#https.use_ssl = true
https.set_form_data = ({'security_token' => 'sldf43535kj@#@#hsdfkh', 'estimate_id' => 'eid'})
res = https.post(uri.path, params)
puts res
end
rescue Mysql::Error => e
puts e.errno
puts e.error
ensure
con.close if con
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment