diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..52eca8c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [2.0.0] + +### Changed features + +Rename method names for permission driver \ No newline at end of file diff --git a/README.md b/README.md index d0f4571..5d92630 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Authentication token is generated per UserManager instance. Expire time is two h With the usage in this example, you can submit a single release. This method works with the "Permission" model ```php - IysManager::make()->createPermissionDriver()->sendSinglePermission( + IysManager::make()->createPermissionDriver()->sendSingle( Permission::make() ->setConsentDate('2022-02-10 09:50:02') ->setSource(ConsentSourceTypes::MOBILE) @@ -134,24 +134,24 @@ You can send permissions by filling out the permission list model. The permissio ->setSource(ConsentSourceTypes::MOBILE) ->setRecipientType(RecipientTypes::INDIVIDUAL); - IysManager::make()->createPermissionDriver()->sendPermissions($permissionList); + IysManager::make()->createPermissionDriver()->sendMultiple($permissionList); ``` You can get send permission information with request id ```php - IysManager::make()->createPermissionDriver()->getPermissionsStatus('request_id'); + IysManager::make()->createPermissionDriver()->getStatusByRequestId('request_id'); ``` You can get changed permission by IYS ```php - IysManager::make()->createPermissionDriver()->getChangedPermissions(); + IysManager::make()->createPermissionDriver()->getChanges(); ``` You can get permission status by permission model ```php - IysManager::make()->createPermissionDriver()->getPermissionStatus( + IysManager::make()->createPermissionDriver()->getStatus( Permission::make() ->setConsentDate('2022-02-10 09:50:02') ->setSource(ConsentSourceTypes::MOBILE) diff --git a/src/Drivers/Permission/PermissionDriver.php b/src/Drivers/Permission/PermissionDriver.php index 194c0ba..7ebe7c8 100644 --- a/src/Drivers/Permission/PermissionDriver.php +++ b/src/Drivers/Permission/PermissionDriver.php @@ -17,7 +17,7 @@ class PermissionDriver extends AbstractDriver /** * @throws RequestException */ - public function sendSinglePermission(Permission $permission) + public function sendSingle(Permission $permission) { return Http::timeout($this->timeout) ->withToken($this->bearer)->asJson()->acceptJson() @@ -28,7 +28,7 @@ public function sendSinglePermission(Permission $permission) /** * @throws RequestException */ - public function sendPermissions(PermissionList $permissionList) + public function sendMultiple(PermissionList $permissionList) { return Http::timeout($this->timeout) ->withToken($this->bearer)->asJson()->acceptJson() @@ -39,7 +39,7 @@ public function sendPermissions(PermissionList $permissionList) /** * @throws RequestException */ - public function getPermissionsStatus(string $requestId) + public function getStatusByRequestId(string $requestId) { return Http::timeout($this->timeout) ->withToken($this->bearer)->asJson()->acceptJson() @@ -50,7 +50,7 @@ public function getPermissionsStatus(string $requestId) /** * @throws RequestException */ - public function getChangedPermissions(?string $after = null, SourceTypes $source = SourceTypes::IYS, int $limit = 999) + public function getChanges(?string $after = null, SourceTypes $source = SourceTypes::IYS, int $limit = 999) { $query = [ 'source' => $source->value, @@ -70,7 +70,7 @@ public function getChangedPermissions(?string $after = null, SourceTypes $source /** * @throws RequestException */ - public function getPermissionStatus(Permission $permission) + public function getStatus(Permission $permission) { $permissionData = $permission->toArray(); diff --git a/tests/PermissionDriverTest.php b/tests/PermissionDriverTest.php index d253e0b..35ae564 100644 --- a/tests/PermissionDriverTest.php +++ b/tests/PermissionDriverTest.php @@ -51,7 +51,7 @@ public function test_can_send_permission() ]), ]); - IysManager::make()->createPermissionDriver()->sendSinglePermission( + IysManager::make()->createPermissionDriver()->sendSingle( Permission::make() ->setConsentDate($consentDate) ->setSource(ConsentSourceTypes::MOBILE) @@ -99,7 +99,7 @@ public function test_throw_exception_send_permission() $this->expectException(RequestException::class); - IysManager::make()->createPermissionDriver()->sendSinglePermission( + IysManager::make()->createPermissionDriver()->sendSingle( Permission::make() ->setConsentDate($consentDate) ->setSource(ConsentSourceTypes::MOBILE) @@ -171,7 +171,7 @@ public function test_can_send_permissions() ->setStatus(StatusTypes::REJECT) ->setType(PermissionTypes::MESSAGE)); - IysManager::make()->createPermissionDriver()->sendPermissions($permissionList); + IysManager::make()->createPermissionDriver()->sendMultiple($permissionList); Http::assertSent(function (Request $request) use ($endpoint, $recipientFirst, $recipientSecond, $consentDate) { return $request->url() == $this->url . $endpoint && @@ -235,7 +235,7 @@ public function test_throw_exception_send_permissions() $this->expectException(RequestException::class); - IysManager::make()->createPermissionDriver()->sendPermissions($permissionList); + IysManager::make()->createPermissionDriver()->sendMultiple($permissionList); } /** @@ -281,7 +281,7 @@ public function test_get_status_permissions() $this->createHttpFakeToken(); - IysManager::make()->createPermissionDriver()->getPermissionsStatus($requestId); + IysManager::make()->createPermissionDriver()->getStatusByRequestId($requestId); Http::assertSent(function (Request $request) use ($endpoint) { return $request->url() == $this->url . $endpoint; @@ -313,7 +313,7 @@ public function test_throw_exception_get_status_permissions() $this->expectException(RequestException::class); - IysManager::make()->createPermissionDriver()->getChangedPermissions(); + IysManager::make()->createPermissionDriver()->getChanges(); } /** @@ -350,7 +350,7 @@ public function test_get_changed_permissions() ] )]); - IysManager::make()->createPermissionDriver()->getChangedPermissions(); + IysManager::make()->createPermissionDriver()->getChanges(); Http::assertSent(function (Request $request) use ($endpoint) { return $request->url() == $this->url . $endpoint; @@ -394,7 +394,7 @@ public function test_get_changed_permissions_with_options() ] )]); - IysManager::make()->createPermissionDriver()->getChangedPermissions($after, SourceTypes::HS, $limit); + IysManager::make()->createPermissionDriver()->getChanges($after, SourceTypes::HS, $limit); Http::assertSent(function (Request $request) use ($endpoint) { return $request->url() == $this->url . $endpoint; @@ -431,7 +431,7 @@ public function test_throw_exception_get_changed_permissions() $this->expectException(RequestException::class); - IysManager::make()->createPermissionDriver()->getChangedPermissions(); + IysManager::make()->createPermissionDriver()->getChanges(); } /** @@ -463,7 +463,7 @@ public function test_get_permission_status() ]) ]); - IysManager::make()->createPermissionDriver()->getPermissionStatus(Permission::make() + IysManager::make()->createPermissionDriver()->getStatus(Permission::make() ->setConsentDate($consentDate) ->setSource(ConsentSourceTypes::MOBILE) ->setRecipient($recipient) @@ -499,6 +499,6 @@ public function test_throw_exception_get_permission_status() $this->expectException(RequestException::class); - IysManager::make()->createPermissionDriver()->getChangedPermissions(); + IysManager::make()->createPermissionDriver()->getChanges(); } }