-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update ApiRequestor.php Fixed params for isset() * Added OutboundVoiceProfile Added OutboundVoiceProfile * Create OutboundVoiceProfileTest.php Create OutboundVoiceProfileTest.php * Updated Tests Updated Tests * Add Address + Inbound Channels Added Address.php Added InboudnChannel.php Added tests for both * Update InboundChannelsTest.php Updated InboundChannelsTest.php to use correct params
- Loading branch information
Showing
6 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Telnyx; | ||
|
||
/** | ||
* Class Address | ||
* | ||
* @package Telnyx | ||
*/ | ||
class Address extends ApiResource | ||
{ | ||
const OBJECT_NAME = "address"; | ||
|
||
use ApiOperations\All; | ||
use ApiOperations\Create; | ||
use ApiOperations\Delete; | ||
use ApiOperations\Retrieve; | ||
|
||
/** | ||
* @return string The endpoint associated with this singleton class. | ||
*/ | ||
public static function classUrl() | ||
{ | ||
// Replace dots with slashes for namespaced resources, e.g. if the object's name is | ||
// "foo.bar", then its URL will be "/v2/foo/bar". | ||
// NOTE: This endpoint is special because object name is "address" and endpoint is "addresses" | ||
return "/v2/addresses"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Telnyx; | ||
|
||
/** | ||
* Class InboundChannel | ||
* | ||
* @package Telnyx | ||
*/ | ||
class InboundChannel extends ApiResource | ||
{ | ||
const OBJECT_NAME = "inbound_channels"; | ||
const OBJECT_URL = "/v2/phone_numbers/inbound_channels"; | ||
|
||
/** | ||
* @param array|null $params | ||
* @param array|string|null $options | ||
* | ||
* @return Returns the inbound channels for your account. | ||
*/ | ||
public static function retrieve() | ||
{ | ||
$url = self::OBJECT_URL; | ||
|
||
list($response, $opts) = static::_staticRequest('get', $url, null, null); | ||
$obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); | ||
$obj->setLastResponse($response); | ||
return $obj; | ||
} | ||
|
||
/** | ||
* @param array|null $params | ||
* @param array|string|null $options | ||
* | ||
* @return Update the inbound channels for the account | ||
*/ | ||
public static function update($params = null) | ||
{ | ||
self::_validateParams($params); | ||
$url = self::OBJECT_URL; | ||
|
||
list($response, $opts) = static::_staticRequest('patch', $url, $params, null); | ||
$obj = \Telnyx\Util\Util::convertToTelnyxObject($response->json, $opts); | ||
$obj->setLastResponse($response); | ||
return $obj; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Telnyx; | ||
|
||
class AddressTest extends TestCase | ||
{ | ||
const TEST_RESOURCE_ID = '123'; | ||
|
||
|
||
public function testIsListable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v2/addresses' | ||
); | ||
$resources = Address::all(); | ||
$this->assertInstanceOf(\Telnyx\Collection::class, $resources); | ||
$this->assertInstanceOf(\Telnyx\Address::class, $resources[0]); | ||
} | ||
|
||
public function testIsCreatable() | ||
{ | ||
$this->expectsRequest( | ||
'post', | ||
'/v2/addresses' | ||
); | ||
$resource = Address::create(['administrative_area'=>'IL']); | ||
$this->assertInstanceOf(\Telnyx\Address::class, $resource); | ||
} | ||
|
||
public function testIsDeletable() | ||
{ | ||
$resource = Address::retrieve(self::TEST_RESOURCE_ID); | ||
$this->expectsRequest( | ||
'delete', | ||
'/v2/addresses/' . urlencode(self::TEST_RESOURCE_ID) | ||
); | ||
$resource->delete(); | ||
$this->assertInstanceOf(\Telnyx\Address::class, $resource); | ||
} | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v2/addresses/' . urlencode(self::TEST_RESOURCE_ID) | ||
); | ||
$resource = Address::retrieve(self::TEST_RESOURCE_ID); | ||
$this->assertInstanceOf(\Telnyx\Address::class, $resource); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Telnyx; | ||
|
||
class InboundChannelTest extends TestCase | ||
{ | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v2/phone_numbers/inbound_channels' | ||
); | ||
$resource = InboundChannel::retrieve(); | ||
$this->assertInstanceOf(\Telnyx\InboundChannel::class, $resource); | ||
} | ||
|
||
public function testIsUpdatable() | ||
{ | ||
$this->expectsRequest( | ||
'patch', | ||
'/v2/phone_numbers/inbound_channels' | ||
); | ||
$resource = InboundChannel::update([ | ||
"channels" => 10, | ||
]); | ||
$this->assertInstanceOf(\Telnyx\InboundChannel::class, $resource); | ||
} | ||
|
||
} |