Ensure Mailbluster helper methods actually correctly cause changes in the end service
This commit is contained in:
parent
0f6881414b
commit
803c98b158
1 changed files with 4 additions and 0 deletions
4
app/helpers/external/mailbluster_helper.rb
vendored
4
app/helpers/external/mailbluster_helper.rb
vendored
|
|
@ -11,8 +11,10 @@ module External
|
||||||
def create_lead(user)
|
def create_lead(user)
|
||||||
uri = URI(MAILBLUSTER_URL)
|
uri = URI(MAILBLUSTER_URL)
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
|
http.use_ssl = true
|
||||||
request = Net::HTTP::Post.new(uri.path,
|
request = Net::HTTP::Post.new(uri.path,
|
||||||
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
|
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
|
||||||
|
request['Content-Type'] = 'application/json'
|
||||||
request.body = {
|
request.body = {
|
||||||
'email' => user.email,
|
'email' => user.email,
|
||||||
'firstName' => user.name,
|
'firstName' => user.name,
|
||||||
|
|
@ -31,8 +33,10 @@ module External
|
||||||
email_hash = Digest::MD5.hexdigest user.email
|
email_hash = Digest::MD5.hexdigest user.email
|
||||||
uri = URI(MAILBLUSTER_URL + email_hash)
|
uri = URI(MAILBLUSTER_URL + email_hash)
|
||||||
http = Net::HTTP.new(uri.host, uri.port)
|
http = Net::HTTP.new(uri.host, uri.port)
|
||||||
|
http.use_ssl = true
|
||||||
request = Net::HTTP::Delete.new(uri.path,
|
request = Net::HTTP::Delete.new(uri.path,
|
||||||
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
|
'Authorization' => ENV['MAILBLUSTER_API_KEY'])
|
||||||
|
request['Content-Type'] = 'application/json'
|
||||||
response = http.request(request)
|
response = http.request(request)
|
||||||
response.body
|
response.body
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue