diff --git a/composer.json b/composer.json index 9f0d9c6..343c976 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ ], "support": { "email": "hello@feedlabs.io", - "issues": "https://github.com/feedlabs/sdk-php/issues", - "source": "https://github.com/feedlabs/sdk-php" + "source": "https://github.com/feedlabs/sdk-php", + "issues": "https://github.com/feedlabs/sdk-php/issues" }, "require-dev": { "phpunit/phpunit": "~4.1.3", diff --git a/source/Feedlabs/Feedify/Client.php b/source/Feedlabs/Feedify/Client.php index 1a777c1..a989ef2 100644 --- a/source/Feedlabs/Feedify/Client.php +++ b/source/Feedlabs/Feedify/Client.php @@ -2,7 +2,11 @@ namespace Feedlabs\Feedify; -use Feedlabs\Feedify\Resource\Feed; +use Feedlabs\Feedify\Client\AdminUserClient; +use Feedlabs\Feedify\Client\ApplicationClient; +use Feedlabs\Feedify\Client\EntryClient; +use Feedlabs\Feedify\Client\FeedClient; +use Feedlabs\Feedify\Client\TokenClient; /** * Class Client @@ -12,8 +16,20 @@ class Client { CONST API_VERSION = 1; - /** @var string */ - private static $_apiId; + /** @var ApplicationClient */ + public $application; + + /** @var FeedClient */ + public $feed; + + /** @var EntryClient */ + public $entry; + + /** @var AdminUserClient */ + public $adminUser; + + /** @var TokenClient */ + public $token; /** @var string */ private static $_apiToken; @@ -22,85 +38,16 @@ class Client { private static $_request; /** - * @param string $apiId * @param string $apiToken */ - public function __construct($apiId, $apiToken) { - static::$_apiId = (string) $apiId; + public function __construct($apiToken) { static::$_apiToken = (string) $apiToken; - } - - /** - * @param string $id - * @return Feed - */ - public function getFeed($id) { - $id = (string) $id; - $data = static::getRequest()->get('/feed/' . $id); - return new Feed($id, $data); - } - - /** - * @return Feed[] - */ - public function getFeedList() { - $feedList = array(); - $result = static::getRequest()->get('/feed'); - foreach ($result as $feedData) { - $feedList[] = new Feed($feedData['Id'], array('Data' => $feedData['Data'])); - } - return $feedList; - } - - /** - * @param array $data - * @return string - */ - public function createFeed(array $data) { - $result = static::getRequest()->post('/feed', $data); - return $result['id']; - } - /** - * @param string $id - * @param array $data - */ - public function updateFeed($id, array $data) { - static::getRequest()->put('/feed/' . $id, $data); - } - - /** - * @param string $id - */ - public function deleteFeed($id) { - static::getRequest()->delete('/feed/' . $id); - } - - /** - * @param string $feedId - * @param array $data - * @return string - */ - public function createEntry($feedId, array $data) { - $result = static::getRequest()->post('/feed/' . $feedId . '/entry', $data); - return $result['id']; - } - - /** - * @param string $feedId - * @param string $entryId - * @param array $data - */ - public function updateEntry($feedId, $entryId, array $data) { - static::getRequest()->put('/feed/' . $feedId . '/entry/' . $entryId, $data); - } - - /** - * @param string $feedId - * @param string $entryId - */ - public function deleteEntry($feedId, $entryId) { - static::getRequest()->delete('/feed/' . $feedId . '/entry/' . $entryId); + $this->application = new ApplicationClient(); + $this->feed = new FeedClient(); + $this->entry = new EntryClient(); + $this->adminUser = new AdminUserClient(); + $this->token = new TokenClient(); } /** @@ -108,7 +55,7 @@ public function deleteEntry($feedId, $entryId) { */ public static function getRequest() { if (!static::$_request) { - static::$_request = new Request(static::$_apiId, static::$_apiToken); + static::$_request = new Request(static::$_apiToken); } return static::$_request; } diff --git a/source/Feedlabs/Feedify/Client/AdminUserClient.php b/source/Feedlabs/Feedify/Client/AdminUserClient.php new file mode 100644 index 0000000..530c614 --- /dev/null +++ b/source/Feedlabs/Feedify/Client/AdminUserClient.php @@ -0,0 +1,95 @@ + 'adminUserId-' . $i, + 'email' => 'test' . $i . '@example.com', + 'roleList' => [['id' => 1, 'name' => 'superAdmin']], + 'createStamp' => time(), + ]; + } + + return new AdminUserList($adminUserList); + } + + /** + * @param string $adminUserId + * @return AdminUser + */ + public function get($adminUserId) { + $adminUserId = (string) $adminUserId; + // todo: load over API + $data = [ + 'id' => $adminUserId, + 'email' => 'test@example.com', + 'roleList' => [['id' => 1, 'name' => 'superAdmin']], + 'createStamp' => time(), + ]; + + return new AdminUser(new Params($data)); + } + + /** + * @param string $email + * @param array|null $roleList + * @return AdminUser + */ + public function create($email, array $roleList = null) { + $email = (string) $email; + $roleList = (array) $roleList; + // todo: load over API + $data = [ + 'id' => 'ID1234', + 'email' => $email, + 'roleList' => [['id' => 1, 'name' => 'superAdmin']], + 'createStamp' => time(), + ]; + + return new AdminUser(new Params($data)); + } + + /** + * @param string $adminUserId + * @param string $email + * @param array|null $roleList + * @return AdminUser + */ + public function update($adminUserId, $email, array $roleList = null) { + $adminUserId = (string) $adminUserId; + $email = (string) $email; + $roleList = (array) $roleList; + // todo: load over API + $data = [ + 'id' => 'ID1234', + 'email' => $email, + 'roleList' => [['id' => 1, 'name' => 'superAdmin']], + 'createStamp' => time(), + ]; + + return new AdminUser(new Params($data)); + } + + public function delete($adminUserId) { + $adminUserId = (string) $adminUserId; + // todo: load over API + // todo: what to return??? + } +} diff --git a/source/Feedlabs/Feedify/Client/ApplicationClient.php b/source/Feedlabs/Feedify/Client/ApplicationClient.php new file mode 100644 index 0000000..9ec1642 --- /dev/null +++ b/source/Feedlabs/Feedify/Client/ApplicationClient.php @@ -0,0 +1,102 @@ + 'id' . $i, + 'name' => 'Name-' . $i, + 'createStamp' => time(), + ]; + } + + return new ApplicationList($applicationList); + } + + /** + * @param string $applicationId + * @return Application + */ + public function get($applicationId) { + $applicationId = (string) $applicationId; + + // todo: load over API + + $data = new Params([ + 'id' => $applicationId, + 'name' => 'Name-' . $applicationId, + 'description' => 'description' . $applicationId, + 'createStamp' => time(), + ]); + return new Application($data); + } + + /** + * @param string $name + * @param string|null $description + * @return Application + */ + public function create($name, $description = null) { + $name = (string) $name; + $description = (string) $description; + + // todo: send / load over API + + $data = new Params([ + 'id' => 'ABC123', + 'name' => 'Name-ABC123', + 'description' => 'description-ABC123', + 'createStamp' => time(), + ]); + return new Application($data); + } + + /** + * @param string $applicationId + * @param string $name + * @param string|null $description + * @return Application + */ + public function update($applicationId, $name, $description = null) { + $applicationId = (string) $applicationId; + $name = (string) $name; + $description = (string) $description; + + // todo: send / load over API + + $data = new Params([ + 'id' => $applicationId, + 'name' => 'Name-' . $applicationId, + 'description' => 'description' . $applicationId, + 'createStamp' => time(), + ]); + return new Application($data); + } + + /** + * @param string $applicationId + */ + public function delete($applicationId) { + $applicationId = (string) $applicationId; + + // todo: send / load over API + // todo: think about what to return + } +} diff --git a/source/Feedlabs/Feedify/Client/EntryClient.php b/source/Feedlabs/Feedify/Client/EntryClient.php new file mode 100644 index 0000000..797e869 --- /dev/null +++ b/source/Feedlabs/Feedify/Client/EntryClient.php @@ -0,0 +1,30 @@ +get('/feed'); + // foreach ($result as $feedData) { + // $applicationList[] = new Feed($feedData['Id'], array('Data' => $feedData['Data'])); + // } + // todo: load over API + + $feedList = []; + for ($i = 0; $i < 5; $i++) { + $feedList[] = [ + 'id' => 'id' . $i, + 'name' => 'Name-' . $i, + 'description' => 'description-' . $i, + 'channel' => 'channel-' . $i, + 'createStamp' => time(), + ]; + } + + return new FeedList($feedList); + } + + /** + * @param string $applicationId + * @param string $feedId + * @return Feed + */ + public function get($applicationId, $feedId) { + // $feedId = (string) $feedId; + // $data = static::getRequest()->get('/application/' . $applicationId . '/feed/' . $feedId); + // return new Feed(new Params($data)); + + $applicationId = (string) $applicationId; + $feedId = (string) $feedId; + // $data = static::getRequest()->get('/feed/' . $id); + // todo: load over API + + $data = new Params([ + 'id' => $feedId, + 'name' => 'Name-' . $feedId, + 'description' => 'description' . $feedId, + 'channel' => 'channel' . $feedId, + 'createStamp' => time(), + ]); + return new Feed($data); + } + + public function create($applicationId, $name, $description = null, $tagList = null) { + // todo: add + } + + public function update($applicationId, $feedId, $name, $description = null, $tagList = null) { + // todo: add + } + + /** + * @param string $applicationId + * @param string $feedId + */ + public function delete($applicationId, $feedId) { + // todo: add + } +} diff --git a/source/Feedlabs/Feedify/Client/TokenClient.php b/source/Feedlabs/Feedify/Client/TokenClient.php new file mode 100644 index 0000000..d087186 --- /dev/null +++ b/source/Feedlabs/Feedify/Client/TokenClient.php @@ -0,0 +1,51 @@ + 'token' . $i, 'name' => 'Name-' . $i, 'createStamp' => time()]; + } + + return new TokenList($tokenList); + } + + /** + * @param string $token + * @return Token + */ + public function get($token) { + $token = (string) $token; + // todo: load over API + $data = ['token' => $token, 'name' => 'Namedjgsfjhsdgfhjsfgdshj', 'createStamp' => time()]; + + return new Token(new Params($data)); + } + + public function create($name) { + // todo: load over API + $data = ['token' => 'tokenHASH', 'name' => $name, 'createStamp' => time()]; + + return new Token(new Params($data)); + } + + public function delete($token) { + // todo: add + } +} diff --git a/source/Feedlabs/Feedify/Exception/ParamsException.php b/source/Feedlabs/Feedify/Exception/ParamsException.php new file mode 100644 index 0000000..695269b --- /dev/null +++ b/source/Feedlabs/Feedify/Exception/ParamsException.php @@ -0,0 +1,11 @@ +_params = $params ?: array(); + } + + /** + * @param string $key + * @param mixed|null $default + * @return mixed + */ + public function get($key, $default = null) { + return $this->_get($key, $default); + } + + /** + * @param string $key + * @param mixed $value + */ + public function set($key, $value) { + $this->_params[$key] = $value; + } + + /** + * @param string $key + * @return bool + */ + public function has($key) { + return array_key_exists($key, $this->_params) && null !== $this->_params[$key]; + } + + /** + * @param string $key + * @param string|null $default + * @return float + */ + public function getFloat($key, $default = null) { + $param = $this->_get($key, $default); + return $this->_getFloat($param); + } + + /** + * @param string $key + * @param string|null $default + * @return string + */ + public function getString($key, $default = null) { + $param = $this->_get($key, $default); + return $this->_getString($param); + } + + /** + * @param string $key + * @param string|null $default + * @return int + */ + public function getInt($key, $default = null) { + $param = $this->_get($key, $default); + return $this->_getInt($param); + } + + /** + * @param string $key + * @param array $default + * @return array + * @throws ParamsException + */ + public function getArray($key, array $default = null) { + $param = $this->_get($key, $default); + if (!is_array($param)) { + throw new ParamsException('Not an Array'); + } + return (array) $param; + } + + /** + * @param string $key + * @param boolean $default + * @return boolean + * @throws ParamsException + */ + public function getBoolean($key, $default = null) { + $param = $this->_get($key, $default); + if (1 === $param || '1' === $param || 'true' === $param) { + $param = true; + } + if (0 === $param || '0' === $param || 'false' === $param) { + $param = false; + } + if (!is_bool($param)) { + throw new ParamsException('Not a boolean'); + } + return (boolean) $param; + } + + /** + * @param string $key + */ + public function remove($key) { + unset($this->_params[$key]); + } + + /** + * @param string $key + * @param mixed $default + * @throws ParamsException + * @return mixed + */ + protected function _get($key, $default = null) { + if (!$this->has($key) && $default === null) { + throw new ParamsException("Param `$key` not set"); + } + if (!$this->has($key) && $default !== null) { + return $default; + } + return $this->_params[$key]; + } + + /** + * @param mixed $param + * @return float + * @throws ParamsException + */ + private function _getFloat($param) { + if (is_float($param) || is_int($param)) { + return (float) $param; + } + if (is_string($param)) { + if (preg_match('/^-?(?:\\d++\\.?+\\d*+|\\.\\d++)$/', $param)) { + return (float) $param; + } + } + throw new ParamsException('Not a float'); + } + + /** + * @param mixed $param + * @return string + * @throws ParamsException + */ + private function _getString($param) { + if (!is_string($param)) { + throw new ParamsException('Not a String'); + } + return (string) $param; + } + + /** + * @param mixed $param + * @return int + * @throws ParamsException + */ + private function _getInt($param) { + if (!ctype_digit($param) && !is_int($param)) { + throw new ParamsException('Not an Integer'); + } + return (int) $param; + } +} diff --git a/source/Feedlabs/Feedify/Request.php b/source/Feedlabs/Feedify/Request.php index 0367cf9..d08b2ad 100644 --- a/source/Feedlabs/Feedify/Request.php +++ b/source/Feedlabs/Feedify/Request.php @@ -16,18 +16,13 @@ class Request { CONST METHOD_DELETE = 4; CONST API_URL = 'http://www.feed.dev:10111'; - /** @var string */ - protected $_apiId; - /** @var string */ protected $_apiToken; /** - * @param string $apiId * @param string $apiToken */ - public function __construct($apiId, $apiToken) { - $this->_apiId = $apiId; + public function __construct($apiToken) { $this->_apiToken = $apiToken; } @@ -54,8 +49,8 @@ public function post($path, $data) { * @return array */ public function put($path, $data) { - return Helper::decode($this->_send(self::METHOD_PUT, $path, $data)); - } + return Helper::decode($this->_send(self::METHOD_PUT, $path, $data)); + } /** * @param $path @@ -65,13 +60,6 @@ public function delete($path) { return Helper::decode($this->_send(self::METHOD_DELETE, $path)); } - /** - * @return string - */ - public function getApiId() { - return $this->_apiId; - } - /** * @return string */ @@ -96,8 +84,9 @@ protected function _send($method, $path, $data = null) { curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0'); - $header = array(); - $header[] = 'Content-type:application/json'; + $header = []; + $header[] = 'apiToken: ' . $this->getApiToken(); + $header[] = 'Content-type: application/json'; switch ($method) { case self::METHOD_GET: diff --git a/source/Feedlabs/Feedify/Resource/AbstractElement.php b/source/Feedlabs/Feedify/Resource/AbstractElement.php new file mode 100644 index 0000000..1ed5411 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/AbstractElement.php @@ -0,0 +1,54 @@ +_id = $data->getString('id'); + $this->_createStamp = ($data->has('createStamp')) ? $data->getInt('createStamp') : null; + } + + /** + * @return string + */ + public function getId() { + return $this->_id; + } + + /** + * @return int + */ + public function getCreated() { + if (null === $this->_createStamp) { + $this->_load(); + } + return $this->_createStamp; + } + + /** + * @return Request + */ + protected function _getRequest() { + return Client::getRequest(); + } + + abstract protected function _load(); +} diff --git a/source/Feedlabs/Feedify/Resource/AbstractList.php b/source/Feedlabs/Feedify/Resource/AbstractList.php new file mode 100644 index 0000000..462af34 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/AbstractList.php @@ -0,0 +1,90 @@ +_itemListRaw = (array) $itemList; + } + + /** + * @return array + */ + public function getItems() { + if (!$this->_itemList) { + $itemList = array(); + foreach ($this->_itemListRaw as $item) { + $itemList[] = $this->_processItem($item); + } + $this->_itemList = $itemList; + } + return $this->_itemList; + } + + /** + * @return int + */ + public function getCount() { + return count($this->getItems()); + } + + /** + * @return bool + */ + public function isEmpty() { + return 0 === $this->getCount(); + } + + /** + * @param array $item + * @return AbstractElement|array + */ + protected function _processItem($item) { + return $item; + } + + function rewind() { + $this->_iteratorItems = $this->getItems(); + $this->_iteratorPosition = 0; + } + + function current() { + return $this->_iteratorItems[$this->_iteratorPosition]; + } + + function key() { + return $this->_iteratorPosition; + } + + function next() { + ++$this->_iteratorPosition; + } + + function valid() { + return isset($this->_iteratorItems[$this->_iteratorPosition]); + } + + public function count() { + return $this->getCount(); + } +} diff --git a/source/Feedlabs/Feedify/Resource/AbstractResource.php b/source/Feedlabs/Feedify/Resource/AbstractResource.php deleted file mode 100644 index 63986e1..0000000 --- a/source/Feedlabs/Feedify/Resource/AbstractResource.php +++ /dev/null @@ -1,27 +0,0 @@ -_id = (string) $id; - } - - /** - * @return string - */ - public function getId() { - return $this->_id; - } -} diff --git a/source/Feedlabs/Feedify/Resource/AdminUser.php b/source/Feedlabs/Feedify/Resource/AdminUser.php new file mode 100644 index 0000000..3d959f1 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/AdminUser.php @@ -0,0 +1,65 @@ +_email = ($data->has('email')) ? $data->getString('email') : null; + $this->_roleList = ($data->has('roleList')) ? $data->getArray('roleList') : null; + } + + /** + * @return string + */ + public function getEmail() { + if (null === $this->_email) { + $this->_load(); + } + return $this->_email; + } + + /** + * @return array[] + */ + public function getRoleLIst() { + if (null === $this->_roleList) { + $this->_load(); + } + return $this->_roleList; + } + + public function delete() { + // todo: add delete + } + + protected function _load() { + // todo: get userAdmin infos over API + $data = new Params([ + 'email' => 'test@example.com', + 'roleList' => [['id' => 1, 'name' => 'superAdmin'], ['id' => 2, 'name' => 'admin']], + 'createStamp' => time(), + ]); + // ////////////////////////////////////// + + $this->_email = $data->getString('email'); + $this->_roleList = $data->getArray('roleList'); + $this->_createStamp = $data->getInt('createStamp'); + } +} diff --git a/source/Feedlabs/Feedify/Resource/AdminUserList.php b/source/Feedlabs/Feedify/Resource/AdminUserList.php new file mode 100644 index 0000000..52fe5c8 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/AdminUserList.php @@ -0,0 +1,16 @@ +_name = ($data->has('name')) ? $data->getString('name') : null; + $this->_description = ($data->has('description')) ? $data->getString('description') : null; + $this->_feedList = ($data->has('feedList')) ? $data->get('feedList') : null; + } + + /** + * @return string + */ + public function getName() { + if (null === $this->_name) { + $this->_load(); + } + return $this->_name; + } + + /** + * @return string|null + */ + public function getDescription() { + if (null === $this->_description) { + $this->_load(); + } + return $this->_description; + } + + public function getFeedList() { + if (null === $this->_feedList) { + // todo: load over API + $feedList = []; + for ($i = 0; $i < 3; $i++) { + $feedList[] = [ + 'id' => 'id' . $i, + 'name' => 'Name-' . $i, + 'description' => 'description-' . $i, + 'channel' => 'channel' . $i, + 'createStamp' => time(), + ]; + } + // ////////////////////////////////////// + $this->_feedList = new FeedList($feedList); + } + + return $this->_feedList; + } + + public function delete() { + // todo: add delete + } + + protected function _load() { + // todo: get application infos over API + $data = new Params([ + 'name' => 'Name-ABC123', + 'description' => 'description-ABC123', + 'createStamp' => time(), + ]); + // ////////////////////////////////////// + + $this->_name = $data->getString('name'); + $this->_description = $data->getString('description'); + $this->_createStamp = $data->getInt('createStamp'); + } +} diff --git a/source/Feedlabs/Feedify/Resource/ApplicationList.php b/source/Feedlabs/Feedify/Resource/ApplicationList.php new file mode 100644 index 0000000..eb5a640 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/ApplicationList.php @@ -0,0 +1,16 @@ +_data = $data; + public function __construct(Params $data) { + parent::__construct($data); + $this->_data = ($data->has('data')) ? $data->getString('data') : null; } /** - * @return array + * @return string */ public function getData() { + if (null === $this->_data) { + $this->_load(); + } return $this->_data; } - /** - * @return Request - */ - protected function _getRequest() { - return Client::getRequest(); + protected function _load() { + // todo: get feed infos over API + $data = new Params([ + 'data' => 'description123', + 'createStamp' => time(), + ]); + // ////////////////////////////////////// + + $this->_data = $data->getString('data'); + $this->_createStamp = $data->getInt('createStamp'); } } diff --git a/source/Feedlabs/Feedify/Resource/EntryList.php b/source/Feedlabs/Feedify/Resource/EntryList.php new file mode 100644 index 0000000..a71a67e --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/EntryList.php @@ -0,0 +1,16 @@ +_data = $data; + public function __construct(Params $data) { + parent::__construct($data); + $this->_name = ($data->has('name')) ? $data->getString('name') : null; + $this->_description = ($data->has('description')) ? $data->getString('description') : null; + $this->_channelId = ($data->has('channelId')) ? $data->getString('channelId') : null; + $this->_entryList = ($data->has('entryList')) ? $data->get('entryList') : null; } /** - * @return array + * @return string */ - public function getData() { - return $this->_data; + public function getName() { + if (null === $this->_name) { + $this->_load(); + } + return $this->_name; } /** - * @return array + * @return string */ - public function delete() { - return $this->_getRequest()->delete('/feed/' . $this->getId()); + public function getDescription() { + if (null === $this->_description) { + $this->_load(); + } + return $this->_description; } /** - * @return Request + * @return string */ - protected function _getRequest() { - return Client::getRequest(); + public function getChannelId() { + if (null === $this->_channelId) { + $this->_load(); + } + return $this->_channelId; + } + + public function getEntryList() { + if (null === $this->_entryList) { + // todo: load over API + $entryList = []; + for ($i = 0; $i < 3; $i++) { + $entryList[] = ['id' => 'id' . $i, 'data' => 'Data-' . $i, 'createStamp' => time()]; + } + // ////////////////////////////////////// + $this->_entryList = new EntryList($entryList); + } + + return $this->_entryList; + } + + public function delete() { + // todo: add delete + } + + protected function _load() { + // todo: get feed infos over API + $data = new Params([ + 'name' => 'Feed123', + 'description' => 'description123', + 'channelId' => 'channelId-123', + 'createStamp' => time(), + ]); + // ////////////////////////////////////// + + $this->_name = $data->getString('name'); + $this->_description = $data->getString('description'); + $this->_channelId = $data->getString('channelId'); + $this->_createStamp = $data->getInt('createStamp'); } } diff --git a/source/Feedlabs/Feedify/Resource/FeedList.php b/source/Feedlabs/Feedify/Resource/FeedList.php new file mode 100644 index 0000000..429974a --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/FeedList.php @@ -0,0 +1,16 @@ +_token = $data->getString('token'); + $this->_name = $data->getString('name'); + $this->_createStamp = $data->getInt('createStamp'); + } + + /** + * @return string|null + */ + public function getToken() { + return $this->_token; + } + + /** + * @return string + */ + public function getName() { + return $this->_name; + } + + /** + * @return int + */ + public function getCreated() { + return $this->_createStamp; + } + + /** + * @return array + */ + public function delete() { + // todo: add delete + } + + /** + * @return Request + */ + protected function _getRequest() { + return Client::getRequest(); + } +} diff --git a/source/Feedlabs/Feedify/Resource/TokenList.php b/source/Feedlabs/Feedify/Resource/TokenList.php new file mode 100644 index 0000000..17cc516 --- /dev/null +++ b/source/Feedlabs/Feedify/Resource/TokenList.php @@ -0,0 +1,16 @@ +assertSame($data, $feed->getData()); } - public function testGetFeedList() { - } - - public function testCreateFeed() { - } - - public function testUpdateFeed() { - } - - public function testDeleteFeed() { - } - - public function testCreateEntry() { - } - public function testGetRequest() { $id = 'foo123'; $token = 'bar123'; diff --git a/tests/source/Feedlabs/Tests/Feedify/RequestTest.php b/tests/source/Feedlabs/Tests/Feedify/RequestTest.php index 1f179ca..4bc7df6 100644 --- a/tests/source/Feedlabs/Tests/Feedify/RequestTest.php +++ b/tests/source/Feedlabs/Tests/Feedify/RequestTest.php @@ -8,9 +8,7 @@ class RequestTest extends TestCase { public function testConstruct() { - $request = new Request('foo', 'bar'); - - $this->assertSame('foo', $request->getApiId()); + $request = new Request('bar'); $this->assertSame('bar', $request->getApiToken()); } @@ -29,6 +27,6 @@ public function testPost() { $expected = ['id' => '111']; /** @var Request $request */ - $this->assertSame($expected, $request->get('www.example.com')); + $this->assertSame($expected, $request->post('www.example.com', $expected)); } }