public function testCrudAccess() { $prediction = new ReachFrequencyPrediction(null, $this->getActId()); $targeting = array('geo_locations' => array('countries' => array('US')), 'age_max' => 35, 'age_min' => 20, 'genders' => array('2'), 'page_types' => array('feed')); $prediction->setData(array(RF::BURGET => 3000000, RF::TARGET_SPECS => array($targeting), RF::START_TIME => strtotime('midnight + 2 weeks'), RF::END_TIME => strtotime('midnight + 3 weeks'), RF::FREQUENCY_CAP => 4, RF::DESTINATION_ID => $this->getPageId(), RF::PREDICTION_MODE => ReachFrequencyPrediction::PREDICTION_MODE_REACH, RF::OBJECTIVE => AdObjectives::POST_ENGAGEMENT)); $this->assertCanCreate($prediction); $this->assertCanDelete($prediction); }
public function testCrudAccess() { $prediction = new ReachFrequencyPrediction(null, $this->getConfig()->accountId); $targeting = new TargetingSpecs(); $targeting->{TargetingSpecsFields::GEO_LOCATIONS} = array('countries' => array('US')); $targeting->{TargetingSpecsFields::AGE_MAX} = 35; $targeting->{TargetingSpecsFields::AGE_MIN} = 20; $targeting->{TargetingSpecsFields::GENDERS} = array(2); $targeting->{TargetingSpecsFields::PAGE_TYPES} = array(PageTypes::DESKTOP_FEED); $prediction->setData(array(RF::BUDGET => 3000000, RF::TARGET_SPEC => $targeting, RF::START_TIME => strtotime('midnight + 2 weeks'), RF::END_TIME => strtotime('midnight + 3 weeks'), RF::FREQUENCY_CAP => 4, RF::DESTINATION_ID => $this->getConfig()->pageId, RF::PREDICTION_MODE => ReachFrequencyPrediction::PREDICTION_MODE_REACH, RF::OBJECTIVE => AdObjectives::POST_ENGAGEMENT, RF::STORY_EVENT_TYPE => 128)); $this->assertCanCreate($prediction); $this->assertCanDelete($prediction); }
public function getSelf(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, '/', new ReachFrequencyPrediction(), 'NODE', ReachFrequencyPrediction::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 getReachFrequencyPredictions(array $fields = array(), array $params = array()) { return $this->getManyByConnection(ReachFrequencyPrediction::className(), $fields, $params); }
public function createReachFrequencyPrediction(array $fields = array(), array $params = array(), $pending = false) { $this->assureId(); $param_types = array('budget' => 'unsigned int', 'campaign_group_id' => 'string', 'destination_id' => 'unsigned int', 'destination_ids' => 'list<string>', 'end_time' => 'unsigned int', 'frequency_cap' => 'unsigned int', 'interval_frequency_cap_reset_period' => 'unsigned int', 'num_curve_points' => 'unsigned int', 'objective' => 'string', 'prediction_mode' => 'unsigned int', 'reach' => 'unsigned int', 'rf_prediction_id_to_share' => 'string', 'start_time' => 'unsigned int', 'stop_time' => 'unsigned int', 'story_event_type' => 'unsigned int', 'target_spec' => 'Targeting'); $enums = array(); $request = new ApiRequest($this->api, $this->data['id'], RequestInterface::METHOD_POST, '/reachfrequencypredictions', new ReachFrequencyPrediction(), 'EDGE', ReachFrequencyPrediction::getFieldsEnum()->getValues(), new TypeChecker($param_types, $enums)); $request->addParams($params); $request->addFields($fields); return $pending ? $request : $request->execute(); }
public function getGrpPlans(array $fields = array(), array $params = array(), $pending = false) { $this->assureId(); $param_types = array('status' => 'status_enum'); $enums = array('status_enum' => ReachFrequencyPredictionStatusValues::getInstance()->getValues()); $request = new ApiRequest($this->api, $this->data['id'], RequestInterface::METHOD_GET, '/grp_plans', new ReachFrequencyPrediction(), 'EDGE', ReachFrequencyPrediction::getFieldsEnum()->getValues(), new TypeChecker($param_types, $enums)); $request->addParams($params); $request->addFields($fields); return $pending ? $request : $request->execute(); }