Method: LoopsRails::Contacts#delete

Defined in:
lib/loops_rails/client/contacts.rb

#delete(email: nil, user_id: nil) ⇒ Object

Raises:

  • (ArgumentError)


35
36
37
38
39
40
41
42
43
44
45
# File 'lib/loops_rails/client/contacts.rb', line 35

def delete(email: nil, user_id: nil)
  raise ArgumentError, "Either email or user_id must be provided" if email.nil? && user_id.nil?

  payload = { email: email, userId: user_id }.compact

  response = @conn.post("contacts/delete") do |req|
    req.body = payload.to_json
  end

  parse_response(response)
end