From 9016b58c008cb050eafbfa042c2a23e9814cddf9 Mon Sep 17 00:00:00 2001 From: Noemi Date: Wed, 29 Nov 2023 10:56:03 -0300 Subject: [PATCH] insert and change endPoints --- .editorconfig | 15 --- .php-cs-fixer.php | 18 ++++ .php_cs.dist.php | 40 -------- composer.json | 15 +-- src/Contracts/IssJuridicoFactory.php | 2 +- src/Contracts/Resources/ContractContract.php | 15 --- .../Programmatic/ContractContract.php | 15 --- src/IssJuridico.php | 21 +---- src/Resources/Contracts.php | 31 ------ src/Resources/Documents.php | 94 +++++++++++++++++++ src/Resources/Programmatic/Contracts.php | 31 ------ src/Resources/Programmatic/Programmatic.php | 20 ---- 12 files changed, 126 insertions(+), 191 deletions(-) delete mode 100644 .editorconfig create mode 100644 .php-cs-fixer.php delete mode 100644 .php_cs.dist.php delete mode 100644 src/Contracts/Resources/ContractContract.php delete mode 100644 src/Contracts/Resources/Programmatic/ContractContract.php delete mode 100644 src/Resources/Contracts.php create mode 100644 src/Resources/Documents.php delete mode 100644 src/Resources/Programmatic/Contracts.php delete mode 100644 src/Resources/Programmatic/Programmatic.php diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index a7c44dd..0000000 --- a/.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_size = 4 -indent_style = space -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false - -[*.{yml,yaml}] -indent_size = 2 diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..310d887 --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,18 @@ +in(__DIR__); + +$config = new Config(); +$config->setRules([ + '@PSR2' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'] +]) + ->setLineEnding("\n") + ->setFinder($finder); + +return $config; diff --git a/.php_cs.dist.php b/.php_cs.dist.php deleted file mode 100644 index 8d8a790..0000000 --- a/.php_cs.dist.php +++ /dev/null @@ -1,40 +0,0 @@ -in([ - __DIR__ . '/src', - __DIR__ . '/tests', - ]) - ->name('*.php') - ->notName('*.blade.php') - ->ignoreDotFiles(true) - ->ignoreVCS(true); - -return (new PhpCsFixer\Config()) - ->setRules([ - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'ordered_imports' => ['sort_algorithm' => 'alpha'], - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, - 'trailing_comma_in_multiline' => true, - 'phpdoc_scalar' => true, - 'unary_operator_spaces' => true, - 'binary_operator_spaces' => true, - 'blank_line_before_statement' => [ - 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], - ], - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_var_without_name' => true, - 'class_attributes_separation' => [ - 'elements' => [ - 'method' => 'one', - ], - ], - 'method_argument_space' => [ - 'on_multiline' => 'ensure_fully_multiline', - 'keep_multiple_spaces_after_comma' => true, - ], - 'single_trait_insert_per_statement' => true, - ]) - ->setFinder($finder); diff --git a/composer.json b/composer.json index 263d136..5432f97 100644 --- a/composer.json +++ b/composer.json @@ -39,11 +39,6 @@ "Bildvitta\\IssJuridico\\Tests\\": "tests" } }, - "scripts": { - "analyse": "vendor/bin/phpstan analyse", - "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest coverage" - }, "config": { "sort-packages": true, "allow-plugins": { @@ -61,5 +56,13 @@ } }, "minimum-stability": "dev", - "prefer-stable": true + "prefer-stable": true, + "scripts": { + "check-style": [ + "vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php --diff --verbose --dry-run" + ], + "fix-style": [ + "vendor/bin/php-cs-fixer fix --config .php-cs-fixer.php" + ] + } } diff --git a/src/Contracts/IssJuridicoFactory.php b/src/Contracts/IssJuridicoFactory.php index 9f13c13..6eeb15c 100644 --- a/src/Contracts/IssJuridicoFactory.php +++ b/src/Contracts/IssJuridicoFactory.php @@ -7,7 +7,7 @@ interface IssJuridicoFactory public const DEFAULT_HEADERS = [ 'content-type' => 'application/json', 'accept' => 'application/json', - 'User-Agent' => 'ISS v0.0.1-alpha', + 'User-Agent' => 'iss-juridico v0.0.1-alpha', ]; public const DEFAULT_OPTIONS = ['allow_redirects' => false]; diff --git a/src/Contracts/Resources/ContractContract.php b/src/Contracts/Resources/ContractContract.php deleted file mode 100644 index 4f0ccba..0000000 --- a/src/Contracts/Resources/ContractContract.php +++ /dev/null @@ -1,15 +0,0 @@ -getToken(); - Cache::add($clientId, $accessToken, now()->addSeconds(31536000)); - } + $accessToken = $this->getToken(); $this->token = $accessToken; } @@ -82,16 +76,9 @@ public function getHeaders() ); } - public function contracts(): Contracts + public function documents(): Documents { - return new Contracts($this); + return new Documents($this); } - /** - * @return Programmatic - */ - public function programmatic(): Programmatic - { - return new Programmatic($this); - } } diff --git a/src/Resources/Contracts.php b/src/Resources/Contracts.php deleted file mode 100644 index c5b8fc9..0000000 --- a/src/Resources/Contracts.php +++ /dev/null @@ -1,31 +0,0 @@ -juridico = $juridico; - } - - public function search(array $query = []): object - { - return $this->juridico->request->get(self::ENDPOINT_PREFIX, $query)->throw()->object(); - } - - public function find(string $uuid): object - { - return $this->crm->request->get(vsprintf(self::ENDPOINT_FIND_BY_UUID, [$uuid]))->throw()->object(); - } - - public function create(array $body = []): object - { - return $this->juridico->request->post(self::ENDPOINT_PREFIX, $body)->throw()->object(); - } -} diff --git a/src/Resources/Documents.php b/src/Resources/Documents.php new file mode 100644 index 0000000..bf266a1 --- /dev/null +++ b/src/Resources/Documents.php @@ -0,0 +1,94 @@ +juridico = $juridico; + } + + public function list($data) + { + return $this->juridico->request->get( + 'documents', + $data + )->throw()->object(); + } + + public function send($data) + { + return $this->juridico->request->post( + 'documents/send', + $data + )->throw()->object(); + } + + public function view($data) + { + return $this->juridico->request->post( + 'documents/view', + $data + )->throw()->object(); + } + + public function historic($data) + { + return $this->juridico->request->get( + sprintf('documents/historic'), + $data + )->throw()->object(); + } + + public function historicDocument($uuidDocument,$data) + { + return $this->juridico->request->get( + sprintf('documents/%s/historic', $uuidDocument), + $data + )->throw()->object(); + } + + public function download($uuidDocument) + { + return $this->juridico->request->get( + sprintf('documents/%s/download', $uuidDocument), + )->throw()->object(); + } + + public function verifySignatures($uuidDocument) + { + return $this->juridico->request->get( + sprintf('documents/%s/verify-signatures', $uuidDocument), + )->throw()->object(); + } + + public function cancel($uuidDocument,$data) + { + return $this->juridico->request->get( + sprintf('documents/%s/cancel', $uuidDocument), + $data + )->throw()->object(); + } + + public function resendSigner($uuidDocument, $uuidSigner) + { + return $this->juridico->request->get( + sprintf('documents/%s/resend-signer/%s', $uuidDocument, $uuidSigner) + )->throw()->object(); + } + + public function changeSigner($uuidDocument, $uuidSigner,$data) + { + return $this->juridico->request->get( + sprintf('documents/%s/change-signer/%s', $uuidDocument, $uuidSigner), + $data + )->throw()->object(); + } + +} diff --git a/src/Resources/Programmatic/Contracts.php b/src/Resources/Programmatic/Contracts.php deleted file mode 100644 index c2a7082..0000000 --- a/src/Resources/Programmatic/Contracts.php +++ /dev/null @@ -1,31 +0,0 @@ -juridico = $juridico; - } - - public function search(array $query = []): object - { - return $this->juridico->request->get(self::ENDPOINT_PREFIX, $query)->throw()->object(); - } - - public function find(string $uuid): object - { - return $this->crm->request->get(vsprintf(self::ENDPOINT_FIND_BY_UUID, [$uuid]))->throw()->object(); - } - - public function create(array $body = []): object - { - return $this->juridico->request->post(self::ENDPOINT_PREFIX, $body)->throw()->object(); - } -} diff --git a/src/Resources/Programmatic/Programmatic.php b/src/Resources/Programmatic/Programmatic.php deleted file mode 100644 index 37e9b2c..0000000 --- a/src/Resources/Programmatic/Programmatic.php +++ /dev/null @@ -1,20 +0,0 @@ -issJuridico); - } -}