public function getSharedAgencies(array $fields = array(), array $params = array(), $pending = false) { $this->assureId(); $param_types = array(); $enums = array(); $request = new ApiRequest($this->api, $this->data['id'], RequestInterface::METHOD_GET, '/shared_agencies', new Business(), 'EDGE', Business::getFieldsEnum()->getValues(), new TypeChecker($param_types, $enums)); $request->addParams($params); $request->addFields($fields); return $pending ? $request : $request->execute(); }
/** * @param array $fields * @param array $params * @return Cursor */ public function getAgencies(array $fields = array(), array $params = array()) { return $this->getManyByConnection(Business::className(), $fields, $params, 'shared_agencies'); }
/** * @depends testCreate */ public function testShareWithAgency() { $this->skipIf('no_business_manager'); if (!$this->getConfig()->secondaryAccountId) { $this->markTestSkipped('No secondary business provided in config'); } $pixel = $this->getAccountPixel(); $business = new Business($this->getConfig()->businessId); $cursor = $business->getAgencies(); $cursor->setUseImplicitFetch(true); $agency_id = null; foreach ($cursor as $agency) { if ($agency->{AbstractCrudObject::FIELD_ID} == $this->getConfig()->secondaryBusinessId) { $agency_id = $agency->{AbstractCrudObject::FIELD_ID}; } } if ($agency_id === null) { $this->markTestSkipped("Secondary business is not a valid agency"); } $pixel->sharePixelWithAgency($this->getConfig()->businessId, $this->getConfig()->secondaryBusinessId); $pixel->unsharePixelWithAgency($this->getConfig()->businessId, $this->getConfig()->secondaryBusinessId); }