class Intercom::Service::Contact

Public Instance Methods

archive(contact) click to toggle source
# File lib/intercom/service/contact.rb, line 36
def archive(contact)
  @client.post("/#{collection_name}/#{contact.id}/archive", {})
  contact
end
collection_class() click to toggle source
# File lib/intercom/service/contact.rb, line 19
def collection_class
  Intercom::Contact
end
collection_proxy_class() click to toggle source
# File lib/intercom/service/contact.rb, line 23
def collection_proxy_class
  Intercom::BaseCollectionProxy
end
delete_archived_contact(id) click to toggle source
# File lib/intercom/service/contact.rb, line 46
def delete_archived_contact(id)
  @client.delete("/#{collection_name}/#{id}", {})
end
merge(lead, user) click to toggle source
# File lib/intercom/service/contact.rb, line 27
def merge(lead, user)
  raise_invalid_merge_error unless lead.role == 'lead' && user.role == 'user'

  response = @client.post('/contacts/merge', from: lead.id, into: user.id)
  raise Intercom::HttpError, 'Http Error - No response entity returned' unless response

  user.from_response(response)
end
unarchive(contact) click to toggle source
# File lib/intercom/service/contact.rb, line 41
def unarchive(contact)
  @client.post("/#{collection_name}/#{contact.id}/unarchive", {})
  contact
end

Private Instance Methods

raise_invalid_merge_error() click to toggle source
# File lib/intercom/service/contact.rb, line 50
        def raise_invalid_merge_error
  raise Intercom::InvalidMergeError, 'Merging can only be performed on a lead into a user'
end