| 1 | <?php |
||
| 5 | class ImportBatch extends Resource |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * The endpoint that will hit the API. |
||
| 9 | * |
||
| 10 | * @return string |
||
| 11 | */ |
||
| 12 | 16 | public function endPoint() |
|
| 13 | { |
||
| 14 | 16 | return 'import_batches'; |
|
| 15 | } |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param string $filePath |
||
| 19 | * @param array $options |
||
| 20 | * |
||
| 21 | * @return mixed |
||
| 22 | */ |
||
| 23 | public function import($filePath, array $options) |
||
| 24 | { |
||
| 25 | $file = new \SplFileObject($filePath); |
||
| 26 | $requestParams = $this->buildRequestParams($file, $options); |
||
| 27 | |||
| 28 | return $this->apiRequester->request('POST', $this->url(), $requestParams); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param \SplFileObject $file |
||
| 33 | * @param array $options |
||
| 34 | * |
||
| 35 | * @return array |
||
| 36 | */ |
||
| 37 | private function buildRequestParams(\SplFileObject $file, array $options) |
||
| 56 | } |
||
| 57 |