Conditions | 1 |
Paths | 1 |
Total Lines | 32 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function create() |
||
23 | { |
||
24 | $this->outputCli(Ansi::clear(), true); |
||
25 | $this->outputCli(Ansi::sgr(__METHOD__, [Sgr::BOLD]), true); |
||
26 | |||
27 | $this->initApiCall(); |
||
28 | |||
29 | $url = sprintf( |
||
30 | '%s%s/shipments', |
||
31 | $this->apiUrl, |
||
32 | $this->apiVersion |
||
33 | ); |
||
34 | |||
35 | $jwt = \ParcelValue\Api\AuthenticationToken::generate($this->clientId, $this->clientKey, $this->serverKey); |
||
36 | $headers = [ |
||
37 | 'Authorization' => sprintf('Bearer %s', $jwt), |
||
38 | 'Content-Type' => Document::CONTENT_TYPE, |
||
39 | ]; |
||
40 | |||
41 | $shipment = $this->repository->getTestShipment(); |
||
42 | |||
43 | $document = new Document(); |
||
44 | $document->setData($shipment); |
||
45 | |||
46 | $this->handleApiCall( |
||
47 | $url, |
||
48 | \WebServCo\Framework\Http::METHOD_POST, |
||
49 | $headers, |
||
50 | $document->toJson() |
||
51 | ); |
||
52 | |||
53 | return new CliResponse('', true); |
||
54 | } |
||
56 |