From 5fbbaf41750882fd96806736906e2d6aac3d8beb Mon Sep 17 00:00:00 2001 From: mayder Date: Wed, 17 Aug 2022 12:07:19 -0300 Subject: [PATCH] =?UTF-8?q?Altera=C3=A7=C3=A3o=20da=20vari=C3=A1vel=20sand?= =?UTF-8?q?box=20que=20espera=20uma=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 195 +------------------------------------------ src/BaseResource.php | 2 +- 2 files changed, 2 insertions(+), 195 deletions(-) diff --git a/README.md b/README.md index b050a21..9aa9de1 100644 --- a/README.md +++ b/README.md @@ -1,194 +1 @@ -#### AUTENTIQUE Api v2 - -[![Latest Stable Version](https://img.shields.io/packagist/v/mayder/autentique-v2)](https://packagist.org/packages/mayder/autentique-v2) -[![Total Downloads](https://poser.pugx.org/mayder/autentique-v2/downloads)](https://packagist.org/packages/mayder/autentique-v2) -[![Build Status](https://travis-ci.org/mayder/autentique-v2.svg?branch=master)](https://travis-ci.org/mayder/autentique-v2) -[![codecov](https://codecov.io/gh/mayder/autentique-v2/branch/master/graph/badge.svg)](https://codecov.io/gh/mayder/autentique-v2) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mayder/autentique-v2/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mayder/autentique-v2/?branch=master) -[![Code Intelligence Status](https://scrutinizer-ci.com/g/mayder/autentique-v2/badges/code-intelligence.svg?b=master)](https://scrutinizer-ci.com/code-intelligence) -[![License](https://poser.pugx.org/mayder/autentique-v2/license)](https://packagist.org/packages/mayder/autentique-v2) - -# šŸš€ Usage - -## This package is so simple to use that it will save your time. - -```bash -composer require mayder/autentique-v2 -``` - -## āš ļø IMPORTANT - -This library depends on **vlucas/phpdotenv** to get environments variables **(.env)**
-If you use a framework like **Laravel**, you don't need to download this library. - -```bash -composer require vlucas/phpdotenv -``` - -**Set in file .env** - -```env -AUTENTIQUE_URL=https://api.autentique.com.br/v2/graphql -AUTENTIQUE_TOKEN="YOUR_TOKEN" -AUTENTIQUE_DEV_MODE="true" || "false" -# if TRUE, document will be created in mode sandbox -``` - -# Instance -**Import library** - -```php -use mayder\Autentique\Documents; - -$AUTENTIQUE_TOKEN="xxxxxxxx" (set or will be take in .env) - -$documents = new Documents($AUTENTIQUE_TOKEN); - -$folders = new Folders($AUTENTIQUE_TOKEN); -``` - -Why documents/folders receive token? -- Easily to manage Documents in multiples accounts (token) - -# šŸ“ Documents -### 1 - List all documents with pagination - -```php -$documentsPaginated = documents->listAll($page); // if not isset $page is equal 1 -``` - -### 2 - List the document by id - -```php -$document = $documents->listById($documentId); -``` - -### 3 - Create a document - -```php -$attributes = [ - 'document' => [ - 'name' => 'NOME DO DOCUMENTO', - ], - 'signers' => [ - [ - 'email' => 'email@email.com', - 'action' => 'SIGN', - 'positions' => [ - [ - 'x' => '50', // PosiĆ§Ć£o do Eixo X da ASSINATURA (0 a 100) - 'y' => '80', // PosiĆ§Ć£o do Eixo Y da ASSINATURA (0 a 100) - 'z' => '1', // PĆ”gina da ASSINATURA - ], - [ - 'x' => '50', // PosiĆ§Ć£o do Eixo X da ASSINATURA (0 a 100) - 'y' => '50', // PosiĆ§Ć£o do Eixo Y da ASSINATURA (0 a 100) - 'z' => '2', // PĆ”gina da ASSINATURA - ], - ], - ], - [ - 'email' => 'email@email.com', - 'action' => 'SIGN', - 'positions' => [ - [ - 'x' => '50', // PosiĆ§Ć£o do Eixo X da ASSINATURA (0 a 100) - 'y' => '80', // PosiĆ§Ć£o do Eixo Y da ASSINATURA (0 a 100) - 'z' => '1', // PĆ”gina da ASSINATURA - ], - [ - 'x' => '50', // PosiĆ§Ć£o do Eixo X da ASSINATURA (0 a 100) - 'y' => '50', // PosiĆ§Ć£o do Eixo Y da ASSINATURA (0 a 100) - 'z' => '2', // PĆ”gina da ASSINATURA - ], - ], - ], - ], - 'file' => './dummy.pdf', - ]; - - $documentCreated = $documents->create($attributes); - ``` - -### 4 - Sign the document by id - -```php -$documentSign = $documents->signById($documentId); -``` - -### 5 - Delete the document by id - -```php -$documentDeleted = $documents->deleteById($documentId); -``` - - -# šŸ“ Folders -### 1 - List all folders - -```php -$foldersPaginated = folders->listAll($page); // if not isset $page is equal 1 -``` - -### 2 - List the folder by id - -```php -$folder = $folders->listById($folderId); -``` - -### 3 - Create a folder - -```php -$attributes = [ - "folder" => [ - "name" => "folder name", - ], -]; - -$folder = $folders->create($attributes); - ``` - -### 4 - List the folder contents by id - -```php -$folderContents = $folders->listContentsById($folderId, $page = 1); -``` - -### 5 - Delete a folder - -```php -$folderDeleted = $folders->deleteById($folderId); -``` -# šŸ”§ Contributing - -### šŸ’» Setup - -```sh -git clone git@github.com:mayder/autentique-v2.git -cd autentique-v2 -composer install -npm install -``` - -### āš™ļø Configure - -#### Create .env with variables - -```sh -./contribute.sh -``` - -#### Configure prettier php in vscode - -(CTRL + P) > Preferences: Open Setting (JSON) - -```json - "emeraldwalk.runonsave": { - "commands": [ - { - "match": "\\.php$", - "cmd": "npm run prettier -- ${relativeFile} --write", - }, - ] - } -``` +#### AUTENTIQUE Api v2 \ No newline at end of file diff --git a/src/BaseResource.php b/src/BaseResource.php index 4f2e387..d17920b 100644 --- a/src/BaseResource.php +++ b/src/BaseResource.php @@ -14,7 +14,7 @@ class BaseResource public function __construct(string $autentiqueURL = "", bool $autentiqueDevMode = false) { $this->api = new Api($autentiqueURL); - $this->sandbox = $autentiqueDevMode; + $this->sandbox = $autentiqueDevMode?"true":"false"; $this->resourcesEnum = ResourcesEnum::class; } }