Unverified Commit a0ec46d3 authored by Stephen Rees's avatar Stephen Rees Committed by GitHub
Browse files

wrap metadata objects being sent to API

The API requires metadata objects to be named with 'metadata'. This wraps them in an array prior to being sent so we can name the object prior to JSON encoding.
parent fee510d7
......@@ -345,7 +345,7 @@ class zenodoDeposition{
if(is_null($_deposition)){
$deposition = new stdClass();
}else{
$deposition = $_deposition->clean();
$deposition = array('metadata' => $_deposition->clean());
}
//errors in the request will generate an exception that needs to be handled by code implementing this library
$this->load($this->connection->make_request('POST', 'deposit/depositions', 'application/json', $deposition));
......@@ -365,7 +365,7 @@ class zenodoDeposition{
*/
public function update_deposition(){
//errors in the request will generate an exception that needs to be handled by code implementing this library
$this->load($this->connection->make_request('PUT', "deposit/depositions/$this->id", 'application/json', $this->metadata->clean()));
$this->load($this->connection->make_request('PUT', "deposit/depositions/$this->id", 'application/json', array('metadata' => $this->metadata->clean())));
}
public function delete_deposition(){
......@@ -1112,4 +1112,4 @@ class zenodoDepositionMetadata{
$this->method = $_setValue;
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment