Skip to content

Commit

Permalink
Merge branch 'release/v2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
genaromadrid committed Feb 16, 2016
2 parents 5dabb58 + af5a687 commit 9b7e6bb
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 18 deletions.
8 changes: 5 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Document methods:
$document = new Document([
'file' => 'path/to/my-file.pdf',
// OR
'original_hash' => hash('sha256', 'some-file-contents'),
'original_hash' => hash('sha256', file_get_contents('path/to/my-file.pdf')),
'signatories' => [
{
'name' => 'Signer 1',
Expand All @@ -78,7 +78,8 @@ Document methods:
- Delete

```php
$document->delete();
use Mifiel\Document;
Document::delete('id');
```

Certificate methods:
Expand Down Expand Up @@ -120,7 +121,8 @@ Certificate methods:
- Delete

```php
$certificate->delete();
use Mifiel\Certificate;
Certificate::delete('id');
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mifiel/api-client",
"description": "Mifiel API Client for PHP",
"version": "1.0.1",
"version": "2.0.0",
"keywords": [
"Firma electrónica",
"Firma electrónica Avanzada",
Expand Down
4 changes: 2 additions & 2 deletions src/BaseObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public function save(){
$this->values = (object) json_decode($response->getBody());
}

public function delete(){
public static function delete($id){
self::validateResuorceName();
$response = ApiClient::delete(
static::$resourceName . '/' . $this->id
static::$resourceName . '/' . $id
);
}

Expand Down
6 changes: 1 addition & 5 deletions tests/CertificateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,13 @@ public function testSetGetProperties() {
}

public function testDelete() {
$certificate = new Certificate([
'id' => 'some-id'
]);

m::mock('alias:Mifiel\ApiClient')
->shouldReceive('delete')
->with('keys/some-id')
->andReturn(new \GuzzleHttp\Psr7\Response)
->once();

$certificate->delete();
Certificate::delete('some-id');
}

public function testSat() {
Expand Down
6 changes: 1 addition & 5 deletions tests/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,13 @@ public function testSetGetProperties() {
}

public function testDelete() {
$document = new Document([
'id' => 'some-id'
]);

m::mock('alias:Mifiel\ApiClient')
->shouldReceive('delete')
->with('documents/some-id')
->andReturn(new \GuzzleHttp\Psr7\Response)
->once();

$document->delete();
Document::delete('some-id');
}

}
2 changes: 1 addition & 1 deletion tests/integration/CertificateCRUDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testSetProperties() {
public function testDelete() {
$certificate = $this->getCertificate();
if ($certificate)
$certificate->delete();
Certificate::delete($certificate->id);
$certificates = Certificate::all();
$this->assertEmpty($certificates);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/DocumentCRUDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testSetProperties() {
public function testDelete() {
$documents = Document::all();
foreach ($documents as $document) {
$document->delete();
Document::delete($document->id);
}
$documents = Document::all();
$this->assertEmpty($documents);
Expand Down

0 comments on commit 9b7e6bb

Please sign in to comment.