Example #1
0
 public function createCDBRequest($method, $path = '', array $params = array(), $content = null, $headers = array(), $mime = 'application/json', array &$options = array())
 {
     $request = new RugRequest($method);
     $headers['User-Agent'] = $this->_userAgent;
     $location = $this->createURL($path, $params);
     if ($content instanceof \SplFileInfo) {
         $path = $content->getRealPath();
         clearstatcache(true, $path);
         $options[CURLOPT_PUT] = true;
         $options[CURLOPT_INFILE] = fopen($path, 'r');
         $options[CURLOPT_INFILESIZE] = $content->getSize();
         if (empty($mime)) {
             $mime = $this->_coder->mime($content);
         }
     } else {
         $this->applyContent($request, $content);
     }
     $headers['Content-Type'] = $mime;
     $location->applyToRequest($request);
     $request->addHeaders($headers);
     return $request;
 }
Example #2
0
 public function decode($data, $mime = CoderManager::MIME_JSON)
 {
     return $this->_coder->get($mime)->decode($data);
 }