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