Skip to content

Commit

Permalink
Rename Ding to Prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightwatson committed May 16, 2024
1 parent 045cf4a commit 86603db
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 42 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/roomies-com/phonable/test.yml?branch=main&label=tests&style=flat-square)](https://github.com/roomies-com/phonable/actions?query=workflow%3Atest+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/roomies/phonable.svg?style=flat-square)](https://packagist.org/packages/roomies/phonable)

Roomies Phonable provides an abstraction layer to identify and verify phone numbers in your Laravel app. Phone verification can be used to help identify legitmate users of your app and also serve as a way to handle 2-factor authentication. Phonable provides implementations for a number of phone services including [Ding](https://ding.live), [Twilio](https://www.twilio.com), and [Vonage](https://vonage.com).
Roomies Phonable provides an abstraction layer to identify and verify phone numbers in your Laravel app. Phone verification can be used to help identify legitmate users of your app and also serve as a way to handle 2-factor authentication. Phonable provides implementations for a number of phone services including [Prelude](https://prelude.so) (previously Ding), [Twilio](https://www.twilio.com), and [Vonage](https://vonage.com).

## Installation

Expand All @@ -24,7 +24,7 @@ Read through the config file to understand the supported services and provide th

## Identification

Identification is a way to gather more information about a phone number including the country of origin, phone number type and more. This feature is supported by Ding and Vonage.
Identification is a way to gather more information about a phone number including the country of origin, phone number type and more. This feature is supported by Prelude and Vonage.

```php
// Return an instance of \Roomies\Phonable\Identification\IdentificationResult
Expand Down Expand Up @@ -57,12 +57,12 @@ You can swap the driver out on the fly as necessary.
```php
use Roomies\Phonable\Facades\Identification;

Identification::driver('ding')->get($user);
Identification::driver('prelude')->get($user);
```

## Verification

Verification is a two-step process in sending a generated code to a phone number that then needs to be entered back into your app to complete the process. This ensures your user has timely access to the phone number provided. This feature is supported by Ding, Twilio, and Vonage.
Verification is a two-step process in sending a generated code to a phone number that then needs to be entered back into your app to complete the process. This ensures your user has timely access to the phone number provided. This feature is supported by Prelude, Twilio, and Vonage.



Expand Down Expand Up @@ -130,7 +130,7 @@ You can swap the driver out on the fly as necessary.
```php
use Roomies\Phonable\Facades\Verification;

Verification::driver('ding')->send($user);
Verification::driver('prelude')->send($user);
```

## License
Expand Down
16 changes: 8 additions & 8 deletions config/phonable.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
| This option controls the default identification driver when using this
| feature. You can swap this driver on the fly if required.
|
| Supported drivers: "ding", "vonage"
| Supported drivers: "prelude", "vonage"
|
*/
'identification' => [
'default' => env('PHONE_IDENTIFICATION_SERVICE', 'ding'),
'default' => env('PHONE_IDENTIFICATION_SERVICE', 'prelude'),
],

/*
Expand All @@ -25,11 +25,11 @@
| This option controls the default verification driver when using this
| feature. You can swap this driver on the fly if required.
|
| Supported drivers: "ding", "twilio", "vonage"
| Supported drivers: "prelude", "twilio", "vonage"
|
*/
'verification' => [
'default' => env('PHONE_VERIFICATION_SERVICE', 'ding'),
'default' => env('PHONE_VERIFICATION_SERVICE', 'prelude'),
],

/*
Expand All @@ -40,14 +40,14 @@
| Here you can configure the required credentials and additional metadata
| for each supported external phone service.
|
| Supported drivers: "ding", "twilio", "vonage"
| Supported drivers: "prelude", "twilio", "vonage"
|
*/
'services' => [

'ding' => [
'key' => env('DING_KEY'),
'customer_uuid' => env('DING_CUSTOMER_UUID'),
'prelude' => [
'key' => env('PRELUDE_KEY'),
'customer_uuid' => env('PRELUDE_CUSTOMER_UUID'),
],

'twilio' => [
Expand Down
10 changes: 5 additions & 5 deletions src/Identification/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public function getDefaultDriver(): string
}

/**
* Create an instance of the Ding driver.
* Create an instance of the Prelude driver.
*/
public function createDingDriver(): Ding
public function createPreludeDriver(): Prelude
{
return new Ding(
$this->config['phonable.services.ding.key'],
$this->config['phonable.services.ding.customer_uuid'],
return new Prelude(
$this->config['phonable.services.prelude.key'],
$this->config['phonable.services.prelude.customer_uuid'],
$this->getContainer()->make('request')->ip(),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
use Roomies\Phonable\Contracts\PhoneIdentifiable;
use SensitiveParameter;

class Ding implements IdentifiesPhoneNumbers
class Prelude implements IdentifiesPhoneNumbers
{
/**
* The authenticated HTTP client.
*/
protected PendingRequest $client;

/**
* Create a new Ding instance.
* Create a new Prelude instance.
*/
public function __construct(
#[SensitiveParameter] protected string $apiKey = '',
Expand Down
10 changes: 5 additions & 5 deletions src/Verification/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ public function getDefaultDriver(): string
}

/**
* Create an instance of the Ding driver.
* Create an instance of the Prelude driver.
*/
public function createDingDriver(): Ding
public function createPreludeDriver(): Prelude
{
return new Ding(
$this->config['phonable.services.ding.key'],
$this->config['phonable.services.ding.customer_uuid'],
return new Prelude(
$this->config['phonable.services.prelude.key'],
$this->config['phonable.services.prelude.customer_uuid'],
$this->getContainer()->make('request')->ip(),
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Verification/Ding.php → src/Verification/Prelude.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
use Roomies\Phonable\Contracts\VerifiesPhoneNumbers;
use SensitiveParameter;

class Ding implements VerifiesPhoneNumbers
class Prelude implements VerifiesPhoneNumbers
{
/**
* The authenticated HTTP client.
*/
protected PendingRequest $client;

/**
* Create a new Ding instance.
* Create a new Prelude instance.
*/
public function __construct(
#[SensitiveParameter] protected string $apiKey = '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Roomies\Phonable\Tests\Identification;

use Illuminate\Support\Facades\Http;
use Roomies\Phonable\Identification\Ding;
use Roomies\Phonable\Identification\Prelude;
use Roomies\Phonable\Tests\TestCase;

class DingTest extends TestCase
class PreludeTest extends TestCase
{
public function test_it_handles_string()
{
Expand All @@ -18,7 +18,7 @@ public function test_it_handles_string()
], 200, ['content-type' => 'application/json']),
]);

$result = app(Ding::class)->get('+12125550000');
$result = app(Prelude::class)->get('+12125550000');

$this->assertEquals('carrier_name', $result->carrierName);
$this->assertEquals('carrier_country', $result->carrierCountry);
Expand All @@ -39,7 +39,7 @@ public function test_it_handle_us_number()
], 200, ['content-type' => 'application/json']),
]);

$result = app(Ding::class)->get($identifiable);
$result = app(Prelude::class)->get($identifiable);

$this->assertEquals('carrier_name', $result->carrierName);
$this->assertEquals('carrier_country', $result->carrierCountry);
Expand All @@ -54,7 +54,7 @@ public function test_it_handles_failure()
'api.ding.live/v1/lookup/+12125550000' => Http::response(null, 404),
]);

$result = app(Ding::class)->get($identifiable);
$result = app(Prelude::class)->get($identifiable);

$this->assertNull($result);
}
Expand Down
20 changes: 10 additions & 10 deletions tests/Verification/DingTest.php → tests/Verification/Prelude.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use Illuminate\Support\Facades\Http;
use Roomies\Phonable\Tests\TestCase;
use Roomies\Phonable\Verification\Ding;
use Roomies\Phonable\Verification\Prelude;
use Roomies\Phonable\Verification\VerificationResult;

class DingTest extends TestCase
class PreludeTest extends TestCase
{
public function test_send_creates_verification_request()
{
Expand All @@ -17,7 +17,7 @@ public function test_send_creates_verification_request()
], 200),
]);

$result = app(Ding::class)->send('+12125550000');
$result = app(Prelude::class)->send('+12125550000');

$this->assertEquals('abc-123', $result->id);
$this->assertEquals('+12125550000', $result->phoneNumber);
Expand All @@ -33,7 +33,7 @@ public function test_send_creates_verification_request_with_verifiable()

$verifiable = new Verifiable;

$result = app(Ding::class)->send($verifiable);
$result = app(Prelude::class)->send($verifiable);

$this->assertEquals('abc-123', $result->id);
$this->assertEquals($verifiable->getVerifiablePhoneNumber(), $result->phoneNumber);
Expand All @@ -47,7 +47,7 @@ public function test_verify_returns_for_valid_code()
], 200),
]);

$result = app(Ding::class)->verify('request-id', '1234');
$result = app(Prelude::class)->verify('request-id', '1234');

$this->assertEquals(VerificationResult::Successful, $result);
}
Expand All @@ -62,7 +62,7 @@ public function test_verify_returns_for_valid_code_with_verifiable()

$verifiable = new Verifiable(sessionId: 'request-id');

$result = app(Ding::class)->verify($verifiable, '1234');
$result = app(Prelude::class)->verify($verifiable, '1234');

$this->assertEquals(VerificationResult::Successful, $result);
}
Expand All @@ -75,7 +75,7 @@ public function test_verify_returns_for_already_valid_code()
], 200),
]);

$result = app(Ding::class)->verify('request-id', '1234');
$result = app(Prelude::class)->verify('request-id', '1234');

$this->assertEquals(VerificationResult::Successful, $result);
}
Expand All @@ -88,7 +88,7 @@ public function test_verify_returns_for_expired_code()
], 200),
]);

$result = app(Ding::class)->verify('request-id', '1234');
$result = app(Prelude::class)->verify('request-id', '1234');

$this->assertEquals(VerificationResult::Expired, $result);
}
Expand All @@ -101,7 +101,7 @@ public function test_verify_returns_for_missing_code()
], 200),
]);

$result = app(Ding::class)->verify('request-id', '5678');
$result = app(Prelude::class)->verify('request-id', '5678');

$this->assertEquals(VerificationResult::NotFound, $result);
}
Expand All @@ -114,7 +114,7 @@ public function test_verify_returns_for_invalid_code()
], 200),
]);

$result = app(Ding::class)->verify('request-id', '5678');
$result = app(Prelude::class)->verify('request-id', '5678');

$this->assertEquals(VerificationResult::Invalid, $result);
}
Expand Down

0 comments on commit 86603db

Please sign in to comment.