Exemplo n.º 1
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php users.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
print "Finding my user...\n";
$user = $hr->findMe();
print_r($user);
print "Finding all users...\n";
$users = $hr->findAllUsers();
print_r($users);
Exemplo n.º 2
0
<?php

include "config.php";
include "pdo.class.php";
$pdo = Db::singleton();
require_once "Services/HighriseAPI.class.php";
$highrise = new HighriseAPI();
$highrise->debug = false;
$highrise->setAccount($highrise_account);
$highrise->setToken($highrise_apikey);
$people = $highrise->findPeopleBySearchCriteria(array('phone' => $_REQUEST['From']));
if (count($people)) {
    $p = $people[0];
    $name = $p->getFirstName() . ' ' . $p->getLastName();
    $now = time();
    $sql = "INSERT INTO calls SET caller_name='{$name}',caller='{$_REQUEST['From']}', call_time='{$now}'";
    $pdo->exec($sql);
} else {
    $now = time();
    $sql = "INSERT INTO calls SET caller='{$_REQUEST['From']}', call_time='{$now}'";
    $pdo->exec($sql);
}
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<Response>
	<Gather action="input.php" numDigits="1">
		<Say>Welcome to my pretend company.</Say>
		<Say>For store hours, press 1.</Say>
		<Say>For directions, press 2</Say>
		<Say>To speak to an agent, press 3.</Say>
Exemplo n.º 3
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php emails.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
$people = $hr->findPeopleBySearchTerm("Person Test");
$person = $people[0];
$emails = $person->getEmails();
foreach ($emails as $email) {
    print_r($email);
    print $email->toXML();
}
print $person->getId();
// Create new note
$new_email = new HighriseEmail($hr);
$new_email->debug = false;
$new_email->setSubjectType("Party");
$new_email->setSubjectId($person->getId());
$new_email->setTitle("Test Email");
$new_email->setBody("Test");
$new_email->save();
print "New email ID: " . $new_email->getId() . " Created at: " . $new_email->getCreatedAt() . "\n";
print "Updating email...";
$new_email->setBody("Testi");
$new_email->setTitle("Test Title");
$new_email->save();
Exemplo n.º 4
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php tags.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
$people = $hr->findPeopleBySearchTerm("Tag Tagger");
foreach ($people as $p) {
    $p->delete();
}
print "Adding a new person...\n";
$person = new HighrisePerson($hr);
$person->setFirstName("Tag");
$person->setLastName("Tagger");
$person->setVisibleTo("Owner");
$person->addTag("tag-1");
$person->addTag("tag-2");
$person->addTag("tag-300");
$person->save();
print "Saved Person:\n";
print_r($person);
print "Adding another tag...\n";
$person->addTag("tag-444");
$person->save();
print "Find People named Tag Tagger:\n";
$people = $hr->findPeopleBySearchTerm("Tag Tagger");
print_r($people);
Exemplo n.º 5
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php tasks.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
print "Creating Task...\n";
$task = new HighriseTask($hr);
$task->setBody("Task Body");
$task->setPublic(false);
$task->setFrame("Tomorrow");
$task->save();
print "Updating Task...\n";
$task->setBody("Task Body2");
$task->setPublic(true);
$task->save();
print "Creating Task...\n";
$task = new HighriseTask($hr);
$task->setBody("This will be completed");
$task->setFrame("today");
$task->save();
print "Completing Task ID: " . $task->getId() . "\n";
$task->complete();
print_r($task);
print "Finding Completed Tasks...\n";
$completed_tasks = $hr->findCompletedTasks();
foreach ($completed_tasks as $completed_task) {
Exemplo n.º 6
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php notes.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
$people = $hr->findPeopleBySearchTerm("Person Test");
$person = $people[0];
$notes = $person->getNotes();
foreach ($notes as $note) {
    print_r($note);
    print $note->toXML();
}
// Create new note
$new_note = new HighriseNote($hr);
$new_note->setSubjectType("Party");
$new_note->setSubjectId($person->getId());
$new_note->setBody("Test");
$new_note->save();
print "New note ID: " . $new_note->getId() . " Created at: " . $new_note->getCreatedAt() . "\n";
print "Updating note...";
$new_note->setBody("Testi");
$new_note->save();
$find_new_note = $hr->findNoteByID($new_note->id);
if ($find_new_note->getBody() != $new_note->getBody()) {
    throw new Exception("Retrieving a note by ID failed");
}
Exemplo n.º 7
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php HighriseAPI.test.php [account-name] [access-token]\n");
}
$hr = new HighriseAPI();
$hr->debug = false;
$hr->setAccount($argv[1]);
$hr->setToken($argv[2]);
$people = $hr->findAllPeople();
print_r($people);
foreach ($people as $person) {
    foreach ($person->phone_numbers as $number) {
        print $number . "\n";
    }
}
// Add a new person
// TODO: Add Address
$new_person = new HighrisePerson($hr);
$new_person->setFirstName("John Test");
$new_person->setLastName("Doe");
$new_person->setTitle("Nowhere Man");
$new_person->setBackground("Some background here");
$new_person->setCompanyName("Test Corp");
$new_person->addEmailAddress("*****@*****.**");
$new_person->addEmailAddress("*****@*****.**", "work");
$new_person->addPhoneNumber("+1 555-555-5555", "Work");
$new_person->addPhoneNumber("+1 555-555-1111", "Home");
$new_person->addTwitterAccount("johndoe");
$new_person->addTwitterAccount("johndoework", "Business");
Exemplo n.º 8
0
<?php

require_once "../lib/HighriseAPI.class.php";
if (count($argv) != 3) {
    die("Usage: php tags.test.php [account-name] [access-token]\n");
}
$highrise = new HighriseAPI();
$highrise->debug = false;
$highrise->setAccount($argv[1]);
$highrise->setToken($argv[2]);
$people = $highrise->findPeopleBySearchTerm("Personality Changer");
foreach ($people as $p) {
    $p->delete();
}
$person = new HighrisePerson($highrise);
$person->setFirstName("Personality");
$person->setLastName("Changer");
$person->addEmailAddress("*****@*****.**");
$person->save();
print "Person ID is: " . $person->getId() . "\n";
$person->addEmailAddress("*****@*****.**");
$person->save();
print "Person ID after save is: " . $person->getId() . "\n";
print_r($person);
$people = $highrise->findPeopleBySearchTerm("Personality Changer");
print_r($people);
$person->delete();