resources() public méthode

public resources ( $options = [] )
 /**
  * List contents of a directory.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array
  */
 public function listContents($directory = '', $recursive = false)
 {
     // get resources array
     $resources = (array) $this->api->resources(['type' => 'upload', 'prefix' => $directory])['resources'];
     // parse resourses
     foreach ($resources as $i => $resource) {
         $resources[$i] = $this->prepareResourceMetadata($resource);
     }
     return $resources;
 }
Exemple #2
0
 function test27_start_at()
 {
     // should allow listing resources by start date
     Curl::mockApi($this);
     $dateTime = new \DateTime();
     $start_at = $dateTime->format(\DateTime::ISO8601);
     $this->api->resources(array("type" => "upload", "start_at" => $start_at, "direction" => "asc"));
     assertUrl($this, "/resources/image/upload");
     assertParam($this, "start_at", $start_at);
     assertParam($this, "direction", "asc");
 }
 function test27_start_at()
 {
     // should allow listing resources by start date
     sleep(2);
     $start_at = (new DateTime())->format(DateTime::ISO8601);
     sleep(2);
     $response = \Cloudinary\Uploader::upload("tests/logo.png");
     $api_repsonse = $this->api->resources(array("type" => "upload", "start_at" => $start_at, "direction" => "asc"));
     $resources = $api_repsonse["resources"];
     $this->assertEquals(count($resources), 1);
     $this->assertEquals($resources[0]["public_id"], $response["public_id"]);
 }