Skip to content

Commit

Permalink
url_friendly_id
Browse files Browse the repository at this point in the history
  • Loading branch information
kg-bot committed Feb 12, 2020
1 parent d3be906 commit 3338145
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/Models/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function contacts()
{
return $this->request->handleWithExceptions(function () {

$builder = new CustomerContactBuilder($this->request, $this->{$this->url_friendly_id});
$builder = new CustomerContactBuilder($this->request, $this->url_friendly_id);

return $builder->get();
});
Expand Down
2 changes: 1 addition & 1 deletion src/Models/CustomerInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function book($send_email = false)
];
}

return $this->request->client->post("{$this->entity}/{$this->{$this->url_friendly_id}}/book" . $query, [
return $this->request->client->post("{$this->entity}/{$this->url_friendly_id}/book" . $query, [
'json' => $body,
])
->getBody()
Expand Down
2 changes: 1 addition & 1 deletion src/Models/DraftOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DraftOrder extends Model
public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}.pdf")->getBody()
return $this->request->client->get("{$this->entity}/{$this->url_friendly_id}.pdf")->getBody()
->getContents();
} );
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/DraftPurchaseOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DraftPurchaseOrder extends Model
public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}.pdf")->getBody()
return $this->request->client->get("{$this->entity}/{$this->url_friendly_id}.pdf")->getBody()
->getContents();
} );
}
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Lot.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function variations( $variation_id = 1001 )
{
return $this->request->handleWithExceptions( function () use ( $variation_id ) {

$response = $this->request->client->get("variations/{$this->{$this->url_friendly_id}}/variation-matrix");
$response = $this->request->client->get("variations/{$this->url_friendly_id}/variation-matrix");

$html = (string) $response->getBody();

Expand All @@ -33,7 +33,7 @@ public function location()
{
return $this->request->handleWithExceptions( function () {

$response = $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}/locations");
$response = $this->request->client->get("{$this->entity}/{$this->url_friendly_id}/locations");

return collect( json_decode( (string) $response->getBody() )->lot_locations );

Expand Down
12 changes: 6 additions & 6 deletions src/Models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Order extends Model
public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}.pdf")->getBody()
return $this->request->client->get("{$this->entity}/{$this->url_friendly_id}.pdf")->getBody()
->getContents();
} );
}
Expand All @@ -32,7 +32,7 @@ public function reopen()

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

return $this->request->client->post("{$this->entity}/{$this->{$this->url_friendly_id}}/reopen")
return $this->request->client->post("{$this->entity}/{$this->url_friendly_id}/reopen")
->getBody()
->getContents();
} );
Expand All @@ -42,7 +42,7 @@ public function createShipment()
{
return $this->request->handleWithExceptions(function () {

$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->{$this->url_friendly_id}}/create-shipment")
$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->url_friendly_id}/create-shipment")
->getBody());

return new OrderShipment($this->request, $response->order_shipment);
Expand All @@ -56,7 +56,7 @@ public function shipments()
$builder = new OrderShipmentBuilder($this->request);

return $builder->get([
['order_number', '=', $this->{$this->url_friendly_id}],
['order_number', '=', $this->url_friendly_id],
]);
});
}
Expand All @@ -71,7 +71,7 @@ public function convertToInvoice($book = false)
{
return $this->request->handleWithExceptions(function () use ($book) {

$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->{$this->url_friendly_id}}/convert-to-invoice?book=" . (($book === true) ? 'true' : 'false'))
$response = json_decode((string)$this->request->client->post("{$this->entity}/{$this->url_friendly_id}/convert-to-invoice?book=" . (($book === true) ? 'true' : 'false'))
->getBody());

$invoice = (new CustomerInvoiceBuilder($this->request))->find($response->invoice_id);
Expand All @@ -85,7 +85,7 @@ public function notes()
return $this->request->handleWithExceptions(function () {

$builder = new OrderNoteBuilder($this->request);
$builder->setEntity(str_replace(':number', $this->{$this->url_friendly_id}, $builder->getEntity()));
$builder->setEntity(str_replace(':number', $this->url_friendly_id, $builder->getEntity()));

return $builder->get();
});
Expand Down
2 changes: 1 addition & 1 deletion src/Models/OrderShipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function markShipped()
{
return $this->request->handleWithExceptions(function () {

return $this->request->client->post("orders/shipments/{$this->{$this->url_friendly_id}}/mark-shipped", [
return $this->request->client->post("orders/shipments/{$this->url_friendly_id}/mark-shipped", [

'json' => [

Expand Down
8 changes: 4 additions & 4 deletions src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function inventoryMatrix( $location_id = null, array $filter = null )
}
}

$response = $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}/variation-matrix" .
$response = $this->request->client->get("{$this->entity}/{$this->url_friendly_id}/variation-matrix" .
$query);

$html = (string) $response->getBody();
Expand All @@ -58,7 +58,7 @@ public function variations( $variation_id = 1001 )
{
return $this->request->handleWithExceptions( function () use ( $variation_id ) {

$response = $this->request->client->get("variations/{$this->{$this->url_friendly_id}}/variation-matrix");
$response = $this->request->client->get("variations/{$this->url_friendly_id}/variation-matrix");

$html = (string) $response->getBody();

Expand All @@ -70,7 +70,7 @@ public function location($number = null)
{
return $this->request->handleWithExceptions(function () use ($number) {

$response = json_decode((string)$this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}/locations" . (($number !== null) ? '/' . $number : ''))->getBody());
$response = json_decode((string)$this->request->client->get("{$this->entity}/{$this->url_friendly_id}/locations" . (($number !== null) ? '/' . $number : ''))->getBody());

if (isset($response->product_locations)) {

Expand Down Expand Up @@ -109,7 +109,7 @@ public function fields()
return $this->request->handleWithExceptions( function () {

$response =
$this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}/fields");
$this->request->client->get("{$this->entity}/{$this->url_friendly_id}/fields");

return collect( json_decode( (string) $response->getBody() )->field_values );

Expand Down
2 changes: 1 addition & 1 deletion src/Models/ProductionOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ProductionOrder extends Model
public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}.pdf")->getBody()
return $this->request->client->get("{$this->entity}/{$this->url_friendly_id}.pdf")->getBody()
->getContents();
} );
}
Expand Down
4 changes: 2 additions & 2 deletions src/Models/PurchaseOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PurchaseOrder extends Model
public function getPDF()
{
return $this->request->handleWithExceptions( function () {
return $this->request->client->get("{$this->entity}/{$this->{$this->url_friendly_id}}.pdf")->getBody()
return $this->request->client->get("{$this->entity}/{$this->url_friendly_id}.pdf")->getBody()
->getContents();
} );
}
Expand All @@ -23,7 +23,7 @@ public function reopen()

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

return $this->request->client->post("{$this->entity}/{$this->{$this->url_friendly_id}}/reopen")
return $this->request->client->post("{$this->entity}/{$this->url_friendly_id}/reopen")
->getBody()
->getContents();
} );
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Variation/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function options()
$options = new TypeOptionBuilder( $this->request );
$old_entity = $options->getEntity();
$new_entity = $options->setEntity(str_replace(':variation_number', $this->variation_id, $old_entity));
$options->setEntity(str_replace(':type_number', $this->{$this->url_friendly_id}, $new_entity));
$options->setEntity(str_replace(':type_number', $this->url_friendly_id, $new_entity));

return $options;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Variation/Variation.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function types()
{
$types = new TypeBuilder( $this->request );
$old_entity = $types->getEntity();
$types->setEntity(str_replace(':variation_number', $this->{$this->url_friendly_id}, $old_entity));
$types->setEntity(str_replace(':variation_number', $this->url_friendly_id, $old_entity));

return $types;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function delete()
{
return $this->request->handleWithExceptions( function () {

return $this->request->client->delete("{$this->entity}/{$this->{$this->url_friendly_id}}");
return $this->request->client->delete("{$this->entity}/{$this->url_friendly_id}");
} );
}

Expand All @@ -86,7 +86,7 @@ public function update( $data = [] )

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

$response = $this->request->client->put("{$this->entity}/{$this->{$this->url_friendly_id}}", [
$response = $this->request->client->put("{$this->entity}/{$this->url_friendly_id}", [
'json' => $data,
]);

Expand Down

0 comments on commit 3338145

Please sign in to comment.