From 8692d150fce9042e8f91e38db0868c89a747187c Mon Sep 17 00:00:00 2001 From: Arman Tuyakbayev Date: Tue, 11 Feb 2020 14:30:04 +0600 Subject: [PATCH] Remove Notes (#389) * Remove Notes * Add changelog * Increase version --- CHANGELOG.md | 7 ++ src/Client.php | 4 +- src/Entities/Note.php | 140 ----------------------------------- src/Entities/Schema.php | 6 -- src/Services/NoteService.php | 91 ----------------------- tests/Api/ApiTest.php | 1 - tests/Api/ServiceTest.php | 5 -- tests/TestCase.php | 2 - 8 files changed, 8 insertions(+), 248 deletions(-) delete mode 100644 src/Entities/Note.php delete mode 100644 src/Services/NoteService.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 55ea006a6..d5adfe8d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,10 +15,17 @@ Security - in case of vulnerabilities. ## [Unreleased] +_TBD_ + +## [2.7.0] 2020-02-11 + ### Added - [x] Added new property to `SubscriptionChangePlan`: `quantity` - [x] Added new properties to `ApiTracking`: `relatedIds`, `requestHeaders`, `responseHeaders` +### Removed +- [x] Removed `Note` entity, `NoteService` service + ## [2.6.0] 2020-01-14 ### Added diff --git a/src/Client.php b/src/Client.php index ef808d883..b5c8c32e0 100644 --- a/src/Client.php +++ b/src/Client.php @@ -61,7 +61,6 @@ * @method Services\TransactionService transactions() * @method Services\SubscriptionReactivationService subscriptionReactivations() * @method Services\WebsiteService websites() - * @method Services\NoteService notes() * @method Services\OrganizationService organizations() * @method Services\CustomFieldService customFields() * @method Services\GatewayAccountService gatewayAccounts() @@ -99,7 +98,7 @@ final class Client public const CURRENT_VERSION = 'v2.1'; - public const SDK_VERSION = '2.6.0'; + public const SDK_VERSION = '2.7.0'; private static $services = [ 'authenticationOptions' => Services\AuthenticationOptionsService::class, @@ -127,7 +126,6 @@ final class Client 'files' => Services\FileService::class, 'attachments' => Services\AttachmentService::class, 'products' => Services\ProductService::class, - 'notes' => Services\NoteService::class, 'organizations' => Services\OrganizationService::class, 'customFields' => Services\CustomFieldService::class, 'gatewayAccounts' => Services\GatewayAccountService::class, diff --git a/src/Entities/Note.php b/src/Entities/Note.php deleted file mode 100644 index 245914984..000000000 --- a/src/Entities/Note.php +++ /dev/null @@ -1,140 +0,0 @@ -getAttribute('createdTime'); - } - - /** - * @return string - */ - public function getArchivedTime() - { - return $this->getAttribute('archivedTime'); - } - - /** - * @return string - */ - public function getRelatedType() - { - return $this->getAttribute('relatedType'); - } - - /** - * @param string $value - * - * @return $this - */ - public function setRelatedType($value) - { - if (!in_array($value, self::relatedTypes(), true)) { - throw new DomainException(sprintf(self::MSG_UNEXPECTED_TYPE, implode(', ', self::relatedTypes()))); - } - - return $this->setAttribute('relatedType', $value); - } - - /** - * @return string - */ - public function getRelatedId() - { - return $this->getAttribute('relatedId'); - } - - /** - * @param string $value - * - * @return $this - */ - public function setRelatedId($value) - { - return $this->setAttribute('relatedId', $value); - } - - /** - * @return string - */ - public function getContent() - { - return $this->getAttribute('content'); - } - - /** - * @param string $value - * - * @return $this - */ - public function setContent($value) - { - return $this->setAttribute('content', $value); - } - - /** - * @return bool - */ - public function getArchived() - { - return $this->getAttribute('archived'); - } - - /** - * @param string $value - * - * @return $this - */ - public function setArchived($value) - { - return $this->setAttribute('archived', $value); - } - - /** - * @return string - */ - public function getCreatedBy() - { - return $this->getAttribute('createdBy'); - } -} diff --git a/src/Entities/Schema.php b/src/Entities/Schema.php index 87b816720..caeab46a4 100644 --- a/src/Entities/Schema.php +++ b/src/Entities/Schema.php @@ -204,12 +204,6 @@ public function __construct() 'authentication-tokens/{token}/exchange' => function (array $content) { return new Session($content); }, - 'notes' => function (array $content) { - return new Collection(new Note(), $content); - }, - 'notes/{noteId}' => function (array $content) { - return new Note($content); - }, 'organizations' => function (array $content) { return new Collection(new Organization(), $content); }, diff --git a/src/Services/NoteService.php b/src/Services/NoteService.php deleted file mode 100644 index 0b774b98f..000000000 --- a/src/Services/NoteService.php +++ /dev/null @@ -1,91 +0,0 @@ -client(), 'notes', $params); - } - - /** - * @param array|ArrayObject $params - * - * @return Note[]|Collection - */ - public function search($params = []) - { - return $this->client()->get('notes', $params); - } - - /** - * @param string $noteId - * @param array|ArrayObject $params - * - * @throws NotFoundException The resource data does not exist - * - * @return Note - */ - public function load($noteId, $params = []) - { - return $this->client()->get('notes/{noteId}', ['noteId' => $noteId] + (array) $params); - } - - /** - * @param array|JsonSerializable|Note $data - * @param string $noteId - * - * @throws UnprocessableEntityException The input data does not valid - * - * @return Note - */ - public function create($data, $noteId = null) - { - if (isset($noteId)) { - return $this->client()->put($data, 'notes/{noteId}', ['noteId' => $noteId]); - } - - return $this->client()->post($data, 'notes'); - } - - /** - * @param string $noteId - * @param array|JsonSerializable|Note $data - * - * @throws UnprocessableEntityException The input data does not valid - * - * @return Note - */ - public function update($noteId, $data) - { - return $this->client()->put($data, 'notes/{noteId}', ['noteId' => $noteId]); - } -} diff --git a/tests/Api/ApiTest.php b/tests/Api/ApiTest.php index f87540ddb..623e7138b 100644 --- a/tests/Api/ApiTest.php +++ b/tests/Api/ApiTest.php @@ -161,7 +161,6 @@ public function provideEntityClasses() [Entities\LineItem::class, null], [Entities\Transaction::class], [Entities\Website::class], - [Entities\Note::class], [Entities\Organization::class], [Entities\GatewayAccount::class], [Entities\BankAccount::class], diff --git a/tests/Api/ServiceTest.php b/tests/Api/ServiceTest.php index 622876f35..a8a0bce9b 100644 --- a/tests/Api/ServiceTest.php +++ b/tests/Api/ServiceTest.php @@ -1206,11 +1206,6 @@ public function provideServiceClasses() Services\WebsiteService::class, Entities\Website::class, ], - [ - 'notes', - Services\NoteService::class, - Entities\Note::class, - ], [ 'organizations', Services\OrganizationService::class, diff --git a/tests/TestCase.php b/tests/TestCase.php index df6fd120a..81cd2e05f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -420,8 +420,6 @@ protected function getFakeValue($attribute, $class) switch ($class) { case Entities\Attachment::class: return $faker->randomElement(Entities\Attachment::allowedTypes()); - case Entities\Note::class: - return $faker->randomElement(Entities\Note::relatedTypes()); default: throw new InvalidArgumentException( sprintf('Cannot generate fake value for "%s :: %s"', $class, $attribute)