public function testListsGetAll() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); Lists::setFetchOptions(["_ids" => "53ae0c09e4b0f0eb6bc57ecd"]); $lists = Lists::fetchPage(); $this->assertNotNull($lists); }
public function testAccountSaveCreate() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); $account = new Account(['name' => 'Account Created']); $res = $account->save(); $this->assertInstanceOf('Account', $res); $this->assertEquals('Account Created', $res->name()); }
public function testUsers() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); $data = ['id' => '538530d2e4b00530d85ae1bf', 'name' => 'Juan Perez', 'email' => '*****@*****.**']; $other = new User(['data' => $data]); $this->assertInstanceOf('User', $other); $this->assertEquals($data['id'], $other->id()); $this->assertEquals($data['name'], $other->name()); $this->assertEquals($data['email'], $other->email()); }
public function testEvent() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); $event = new Events([]); $event->subject("Support Ticket #12345: How do I create an event?"); $event->body("Just called Tim and walked him through how to create an event with the new API.\n He'll reach out to support@relateiq.com with any questions he might have.\n Resolving.\n - James"); $participantIds = [["type" => "email", "value" => "*****@*****.**"], ["type" => "email", "value" => "*****@*****.**"], ["type" => "phone", "value" => "8001235555"]]; $event->participantIds($participantIds); $res = $event->update(); $this->assertInstanceOf('Events', $res); }
public function testListitemDelete() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); $data = ["id" => "53ae0c09e4b0f0eb6bc57ecd"]; $listObj = new Lists($data); $this->assertNotNull($listObj->id()); //Creating ListItems... $account = new Account([]); $contact = new Contact(["id" => "53b4b4cce4b0e6c80c5fca0c"]); $listItem = new ListItems(["parent" => $listObj]); $listItem->accountId($account->id()); $listItem->contactIds($contact->id()); $listItem->name("MASH Realtors"); $listItem->fieldValues(["0" => "5", "2" => "0"]); $res = $listItem->create(); $this->assertNotNull($res->id()); $idList = $res->id(); //Deleting ListItems... $listItem = $listObj->ListItem($idList); $res = $listItem->delete(); $this->assertEquals(true, $res); }
public function testContactLimit() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); $testLimit = 1; Contact::setPageSize($testLimit); $this->assertEquals($testLimit, Contact::getPageSize()); $contacts = Contact::fetchByIds(["54ee0ed6e4b08099b9917451"]); $this->assertNotNull($contacts["54ee0ed6e4b08099b9917451"]->id()); $this->assertNotNull($contacts["54ee0ed6e4b08099b9917451"]->name()); $contacts2 = Contact::fetchByIds([]); $this->assertEquals([], $contacts2); }
public function testPutEvent() { Client::relateIQ(GlobalVar::KEY, GlobalVar::SECRET); Client::endpoint('https://api.relateiq.com/v2/events'); Client::headers(["Content-type" => "application/json", "Accept" => "application/json"]); $data = ["subject" => "Support Ticket #12345: How do I create an event?", "body" => "Just called Tim and walked him through how to create an event with the new API.\n-James.", "participantIds" => [["type" => "email", "value" => "*****@*****.**"], ["type" => "email", "value" => "*****@*****.**"], ["type" => "phone", "value" => "8001235555"]]]; $res = Client::put('', $data, []); $this->assertEquals(204, $res->code); }