Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/hubspot/contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down Expand Up @@ -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