Skip to content

Commit

Permalink
Deprecate CallFlow Title usage
Browse files Browse the repository at this point in the history
This field is deprecated now although users still can send and receive it.
  • Loading branch information
surik committed Apr 25, 2022
1 parent c2aa9e2 commit 85367c9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion examples/voice-call-flows-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

$messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.
$callFlow = new \MessageBird\Objects\Voice\CallFlow();
$callFlow->title = 'Foobar';
$step = new \MessageBird\Objects\Voice\Step();
$step->action = 'say';
$step->options = [
Expand Down
1 change: 0 additions & 1 deletion examples/voice-call-flows-update.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

$messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.
$callFlow = new \MessageBird\Objects\Voice\CallFlow();
$callFlow->title = 'Foobar updated';

try {
$result = $messageBird->voiceCallFlows->update($callFlow, '21e5fc51-3285-4f41-97fd-cd1785ab54f8');
Expand Down
1 change: 0 additions & 1 deletion examples/voice-calls-create.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
$call->source = '31971234567';
$call->destination = '31612345678';
$callFlow = new \MessageBird\Objects\Voice\CallFlow();
$callFlow->title = 'Say message';
$step = new \MessageBird\Objects\Voice\Step();
$step->action = 'say';
$step->options = [
Expand Down
6 changes: 6 additions & 0 deletions src/MessageBird/Objects/Voice/CallFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class CallFlow extends Base
*/
protected $updatedAt;

function __construct() {
if ($this->title == null) {
unset($this->title);
}
}

/**
* @inheritdoc
*/
Expand Down
1 change: 1 addition & 0 deletions src/MessageBird/Resources/Voice/CallFlows.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class CallFlows extends Base
public function __construct(Common\HttpClient $httpClient)
{
$this->object = new Objects\Voice\CallFlow();
unset($this->object->title);
$this->setResourceName('call-flows');

parent::__construct($httpClient);
Expand Down
4 changes: 1 addition & 3 deletions tests/Integration/Voice/VoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ public function testReadVoiceCallFlow(): void
public function testCreateVoiceCallFlow(): void
{
$callFlow = new CallFlow();
$callFlow->title = 'Foobar';
$callFlow->steps = [
[
'action' => 'transfer',
Expand All @@ -365,7 +364,6 @@ public function testCreateVoiceCallFlow(): void
"data": [
{
"id": "de3ed163-d5fc-45f4-b8c4-7eea7458c635",
"title": "Forward call to 31612345678",
"steps": [
{
"id": "3538a6b8-5a2e-4537-8745-f72def6bd393",
Expand Down Expand Up @@ -397,7 +395,7 @@ public function testCreateVoiceCallFlow(): void
"POST",
'call-flows',
null,
'{"title":"Foobar","steps":[{"action":"transfer","options":{"destination":"31612345678"}}]}'
'{"steps":[{"action":"transfer","options":{"destination":"31612345678"}}]}'
);
$this->client->voiceCallFlows->create($callFlow);
}
Expand Down

0 comments on commit 85367c9

Please sign in to comment.