Ensure Mailbluster helper methods actually correctly cause changes in the end service

This commit is contained in:
CactusPuppy 2021-03-17 15:20:01 -07:00
parent c78b151390
commit af06589230
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82

View file

@ -11,8 +11,10 @@ module External
def create_lead(user)
uri = URI(MAILBLUSTER_URL)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri.path,
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
request['Content-Type'] = 'application/json'
request.body = {
'email' => user.email,
'firstName' => user.name,
@ -31,8 +33,10 @@ module External
email_hash = Digest::MD5.hexdigest user.email
uri = URI(MAILBLUSTER_URL + email_hash)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(uri.path,
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
request['Content-Type'] = 'application/json'
response = http.request(request)
response.body
rescue StandardError => e