From 3338145f2ea2560c1e44833990d3d0d444af79c5 Mon Sep 17 00:00:00 2001 From: Stefan Ninic Date: Wed, 12 Feb 2020 11:35:37 +0100 Subject: [PATCH] url_friendly_id --- src/Models/Customer.php | 2 +- src/Models/CustomerInvoice.php | 2 +- src/Models/DraftOrder.php | 2 +- src/Models/DraftPurchaseOrder.php | 2 +- src/Models/Lot.php | 4 ++-- src/Models/Order.php | 12 ++++++------ src/Models/OrderShipment.php | 2 +- src/Models/Product.php | 8 ++++---- src/Models/ProductionOrder.php | 2 +- src/Models/PurchaseOrder.php | 4 ++-- src/Models/Variation/Type.php | 2 +- src/Models/Variation/Variation.php | 2 +- src/Utils/Model.php | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Models/Customer.php b/src/Models/Customer.php index 6d76a08..9370a46 100644 --- a/src/Models/Customer.php +++ b/src/Models/Customer.php @@ -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(); }); diff --git a/src/Models/CustomerInvoice.php b/src/Models/CustomerInvoice.php index f79e2b4..645e0aa 100644 --- a/src/Models/CustomerInvoice.php +++ b/src/Models/CustomerInvoice.php @@ -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() diff --git a/src/Models/DraftOrder.php b/src/Models/DraftOrder.php index 19e6ca0..755d513 100644 --- a/src/Models/DraftOrder.php +++ b/src/Models/DraftOrder.php @@ -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(); } ); } diff --git a/src/Models/DraftPurchaseOrder.php b/src/Models/DraftPurchaseOrder.php index f0da2cb..edb7d6d 100644 --- a/src/Models/DraftPurchaseOrder.php +++ b/src/Models/DraftPurchaseOrder.php @@ -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(); } ); } diff --git a/src/Models/Lot.php b/src/Models/Lot.php index e5f6e10..a136e92 100644 --- a/src/Models/Lot.php +++ b/src/Models/Lot.php @@ -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(); @@ -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 ); diff --git a/src/Models/Order.php b/src/Models/Order.php index 7ea4510..c17a70a 100644 --- a/src/Models/Order.php +++ b/src/Models/Order.php @@ -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(); } ); } @@ -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(); } ); @@ -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); @@ -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], ]); }); } @@ -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); @@ -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(); }); diff --git a/src/Models/OrderShipment.php b/src/Models/OrderShipment.php index e15c5ca..8b51fac 100644 --- a/src/Models/OrderShipment.php +++ b/src/Models/OrderShipment.php @@ -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' => [ diff --git a/src/Models/Product.php b/src/Models/Product.php index 0637af2..c366c87 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -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(); @@ -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(); @@ -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)) { @@ -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 ); diff --git a/src/Models/ProductionOrder.php b/src/Models/ProductionOrder.php index a71e9c9..11a681c 100644 --- a/src/Models/ProductionOrder.php +++ b/src/Models/ProductionOrder.php @@ -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(); } ); } diff --git a/src/Models/PurchaseOrder.php b/src/Models/PurchaseOrder.php index 6edfb67..e6f92a8 100644 --- a/src/Models/PurchaseOrder.php +++ b/src/Models/PurchaseOrder.php @@ -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(); } ); } @@ -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(); } ); diff --git a/src/Models/Variation/Type.php b/src/Models/Variation/Type.php index 2af0db1..fa7dcfa 100644 --- a/src/Models/Variation/Type.php +++ b/src/Models/Variation/Type.php @@ -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; } diff --git a/src/Models/Variation/Variation.php b/src/Models/Variation/Variation.php index 3ac9d58..f9b08e5 100644 --- a/src/Models/Variation/Variation.php +++ b/src/Models/Variation/Variation.php @@ -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; } diff --git a/src/Utils/Model.php b/src/Utils/Model.php index 0340019..e5d1c07 100644 --- a/src/Utils/Model.php +++ b/src/Utils/Model.php @@ -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}"); } ); } @@ -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, ]);