Skip to content

Commit f2c5037

Browse files
committed
Updated readme to include requirements and invoke action service
1 parent 456cb16 commit f2c5037

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Install via [Composer](http://getcomposer.org/):
1010
$ composer require robgridley/pace-api
1111
```
1212

13+
PHP 8.1+ with the SOAP, SimpleXML and Fileinfo extensions required.
14+
1315
## Testing
1416

1517
PHPUnit tests with 100% code coverage for `Model`, `KeyCollection` and `XPath\Builder` classes.
@@ -409,6 +411,53 @@ $pace->report(100)
409411
->print();
410412
```
411413

414+
## Invoke Action
415+
416+
The invoke action service methods are exposed as PHP methods. You can find a list of methods and their arguments in the InvokeAction.wsdl file provided with the Pace SDK. Arguments must be passed in the order specified in the WSDL.
417+
418+
```php
419+
$estimate = $pace->model('Estimate')->read(100000);
420+
$pace->invokeAction()->calculateEstimate($estimate);
421+
```
422+
423+
You can also use named arguments to pass the arguments out of order, or you can mix ordered and named arguments.
424+
425+
```php
426+
$poLine = $pace->model('PurchaseOrder')->read(50000)->purchaseOrderLines()->first();
427+
$pace->invokeAction()->receivePurchaseOrderLine($poLine, Carbon::now(), in3: 'Receiving note.', in5: 1);
428+
```
429+
430+
If the method requires a complex type, you will need to pass an array.
431+
432+
If one of the arguments is an instance of a model, it will automatically be converted to a complex type containing the model's primary key. The two examples above make use of this feature. Additionally, if your complex type array contains a model, it will automatically be converted to the model's primary key.
433+
434+
```php
435+
$productType = $pace->model('JobProductType')->read('FL');
436+
$result = $pace->invokeAction()->createEstimate([
437+
'customer' => 'HOUSE',
438+
'estimateDescription' => 'Testing',
439+
'estimatePartInfo' => [
440+
'product' => $productType,
441+
'quantity1' => 100,
442+
'finalSizeW' => 8.5,
443+
'finalSizeH' => 11,
444+
'colorsSide1' => 4,
445+
'colorsSide2' => 0,
446+
'totalColors' => 4,
447+
'eachOf' => 1,
448+
'grainSpecifications' => 1,
449+
],
450+
]);
451+
```
452+
453+
Finally, the result of the invoke action call can be accessed like an array, converted to an array, or converted to a model (if the method returns the matching complex type).
454+
455+
```php
456+
$result['estimateNumber']; // returns the estimate number
457+
$result->toArray(); // returns an array
458+
$result->toModel('Estimate'); // returns an estimate model
459+
```
460+
412461
## Version
413462

414463
Identify the version of Pace running on the server.

0 commit comments

Comments
 (0)