Class: Intercom::Service::Contact
Instance Attribute Summary
Attributes inherited from BaseService
#client
Instance Method Summary
collapse
#search
#delete
#create, #identity_hash, #save
#find
#all
#load
Methods inherited from BaseService
#collection_name, #from_api, #initialize
Instance Method Details
#archive(contact) ⇒ Object
36
37
38
39
|
# File 'lib/intercom/service/contact.rb', line 36
def archive(contact)
@client.post("/#{collection_name}/#{contact.id}/archive", {})
contact
end
|
#collection_class ⇒ Object
19
20
21
|
# File 'lib/intercom/service/contact.rb', line 19
def collection_class
Intercom::Contact
end
|
#collection_proxy_class ⇒ Object
46
47
48
|
# File 'lib/intercom/service/contact.rb', line 46
def delete_archived_contact(id)
@client.delete("/#{collection_name}/#{id}", {})
end
|
#merge(lead, user) ⇒ Object
27
28
29
30
31
32
33
34
|
# 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) ⇒ Object
41
42
43
44
|
# File 'lib/intercom/service/contact.rb', line 41
def unarchive(contact)
@client.post("/#{collection_name}/#{contact.id}/unarchive", {})
contact
end
|