From f8c60502526f55ff2fe6cd52d86d8d2aae4ff892 Mon Sep 17 00:00:00 2001 From: Tomas Valent Date: Wed, 17 Nov 2021 14:52:26 +0100 Subject: [PATCH] Delete secondary email --- lib/hubspot/contact.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/hubspot/contact.rb b/lib/hubspot/contact.rb index 7101c048..bab992f1 100644 --- a/lib/hubspot/contact.rb +++ b/lib/hubspot/contact.rb @@ -12,6 +12,8 @@ class Hubspot::Contact < Hubspot::Resource MERGE_PATH = '/contacts/v1/contact/merge-vids/:id/' SEARCH_PATH = '/contacts/v1/search/query' UPDATE_PATH = '/contacts/v1/contact/vid/:id/profile' + DELETE_SECONDARY_EMAIL_PATH = + '/contacts/v1/secondary-email/:id/email/:email' class << self def all(opts = {}) @@ -79,4 +81,10 @@ def name def merge(contact) self.class.merge(@id, contact.to_i) end + + def delete_secondary_email(secondary_email) + raise(Hubspot::InvalidParams.new("Resource must have an ID")) if @id.nil? + Hubspot::Connection.delete_json(DELETE_SECONDARY_EMAIL_PATH, id: @id, email: secondary_email) + true + end end