| @@ 24-65 (lines=42) @@ | ||
| 21 | * @subpackage Sdk |
|
| 22 | * @category Collection |
|
| 23 | */ |
|
| 24 | class BookCollection extends Collection |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * Конструктор коллекции книг |
|
| 28 | * |
|
| 29 | * @param Client $client Инстанс клиента |
|
| 30 | * @param array $fields Поля для выборки |
|
| 31 | * @param int $limit Лимит выборки моделей книг |
|
| 32 | * @param int $offset Смещение выборки моделей книг |
|
| 33 | * |
|
| 34 | * @throws Exception |
|
| 35 | */ |
|
| 36 | public function __construct(Client $client, array $fields = array(), $limit = 10, $offset = 0) |
|
| 37 | { |
|
| 38 | parent::__construct($client, $fields, Book::class, $limit, $offset); |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * /** |
|
| 43 | * Получение данных для запроса через API |
|
| 44 | * |
|
| 45 | * @param string $method Http-метод запроса |
|
| 46 | * @param array $params Параметры для формирования урла |
|
| 47 | * |
|
| 48 | * @return array |
|
| 49 | * |
|
| 50 | * @throws Exception |
|
| 51 | */ |
|
| 52 | public function getUrl($method, array $params = array()) |
|
| 53 | { |
|
| 54 | switch ($method) { |
|
| 55 | case 'load': |
|
| 56 | return array( |
|
| 57 | 'url' => '/1.0/resource/book', |
|
| 58 | 'method' => 'GET', |
|
| 59 | 'code' => '200' |
|
| 60 | ); |
|
| 61 | default: |
|
| 62 | throw new Exception('Route for ' . $method . ' not found'); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | } |
|
| @@ 24-62 (lines=39) @@ | ||
| 21 | * @subpackage Sdk |
|
| 22 | * @category Collection |
|
| 23 | */ |
|
| 24 | class JournalCollection extends Collection |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * BookCollection constructor. |
|
| 28 | * @param Client $client |
|
| 29 | * @param array $fields |
|
| 30 | * @param int $limit |
|
| 31 | * @param int $offset |
|
| 32 | * @throws Exception |
|
| 33 | */ |
|
| 34 | public function __construct(Client $client, array $fields = array(), $limit = 10, $offset = 0) |
|
| 35 | { |
|
| 36 | parent::__construct($client, $fields, Journal::class, $limit, $offset); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * Получение данных для запроса через API |
|
| 41 | * |
|
| 42 | * @param string $method Http-метод запроса |
|
| 43 | * @param array $params Параметры для формирования урла |
|
| 44 | * |
|
| 45 | * @return array |
|
| 46 | * |
|
| 47 | * @throws Exception |
|
| 48 | */ |
|
| 49 | public function getUrl($method, array $params = array()) |
|
| 50 | { |
|
| 51 | switch ($method) { |
|
| 52 | case 'load': |
|
| 53 | return array( |
|
| 54 | 'url' => '/1.0/resource/journal', |
|
| 55 | 'method' => 'GET', |
|
| 56 | 'code' => '200' |
|
| 57 | ); |
|
| 58 | default: |
|
| 59 | throw new Exception('Route for ' . $method . ' not found'); |
|
| 60 | } |
|
| 61 | } |
|
| 62 | } |
|
| @@ 24-63 (lines=40) @@ | ||
| 21 | * @subpackage Sdk |
|
| 22 | * @category Collection |
|
| 23 | */ |
|
| 24 | class UserCollection extends Collection |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * UserCollection constructor. |
|
| 28 | * |
|
| 29 | * @param Client $client |
|
| 30 | * @param array $fields |
|
| 31 | * @param int $limit |
|
| 32 | * @param int $offset |
|
| 33 | * @throws Exception |
|
| 34 | */ |
|
| 35 | public function __construct(Client $client, array $fields = array(), $limit = 10, $offset = 0) |
|
| 36 | { |
|
| 37 | parent::__construct($client, $fields, User::class, $limit, $offset); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * Получение данных для запроса через API |
|
| 42 | * |
|
| 43 | * @param string $method Http-метод запроса |
|
| 44 | * @param array $params Параметры для формирования урла |
|
| 45 | * |
|
| 46 | * @return array |
|
| 47 | * |
|
| 48 | * @throws Exception |
|
| 49 | */ |
|
| 50 | public function getUrl($method, array $params = array()) |
|
| 51 | { |
|
| 52 | switch ($method) { |
|
| 53 | case 'load': |
|
| 54 | return array( |
|
| 55 | 'url' => '/1.0/security/user', |
|
| 56 | 'method' => 'GET', |
|
| 57 | 'code' => '200' |
|
| 58 | ); |
|
| 59 | default: |
|
| 60 | throw new Exception('Route for ' . $method . ' not found'); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | } |
|