Permalink
Browse files

Added Transloadit::deleteAssembly()

  • Loading branch information...
1 parent 922ce02 commit 75a909b37dcda0dc2996a364abf0a520650fbfbe Matt Blackwell committed Oct 27, 2011
Showing with 28 additions and 1 deletion.
  1. +28 −1 lib/transloadit/Transloadit.php
@@ -103,5 +103,32 @@ public function createAssembly($options) {
'host' => $boredInstance->data['api2_host'],
));
}
+
+ public function deleteAssembly($assembly_id) {
+ // Look up the host for this assembly
+ $response = $this->request(array(
+ 'method' => 'GET',
+ 'path' => '/assemblies/'.$assembly_id,
+ ), true);
+
+ $error = $response->error();
+ if ($error) {
+ return $error;
+ }
+
+ $url = parse_url($response->data['assembly_url']);
+
+ $response = $this->request(array(
+ 'method' => 'DELETE',
+ 'path' => $url['path'],
+ 'host' => $url['host'],
+ ));
+
+ $error = $response->error();
+ if ($error) {
+ return $error;
+ } else {
+ return $response;
+ }
+ }
}
-?>

0 comments on commit 75a909b

Please sign in to comment.