Skip to content

Commit

Permalink
Updated to reflect the fact that "resource" is now "entity" in respon…
Browse files Browse the repository at this point in the history
…ses.
  • Loading branch information
bharat committed Jan 28, 2010
1 parent 8bd90d1 commit eae41b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions client/Gallery3.php
Expand Up @@ -27,7 +27,7 @@ class Gallery3 {
var $data;
var $file;

protected $original_resource;
protected $original_entity;

/**
* Connect to a remote Gallery3 instance
Expand Down Expand Up @@ -77,7 +77,7 @@ public function __construct() {
* @chainable
*/
public function set($key, $value) {
$this->data->resource->$key = $value;
$this->data->entity->$key = $value;
return $this;
}

Expand All @@ -100,7 +100,7 @@ public function set_file($file) {
*/
public function create($url, $token) {
$response = Gallery3_Helper::request(
"post", $url, $token, $this->data->resource, $this->file);
"post", $url, $token, $this->data->entity, $this->file);
$this->url = $response->url;
$this->token = $token;
return $this->load();
Expand All @@ -115,7 +115,7 @@ public function create($url, $token) {
public function save() {
$response = Gallery3_Helper::request(
"put", $this->url, $this->token,
array_diff($this->original_resource, (array)$this->data->resource));
array_diff($this->original_entity, (array)$this->data->entity));
return $this->load();
}

Expand All @@ -140,7 +140,7 @@ public function delete() {
public function load() {
$response = Gallery3_Helper::request("get", $this->url, $this->token);
$this->data = $response;
$this->original_resource = (array)$response->resource;
$this->original_entity = (array)$response->entity;
return $this;
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/example.php
Expand Up @@ -26,14 +26,14 @@
->set("name", "Sample Album")
->set("title", "This is my Sample Album")
->create($root->url, $auth);
alert("Created album: <b>{$album->url} {$album->data->resource->title}</b>");
alert("Created album: <b>{$album->url} {$album->data->entity->title}</b>");


alert("Modify the album");
$album
->set("title", "This is the new title")
->save();
alert("New title: <b>{$album->data->resource->title}</b>");
alert("New title: <b>{$album->data->entity->title}</b>");


$photo = Gallery3::factory()
Expand Down

0 comments on commit eae41b1

Please sign in to comment.