示例#1
0
 /**
  * Reads feed
  *
  * @param string $apiVersion
  * @param string $apiKey
  * @param integer $feedId
  *
  * @return array
  */
 public function readFeed($feedId, $apiKey)
 {
     $feed = new Feed();
     $feed->setFeedId($feedId);
     $feed->setApiKey($apiKey);
     $feed->setDatastreams(array(1));
     $feed->setFormat('json');
     $response = ResponseToArrayTransformer::transform($this->connManager->getRequest($feed), $feed->getFormat());
     echo "<pre>";
     var_dump($response);
     echo "</pre>";
     die;
     //        //if historical query
     //        if ($start != null && $end != null) {
     //            $startDate = new \DateTime($start);
     //            $endDate = new \DateTime($end);
     //
     //            $pachube = new Pachube($apiVersion, $feedId);
     //            $pachube->setStartDate($startDate);
     //            $pachube->setEndDate($endDate);
     //
     //            $url = $pachube->buildUrl();
     //
     //
     //            $response = $this->connManager->_getRequest($url);
     //            return $response;
     //        }
     //        else {
     //            $pachube = new Pachube($apiVersion, $feedId);
     //
     //            //building web service url
     //            $url = $pachube->buildUrl();
     //
     //            //getting data
     //            $data = $this->connManager->_getRequest($url);
     //
     //        }
     //
     //        return $data;
 }