Rubocop linting issues fixed
This commit is contained in:
parent
2e3cdad0bc
commit
dd2b229761
1 changed files with 15 additions and 18 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class MailblusterManager
|
||||
include HTTParty
|
||||
base_uri 'https://api.mailbluster.com/api/leads/'
|
||||
@@auth_headers = {
|
||||
@auth_headers = {
|
||||
headers: {
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => ENV['MAILBLUSTER_API_KEY']
|
||||
|
|
@ -9,31 +9,28 @@ class MailblusterManager
|
|||
}
|
||||
|
||||
def self.query_api(method, path, body)
|
||||
#TODO
|
||||
options = @@auth_headers.merge({
|
||||
body: body.to_json
|
||||
})
|
||||
options = @auth_headers.merge(body: body.to_json)
|
||||
send(method, path, options).parsed_response
|
||||
end
|
||||
|
||||
def self.create_lead(user)
|
||||
query_api(:post, '/', {
|
||||
'email' => user.email,
|
||||
'firstName' => user.name,
|
||||
'overrideExisting' => true,
|
||||
'subscribed' => true,
|
||||
'tags' => [ENV['OSEM_NAME'] || 'snapcon']
|
||||
})
|
||||
query_api(:post, '/',
|
||||
'email' => user.email,
|
||||
'firstName' => user.name,
|
||||
'overrideExisting' => true,
|
||||
'subscribed' => true,
|
||||
'tags' => [ENV['OSEM_NAME'] || 'snapcon']
|
||||
)
|
||||
end
|
||||
|
||||
def self.edit_lead(user, add_tags: [], remove_tags: [], old_email: nil)
|
||||
email_hash = Digest::MD5.hexdigest(old_email.presence || user.email)
|
||||
query_api(:put, "/#{email_hash}", {
|
||||
'email' => user.email,
|
||||
'firstName' => user.name,
|
||||
'addTags' => add_tags,
|
||||
'removeTags' => remove_tags
|
||||
})
|
||||
query_api(:put, "/#{email_hash}",
|
||||
'email' => user.email,
|
||||
'firstName' => user.name,
|
||||
'addTags' => add_tags,
|
||||
'removeTags' => remove_tags
|
||||
)
|
||||
end
|
||||
|
||||
def self.delete_lead(user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue