Skip to content

Commit

Permalink
Merge pull request #261 from Spaggel/master
Browse files Browse the repository at this point in the history
Add support for downloading item images.
  • Loading branch information
stephangroen authored May 24, 2018
2 parents e9a77ae + a9b0fe8 commit dabd3f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Picqer/Financials/Exact/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,16 @@
* @property DateTime $StartDate Together with StartDate this determines if the item is active
* @property Byte $Unit Indicates if the item is a time unit item (for example a labor hour item)
* @property String $UnitDescription Description of Unit
* @property String PictureUrl
* @property String PictureThumbnailUrl
* @property String PictureName
*/
class Item extends Model
{
use Query\Findable;
use Persistance\Storable;

use Persistance\Downloadable;

protected $fillable = [
'Barcode',
'ID',
Expand Down Expand Up @@ -196,6 +200,9 @@ class Item extends Model
'Stock',
'Unit',
'UnitDescription',
'PictureUrl',
'PictureThumbnailUrl',
'PictureName',
];

protected $url = 'logistics/Items';
Expand Down
6 changes: 5 additions & 1 deletion src/Picqer/Financials/Exact/Persistance/Downloadable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ public function download()
{
$client = new Client();

$uri = $this->Url . '&Download=1';
if ($this->Url) {
$uri = $this->Url . '&Download=1';
} elseif ($this->PictureUrl) {
$uri = $this->PictureUrl;
}

$headers = [
'Accept' => 'application/json',
Expand Down

0 comments on commit dabd3f2

Please sign in to comment.