Skip to content

Commit 599874e

Browse files
committed
fluent method signatures and version bump
1 parent 3865821 commit 599874e

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
1.1.0
6+
=====
7+
+ Fluent method signatures where appropriate on Fax and Document objects.
8+
+ Distinct Test namespace to ensure individual test file running is supported.
9+
510
1.0.3
611
=====
712
+ Documentation correction for the outbound fax status retrieval.

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ $document = $client->documents->create($filename, filesize($filename), $params);
379379
### Upload chunk
380380

381381
```php
382-
$document->upload($start, $end, $data);
382+
$document->upload($start, $end, $data); // returns the document object.
383383
```
384384

385385
Note no verification of data takes place - an exception wil be raised if values do not match appropriately.
@@ -402,7 +402,7 @@ $document->uri;
402402

403403
### Cancel document
404404

405-
`$document->cancel();`
405+
`$document->cancel(); //returns the $document instance`
406406

407407
Can be done prior to completion or afterward
408408

@@ -415,11 +415,13 @@ The `Interfax\Outbound\Fax` class wraps the details of any fax sent, and is retu
415415
It offers several methods to manage or retrieve information about the fax.
416416

417417
```php
418+
// fluent methods that return the $fax instance
418419
$fax->refresh(); // refreshes the data on the fax object
419420
$fax->cancel(); // cancel the fax, returns true on success
421+
$fax->hide(); // hides the faxes from the fax lists
422+
420423
$image = $fax->image(); // returns Interfax\Image
421424
$new_fax = $fax->resend('+1111111'); // returns a new Interfax\Outbound\Fax
422-
$fax->hide();
423425
$fax->attributes(); // hash array of fax data properties - see details below
424426
```
425427

@@ -452,10 +454,12 @@ Status should always be available. The values of the status codes are [Documente
452454
The incoming equivalent of the outbound fax class, the ```Interfax\Inbound\Fax``` class wraps the details of any incoming fax, and is returned by the ```Interfax\Inbound``` methods where appropriate.
453455

454456
```php
457+
// fluent methods that return the $fax instance for method chaining
455458
$fax->refresh(); // reload properties of the inbound fax
456459
$fax->markRead(); // mark the fax read - returns true or throws exception
457460
$fax->markUnread(); // mark the fax unread - returns true or throws exception
458461
$fax->resend();
462+
459463
$image = $fax->image(); // Returns a Interfax\Image for this fax
460464
$email_array = $fax->emails(); // see below for details on the structure of this array
461465
$fax->attributes(); // hash array of properties

src/Interfax/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class Client
2222
{
23-
const VERSION = '1.0.3';
23+
const VERSION = '1.1.0';
2424

2525
/**
2626
* @var GenericFactory

src/Interfax/Document.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Document extends Resource
2020
* @param $start
2121
* @param $end
2222
* @param $data
23-
* @return bool
23+
* @return self
2424
* @throws \Interfax\Exception\RequestException
2525
*/
2626
public function upload($start, $end, $data)
@@ -35,17 +35,17 @@ public function upload($start, $end, $data)
3535

3636
$this->client->post($this->resource_uri, $params);
3737

38-
return true;
38+
return $this;
3939
}
4040

4141
/**
42-
* @return bool
42+
* @return self
4343
*/
4444
public function cancel()
4545
{
4646
$this->client->delete($this->resource_uri);
4747
$this->record = [];
48-
return true;
48+
return $this;
4949
}
5050

5151
public function getHeaderLocation()

src/Interfax/Inbound/Fax.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ class Fax extends Resource
2323

2424
/**
2525
* @param bool $unread
26-
* @return bool
26+
* @return self
2727
* @throws RequestException
2828
*/
2929
protected function mark($unread = true)
3030
{
3131
$this->client->post($this->resource_uri, ['query' => ['unread' => $unread]]);
3232

33-
// lack of exception indicates success
34-
return true;
33+
return $this;
3534
}
3635

3736
/**
38-
* @return bool
37+
* @return self
3938
* @throws RequestException
4039
*/
4140
public function markRead()
@@ -44,7 +43,7 @@ public function markRead()
4443
}
4544

4645
/**
47-
* @return bool
46+
* @return self
4847
* @throws RequestException
4948
*/
5049
public function markUnread()
@@ -54,7 +53,7 @@ public function markUnread()
5453

5554
/**
5655
* @param string $email
57-
* @return bool
56+
* @return self
5857
* @throws RequestException
5958
*/
6059
public function resend($email = null)
@@ -65,8 +64,7 @@ public function resend($email = null)
6564
}
6665
$this->client->post($this->resource_uri . '/resend', $params);
6766

68-
// lack of exception indicates success
69-
return true;
67+
return $this;
7068
}
7169

7270
/**

src/Interfax/Outbound/Fax.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ public function resend($fax_number = null)
5252
}
5353

5454
/**
55-
* @return bool
55+
* @return self
5656
* @throws RequestException
5757
*/
5858
public function cancel()
5959
{
6060
$this->client->post($this->resource_uri . '/cancel');
6161

62-
return true;
62+
return $this;
6363
}
6464

6565
/**
66-
* @return bool
66+
* @return self
6767
* @throws RequestException
6868
*/
6969
public function hide()
7070
{
7171
$this->client->post($this->resource_uri . '/hide');
7272

73-
return true;
73+
return $this;
7474
}
7575

7676
/**

0 commit comments

Comments
 (0)