Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kg-bot committed Jul 1, 2019
2 parents e76c186 + 42e8443 commit 95f1054
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Builders/DraftPurchaseOrderBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Rackbeat\Builders;


use Rackbeat\Models\DraftPurchaseOrder;

class DraftPurchaseOrderBuilder extends Builder
{
protected $entity = 'purchase-orders/drafts';
protected $model = DraftPurchaseOrder::class;
}
12 changes: 12 additions & 0 deletions src/Builders/PurchaseOrderBuilder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Rackbeat\Builders;


use Rackbeat\Models\PurchaseOrder;

class PurchaseOrderBuilder extends Builder
{
protected $entity = 'purchase-orders';
protected $model = PurchaseOrder::class;
}
20 changes: 20 additions & 0 deletions src/Models/DraftPurchaseOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Rackbeat\Models;


use Rackbeat\Utils\Model;

class DraftPurchaseOrder extends Model
{
protected $entity = 'purchase-orders/drafts';
protected $primaryKey = 'number';

public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get( "{$this->entity}/{$this->{$this->primaryKey}}.pdf" )->getBody()
->getContents();
} );
}
}
31 changes: 31 additions & 0 deletions src/Models/PurchaseOrder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Rackbeat\Models;


use Rackbeat\Utils\Model;

class PurchaseOrder extends Model
{
protected $entity = 'purchase-orders';
protected $primaryKey = 'number';

public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get( "{$this->entity}/{$this->{$this->primaryKey}}.pdf" )->getBody()
->getContents();
} );
}

public function reopen()
{

return $this->request->handleWithExceptions( function () {

return $this->request->client->post( "{$this->entity}/{$this->{$this->primaryKey}}/reopen" )
->getBody()
->getContents();
} );
}
}
19 changes: 19 additions & 0 deletions src/Rackbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Rackbeat\Builders\CustomerGroupBuilder;
use Rackbeat\Builders\CustomerInvoiceBuilder;
use Rackbeat\Builders\DraftOrderBuilder;
use Rackbeat\Builders\DraftPurchaseOrderBuilder;
use Rackbeat\Builders\EmployeeBuilder;
use Rackbeat\Builders\FieldBuilder;
use Rackbeat\Builders\InventoryAdjustmentBuilder;
Expand All @@ -20,6 +21,8 @@
use Rackbeat\Builders\ProductBuilder;
use Rackbeat\Builders\ProductGroupBuilder;
use Rackbeat\Builders\ProductionOrderBuilder;
use Rackbeat\Builders\PurchaseOrderBuilder;
use Rackbeat\Builders\PurchaseOrderReceiptBuilder;
use Rackbeat\Builders\SupplierBuilder;
use Rackbeat\Builders\SupplierGroupBuilder;
use Rackbeat\Builders\SupplierInvoiceBuilder;
Expand Down Expand Up @@ -168,6 +171,14 @@ public function production_orders()
return new ProductionOrderBuilder( $this->request );
}

/**
* @return \Rackbeat\Builders\PurchaseOrderBuilder
*/
public function purchase_orders()
{
return new PurchaseOrderBuilder( $this->request );
}

/**
* @return \Rackbeat\Builders\DraftOrderBuilder
*/
Expand All @@ -176,6 +187,14 @@ public function draft_orders()
return new DraftOrderBuilder( $this->request );
}

/**
* @return \Rackbeat\Builders\DraftPurchaseOrderBuilder
*/
public function draft_purchase_orders()
{
return new DraftPurchaseOrderBuilder( $this->request );
}

/**
* @return \Rackbeat\Builders\CustomerInvoiceBuilder
*/
Expand Down

0 comments on commit 95f1054

Please sign in to comment.