-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[ | ||
{ | ||
"request": { | ||
"body": "{\"attachments\":[],\"bcc\":[],\"body_html\":\"Hi! My name is Karan and I'm your Account Manager.\",\"body_text\":\"Hi! My name is Karan and I'm your Account Manager.\",\"cc\":[],\"contact_id\":\"cont_gwto1MOgh8nNGpCVn5DFJkmMxZYY6oQbh8X9mS5uEXg\",\"created_by\":null,\"created_by_name\":\"Bruce Wayne\",\"date_created\":\"2013-02-01T00:54:51.274000+00:00\",\"direction\":\"outgoing\",\"lead_id\":\"lead_sA6s1qN2hh1eDHipGxVAKvFlWCEG4xglutTXVUgnNkn\",\"sender\":\"[email protected]\",\"status\":\"draft\",\"subject\":\"Welcome to Close!\",\"template_id\":null,\"to\":[\"[email protected]\"]}", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Accept": "application/json" | ||
}, | ||
"method": "post", | ||
"options": { | ||
"basic_auth": [ | ||
"FAKE_CLOSEIO_TOKEN", | ||
"" | ||
] | ||
}, | ||
"request_body": "", | ||
"url": "https://api.close.com/api/v1/activity/email/" | ||
}, | ||
"response": { | ||
"binary": false, | ||
"body": "{\"body_preview\": \"Hi! My name is Karan and I'm your Account Manager.\", \"attachments\": [], \"in_reply_to_id\": null, \"body_text\": \"Hi! My name is Karan and I'm your Account Manager.\", \"updated_by_name\": \"API User (DO NOT DELETE)\", \"template_name\": null, \"_type\": \"Email\", \"contact_id\": \"cont_gwto1MOgh8nNGpCVn5DFJkmMxZYY6oQbh8X9mS5uEXg\", \"thread_id\": \"acti_IfDYuF3eVQXH6tCg0p5nyn0tCfF3hZtLrSYpTnUdh5P\", \"references\": [], \"message_ids\": [], \"subject\": \"Welcome to Close!\", \"user_id\": \"user_CwSfS8J6DsD6tnAsUwNFKCpS7Tq9LVCgJvHapOcpWyW\", \"to\": [\"[email protected]\"], \"created_by\": \"user_CwSfS8J6DsD6tnAsUwNFKCpS7Tq9LVCgJvHapOcpWyW\", \"id\": \"acti_GTPmezSVx2Gb0vDSJyB4zKDHKFXv4YXJfgD4UlQL1O5\", \"date_updated\": \"2020-04-15T16:22:22.287000+00:00\", \"followup_sequence_id\": null, \"send_attempts\": [], \"created_by_name\": \"API User (DO NOT DELETE)\", \"user_name\": \"API User (DO NOT DELETE)\", \"opens\": [], \"status\": \"draft\", \"direction\": \"outgoing\", \"updated_by\": \"user_CwSfS8J6DsD6tnAsUwNFKCpS7Tq9LVCgJvHapOcpWyW\", \"sequence_name\": null, \"body_html_quoted\": [{\"html\": \"Hi! My name is Karan and I'm your Account Manager.\", \"expand\": true}], \"envelope\": {\"is_autoreply\": false, \"from\": [{\"email\": \"[email protected]\", \"name\": \"\"}], \"sender\": [{\"email\": \"[email protected]\", \"name\": \"\"}], \"cc\": [], \"bcc\": [], \"to\": [{\"email\": \"[email protected]\", \"name\": \"\"}], \"date\": \"Fri, 01 Feb 2013 00:54:51 -0000\", \"reply_to\": [], \"in_reply_to\": null, \"message_id\": null, \"subject\": \"Welcome to Close!\"}, \"body_html\": \"Hi! My name is Karan and I'm your Account Manager.\", \"organization_id\": \"orga_CC25dsMNG4KsRpxn2LEwPUVyGRs4poLYFIBsioIK4Oj\", \"sequence_id\": null, \"sequence_subscription_id\": null, \"users\": [], \"need_smtp_credentials\": false, \"body_text_quoted\": [{\"text\": \"Hi! My name is Karan and I'm your Account Manager.\", \"expand\": true}], \"cc\": [], \"lead_id\": \"lead_sA6s1qN2hh1eDHipGxVAKvFlWCEG4xglutTXVUgnNkn\", \"has_reply\": false, \"sender\": \"[email protected]\", \"bcc\": [], \"email_account_id\": null, \"date_sent\": null, \"date_created\": \"2013-02-01T00:54:51.274000+00:00\", \"date_scheduled\": null, \"opens_summary\": null, \"template_id\": null, \"bulk_email_action_id\": null, \"followup_sequence_delay\": null}", | ||
"headers": { | ||
"Content-Type": "application/json", | ||
"Date": "Wed, 15 Apr 2020 16:22:22 GMT", | ||
"Referrer-Policy": "no-referrer-when-downgrade", | ||
"Set-Cookie": "session=; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/", | ||
"Strict-Transport-Security": "max-age=31556926; includeSubDomains", | ||
"Vary": "Accept", | ||
"X-Content-Type-Options": "nosniff", | ||
"X-Frame-Options": "SAMEORIGIN", | ||
"X-Rate-Limit-Limit": "320", | ||
"X-Rate-Limit-Remaining": "319", | ||
"X-Rate-Limit-Reset": "7.789782", | ||
"X-XSS-Protection": "1; mode=block", | ||
"Content-Length": "2186", | ||
"Connection": "keep-alive" | ||
}, | ||
"status_code": 200, | ||
"type": "ok" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1027,6 +1027,86 @@ defmodule Closex.HTTPClientTest do | |
end | ||
end | ||
|
||
describe "create_email_activity/1" do | ||
test "creates an email activity" do | ||
test_email = %{ | ||
contact_id: "cont_gwto1MOgh8nNGpCVn5DFJkmMxZYY6oQbh8X9mS5uEXg", | ||
lead_id: "lead_sA6s1qN2hh1eDHipGxVAKvFlWCEG4xglutTXVUgnNkn", | ||
direction: "outgoing", | ||
created_by: nil, | ||
created_by_name: "Bruce Wayne", | ||
date_created: "2013-02-01T00:54:51.274000+00:00", | ||
subject: "Welcome to Close!", | ||
sender: "[email protected]", | ||
to: [ | ||
"[email protected]" | ||
], | ||
bcc: [], | ||
cc: [], | ||
status: "draft", | ||
body_text: "Hi! My name is Karan and I'm your Account Manager.", | ||
body_html: "Hi! My name is Karan and I'm your Account Manager.", | ||
attachments: [], | ||
template_id: nil | ||
} | ||
|
||
use_cassette "create_email_activity" do | ||
{:ok, body} = create_email_activity(test_email) | ||
|
||
assert Map.keys(body) == [ | ||
"_type", | ||
"sender", | ||
"users", | ||
"body_text", | ||
"organization_id", | ||
"bcc", | ||
"body_html_quoted", | ||
"created_by", | ||
"created_by_name", | ||
"id", | ||
"date_sent", | ||
"date_created", | ||
"template_id", | ||
"opens_summary", | ||
"user_id", | ||
"cc", | ||
"body_text_quoted", | ||
"date_updated", | ||
"need_smtp_credentials", | ||
"template_name", | ||
"updated_by", | ||
"status", | ||
"message_ids", | ||
"thread_id", | ||
"sequence_subscription_id", | ||
"send_attempts", | ||
"contact_id", | ||
"sequence_id", | ||
"in_reply_to_id", | ||
"opens", | ||
"followup_sequence_id", | ||
"attachments", | ||
"envelope", | ||
"updated_by_name", | ||
"followup_sequence_delay", | ||
"has_reply", | ||
"lead_id", | ||
"references", | ||
"direction", | ||
"bulk_email_action_id", | ||
"body_preview", | ||
"date_scheduled", | ||
"to", | ||
"email_account_id", | ||
"user_name", | ||
"subject", | ||
"sequence_name", | ||
"body_html" | ||
] | ||
end | ||
end | ||
end | ||
|
||
describe "find_call_activities/1" do | ||
test "returns a list of call activities" do | ||
search_term = "lead_id=lead_ZNjVC99F8sKnz4FWKKCBxIsamaEsasV7kN8aoZCl5zM" | ||
|