1 | <?php |
||
33 | class HttpRequest implements RequestInterface |
||
34 | { |
||
35 | /** |
||
36 | * The requestscheme |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | private $requestTemplate = "//webservices.amazon.%s/onca/xml?%s"; |
||
41 | |||
42 | /** |
||
43 | * The scheme for the uri. E.g. http or https. |
||
44 | * |
||
45 | * @var string |
||
46 | */ |
||
47 | private $scheme = 'http'; |
||
48 | |||
49 | /** |
||
50 | * @var HttpClient |
||
51 | */ |
||
52 | private $client; |
||
53 | |||
54 | /** |
||
55 | * @var MessageFactory |
||
56 | */ |
||
57 | private $messageFactory; |
||
58 | |||
59 | /** |
||
60 | * @var UriFactory |
||
61 | */ |
||
62 | private $uriFactory; |
||
63 | |||
64 | /** |
||
65 | * Initialize instance |
||
66 | * |
||
67 | * @param HttpClient $client |
||
68 | * @param MessageFactory $messageFactory |
||
69 | * @param UriFactory $uriFactory |
||
70 | */ |
||
71 | 4 | public function __construct(HttpClient $client, MessageFactory $messageFactory, UriFactory $uriFactory) |
|
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | 2 | public function perform(OperationInterface $operation, ConfigurationInterface $configuration) |
|
96 | |||
97 | /** |
||
98 | * Sets the scheme. |
||
99 | * |
||
100 | * @param string $scheme |
||
101 | */ |
||
102 | 2 | public function setScheme($scheme) |
|
110 | |||
111 | /** |
||
112 | * Prepares the parameters for the request |
||
113 | * |
||
114 | * @param OperationInterface $operation |
||
115 | * @param ConfigurationInterface $configuration |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | 2 | protected function prepareRequestParams(OperationInterface $operation, ConfigurationInterface $configuration) |
|
143 | |||
144 | /** |
||
145 | * Builds the final querystring including the signature |
||
146 | * |
||
147 | * @param array $params |
||
148 | * @param ConfigurationInterface $configuration |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | 2 | protected function buildQueryString(array $params, ConfigurationInterface $configuration) |
|
165 | |||
166 | /** |
||
167 | * Calculates the signature for the request |
||
168 | * |
||
169 | * @param array $params |
||
170 | * @param string $country |
||
171 | * @param string $secret |
||
172 | * |
||
173 | * @return string |
||
174 | */ |
||
175 | 2 | protected function buildSignature(array $params, $country, $secret) |
|
186 | } |
||
187 |