1 | <?php |
||
20 | class EMSTracker extends HttpAwareTracker |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | const TRACKING_ENDPOINT = 'http://shipping.ems.com.cn/partner/api/public/p/track/query/{language}/{trackingNumber}'; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $language; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | protected static $version = 'international_eub_us_1.1'; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $authenticate; |
||
41 | |||
42 | public function __construct($authenticate, $language, HttpClient $httpClient = null) |
||
48 | |||
49 | /** |
||
50 | * @return string |
||
51 | */ |
||
52 | public function getLanguage() |
||
56 | |||
57 | /** |
||
58 | * @param string $language |
||
59 | * @return EMSTracker |
||
60 | */ |
||
61 | public function setLanguage($language) |
||
69 | |||
70 | /** |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getAuthenticate() |
||
77 | |||
78 | /** |
||
79 | * @param string $authenticate |
||
80 | * @return EMSTracker |
||
81 | */ |
||
82 | public function setAuthenticate($authenticate) |
||
87 | |||
88 | /** |
||
89 | * @param string $version |
||
90 | */ |
||
91 | public static function setVersion($version) |
||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | public static function getVersion() |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function track($trackingNumber) |
||
120 | |||
121 | /** |
||
122 | * @param RequestInterface $request |
||
123 | * @param array $options |
||
124 | * @return string |
||
125 | * @codeCoverageIgnore |
||
126 | */ |
||
127 | protected function sendRequest(RequestInterface $request, array $options = []) |
||
138 | |||
139 | /** |
||
140 | * @param string $language |
||
141 | * @param string $trackingNumber |
||
142 | * @return string |
||
143 | */ |
||
144 | protected static function formatEndpoint($language, $trackingNumber) |
||
148 | |||
149 | /** |
||
150 | * @param array $json |
||
151 | * @return Shipment |
||
152 | */ |
||
153 | protected static function buildShipment($json) |
||
169 | } |