/** * Parses response from CURL * @param array apiResponse response from curl * @return void */ protected function parseResponse($apiResponse) { parent::parseResponse($apiResponse); //assign metadata specific to this call $this->diffStart = $apiResponse['diffsmeta']['start']; $this->diffEnd = $apiResponse['diffsmeta']['end']; $this->duration = $apiResponse['diffsmeta']['end'] - $apiResponse['diffsmeta']['start']; }
protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); //set factual ID if ($rootJSON['response']['included_rows'] == 1) { $this->factualID = $rootJSON['response']['data'][0]['factual_id']; } return $rootJSON; }
/** * Parses JSON as array and assigns object values * @param string json JSON returned from API * @return array structured JSON */ protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); $this->title = $rootJSON['response']['view']['title']; $this->description = $rootJSON['response']['view']['description']; $this->makeColumnSchemas($rootJSON['response']['view']['fields']); $this->searchEnabled = (bool) $rootJSON['response']['view']['search_enabled']; $this->geoEnabled = (bool) $rootJSON['response']['view']['geo_enabled']; return $rootJSON; }
/** * Parses JSON as array and assigns object values * @param string json JSON returned from API * @return array structured JSON */ protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); $this->commitID = $rootJSON['response']['commit_id']; if (isset($this->newEntity)) { $this->newEntity = (bool) $rootJSON['response']['new_entity']; } if (isset($rootJSON['response']['factual_id'])) { $this->factualID = $rootJSON['response']['factual_id']; } return $rootJSON; }
/** * Parses JSON as array and assigns object values * @param string json JSON returned from API * @return array structured JSON */ protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); //assign total row count if (isset($rootJSON['response']['total_row_count'])) { $this->totalRowCount = $rootJSON['response']['total_row_count']; } if (isset($rootJSON['response']['included_rows'])) { $this->includedRows = $rootJSON['response']['included_rows']; } //assign data $this->assignData($rootJSON['response']['data']); return $rootJSON; }
protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); //Check against rowcount and resolve flag if ($rootJSON['response']['included_rows'] == 1 || $rootJSON['response']['included_rows'] > 1) { if ($rootJSON['response']['data'][0]['resolved']) { $this->resolved = $rootJSON['response']['data'][0]; unset($this->resolved['resolved']); //remove old flag } } $this->data = $rootJSON['response']['data']; return $rootJSON; }
/** * Parses JSON as array and assigns object values * @param string json JSON returned from API * @return array structured JSON */ protected function parseJSON($json) { $rootJSON = parent::parseJSON($json); //in some instances writes to the system will be delayed, and we cannot provide a committ ID if (array_key_exists('error_type', $rootJSON) && $rootJSON['error_type'] == "DelayedResponse") { //throw new Exception($rootJSON['message']); $this->isDelayed = true; } else { $this->commitID = $rootJSON['response']['commit_id']; if (isset($this->newEntity)) { $this->newEntity = (bool) $rootJSON['response']['new_entity']; } if (isset($rootJSON['response']['factual_id'])) { $this->factualID = $rootJSON['response']['factual_id']; } } return $rootJSON; }
/** * Constructor, parses return values from CURL in factual::request() * @param array response The JSON response String returned by Factual. */ public function __construct($apiResponse, $responseTypes) { $this->responseTypes = $responseTypes; //pass response types from query. Do this before parent parent::__construct($apiResponse); }