Overview

Namespaces

  • ShippoClient
    • Entity
    • Http
      • Request
        • Addresses
        • Parcels
        • Shipments
        • Transactions
      • Response
        • Exception

Classes

  • ShippoClient\Addresses
  • ShippoClient\Entity\Address
  • ShippoClient\Entity\AddressCollection
  • ShippoClient\Entity\EntityCollection
  • ShippoClient\Entity\Location
  • ShippoClient\Entity\ObjectInformation
  • ShippoClient\Entity\Parcel
  • ShippoClient\Entity\ParcelCollection
  • ShippoClient\Entity\Rate
  • ShippoClient\Entity\RateCollection
  • ShippoClient\Entity\Refund
  • ShippoClient\Entity\RefundCollection
  • ShippoClient\Entity\ServiceLevel
  • ShippoClient\Entity\Shipment
  • ShippoClient\Entity\ShipmentCollection
  • ShippoClient\Entity\TrackingHistory
  • ShippoClient\Entity\TrackingStatus
  • ShippoClient\Entity\Tracks
  • ShippoClient\Entity\Transaction
  • ShippoClient\Entity\TransactionCollection
  • ShippoClient\Entity\WebhookTracks
  • ShippoClient\Http\Request
  • ShippoClient\Http\Request\Addresses\CreateObject
  • ShippoClient\Http\Request\CommonParameter
  • ShippoClient\Http\Request\MockCollection
  • ShippoClient\Http\Request\Parcels\CreateObject
  • ShippoClient\Http\Request\Shipments\CreateObject
  • ShippoClient\Http\Request\Shipments\CreateObjectByNested
  • ShippoClient\Http\Request\Shipments\CreateReturnObject
  • ShippoClient\Http\Request\Transactions\CreateObject
  • ShippoClient\Http\Response\AddressList
  • ShippoClient\Http\Response\ListResponse
  • ShippoClient\Http\Response\ParcelList
  • ShippoClient\Http\Response\RateList
  • ShippoClient\Http\Response\RefundList
  • ShippoClient\Http\Response\ShipmentList
  • ShippoClient\Http\Response\TransactionList
  • ShippoClient\Parcels
  • ShippoClient\Rates
  • ShippoClient\Refunds
  • ShippoClient\Shipments
  • ShippoClient\ShippoClient
  • ShippoClient\Tracks
  • ShippoClient\Transactions

Exceptions

  • ShippoClient\Http\Response\Exception\BadResponseException
  • ShippoClient\Http\Response\Exception\ClientErrorException
  • ShippoClient\Http\Response\Exception\ServerErrorException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace ShippoClient\Entity;
 4: 
 5: use TurmericSpice\ReadableAttributes;
 6: 
 7: class Tracks
 8: {
 9:     use ReadableAttributes {
10:         mayHaveAsString as public getCarrier;
11:         mayHaveAsString as public getTrackingNumber;
12:         mayHaveAsString as public getEta;
13:         mayHaveAsString as public getMetadata;
14:         toArray as public __toArray;
15:     }
16: 
17:     /**
18:      * @return \ShippoClient\Entity\TrackingStatus
19:      */
20:     public function getTrackingStatus()
21:     {
22:         return new TrackingStatus($this->attributes->mayHave('tracking_status')->asArray());
23:     }
24: 
25:     /**
26:      * @return \ShippoClient\Entity\TrackingHistory
27:      */
28:     public function getTrackingHistory()
29:     {
30:         $entities = $this->attributes->mayHave('tracking_history')
31:             ->asInstanceArray('ShippoClient\\Entity\\TrackingStatus');
32: 
33:         return new TrackingHistory($entities);
34:     }
35: 
36:     /**
37:      * @return \ShippoClient\Entity\Location
38:      */
39:     public function getAddressFrom()
40:     {
41:         $addressFrom = $this->attributes->mayHave('address_from')->asArray();
42: 
43:         return new Location($addressFrom);
44:     }
45: 
46:     /**
47:      * @return \ShippoClient\Entity\Location
48:      */
49:     public function getAddressTo()
50:     {
51:         $addressTo = $this->attributes->mayHave('address_to')->asArray();
52: 
53:         return new Location($addressTo);
54:     }
55: 
56:     /**
57:      * @return \ShippoClient\Entity\ServiceLevel
58:      */
59:     public function getServiceLevel()
60:     {
61:         $serviceLevel = $this->attributes->mayHave('servicelevel')->asArray();
62: 
63:         return new ServiceLevel($serviceLevel);
64:     }
65: 
66:     public function toArray()
67:     {
68:         return [
69:             'carrier'          => $this->getCarrier(),
70:             'tracking_number'  => $this->getTrackingNumber(),
71:             'tracking_status'  => $this->getTrackingStatus()->toArray(),
72:             'tracking_history' => $this->getTrackingHistory()->toArray(),
73:             'eta'              => $this->getEta(),
74:             'address_from'     => $this->getAddressFrom()->toArray(),
75:             'address_to'       => $this->getAddressTo()->toArray(),
76:             'servicelevel'     => $this->getServiceLevel()->toArray(),
77:         ];
78:     }
79: }
80: 
API documentation generated by ApiGen