Skip to content

Commit 9b7e6bb

Browse files
committed
Merge branch 'release/v2.0.0'
2 parents 5dabb58 + af5a687 commit 9b7e6bb

File tree

7 files changed

+12
-18
lines changed

7 files changed

+12
-18
lines changed

Readme.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Document methods:
5858
$document = new Document([
5959
'file' => 'path/to/my-file.pdf',
6060
// OR
61-
'original_hash' => hash('sha256', 'some-file-contents'),
61+
'original_hash' => hash('sha256', file_get_contents('path/to/my-file.pdf')),
6262
'signatories' => [
6363
{
6464
'name' => 'Signer 1',
@@ -78,7 +78,8 @@ Document methods:
7878
- Delete
7979

8080
```php
81-
$document->delete();
81+
use Mifiel\Document;
82+
Document::delete('id');
8283
```
8384

8485
Certificate methods:
@@ -120,7 +121,8 @@ Certificate methods:
120121
- Delete
121122

122123
```php
123-
$certificate->delete();
124+
use Mifiel\Certificate;
125+
Certificate::delete('id');
124126
```
125127

126128
## Contributing

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mifiel/api-client",
33
"description": "Mifiel API Client for PHP",
4-
"version": "1.0.1",
4+
"version": "2.0.0",
55
"keywords": [
66
"Firma electrónica",
77
"Firma electrónica Avanzada",

src/BaseObject.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public function save(){
5454
$this->values = (object) json_decode($response->getBody());
5555
}
5656

57-
public function delete(){
57+
public static function delete($id){
5858
self::validateResuorceName();
5959
$response = ApiClient::delete(
60-
static::$resourceName . '/' . $this->id
60+
static::$resourceName . '/' . $id
6161
);
6262
}
6363

tests/CertificateTest.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,13 @@ public function testSetGetProperties() {
8787
}
8888

8989
public function testDelete() {
90-
$certificate = new Certificate([
91-
'id' => 'some-id'
92-
]);
93-
9490
m::mock('alias:Mifiel\ApiClient')
9591
->shouldReceive('delete')
9692
->with('keys/some-id')
9793
->andReturn(new \GuzzleHttp\Psr7\Response)
9894
->once();
9995

100-
$certificate->delete();
96+
Certificate::delete('some-id');
10197
}
10298

10399
public function testSat() {

tests/DocumentTest.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,13 @@ public function testSetGetProperties() {
8888
}
8989

9090
public function testDelete() {
91-
$document = new Document([
92-
'id' => 'some-id'
93-
]);
94-
9591
m::mock('alias:Mifiel\ApiClient')
9692
->shouldReceive('delete')
9793
->with('documents/some-id')
9894
->andReturn(new \GuzzleHttp\Psr7\Response)
9995
->once();
10096

101-
$document->delete();
97+
Document::delete('some-id');
10298
}
10399

104100
}

tests/integration/CertificateCRUDTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testSetProperties() {
6565
public function testDelete() {
6666
$certificate = $this->getCertificate();
6767
if ($certificate)
68-
$certificate->delete();
68+
Certificate::delete($certificate->id);
6969
$certificates = Certificate::all();
7070
$this->assertEmpty($certificates);
7171
}

tests/integration/DocumentCRUDTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testSetProperties() {
9898
public function testDelete() {
9999
$documents = Document::all();
100100
foreach ($documents as $document) {
101-
$document->delete();
101+
Document::delete($document->id);
102102
}
103103
$documents = Document::all();
104104
$this->assertEmpty($documents);

0 commit comments

Comments
 (0)