-
Notifications
You must be signed in to change notification settings - Fork 853
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the File Link resource
- Loading branch information
1 parent
5c881b4
commit e4ada8a
Showing
6 changed files
with
99 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
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 Stripe; | ||
|
||
/** | ||
* Class FileLink | ||
* | ||
* @property string $id | ||
* @property string $object | ||
* @property int $created | ||
* @property bool $expired | ||
* @property int $expires_at | ||
* @property string $file | ||
* @property string $purpose | ||
* @property bool $livemode | ||
* @property StripeObject $metadata | ||
* @property string $url | ||
* | ||
* @package Stripe | ||
*/ | ||
class FileLink extends ApiResource | ||
{ | ||
|
||
const OBJECT_NAME = "file_link"; | ||
|
||
use ApiOperations\All; | ||
use ApiOperations\Create; | ||
use ApiOperations\Retrieve; | ||
use ApiOperations\Update; | ||
} |
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,65 @@ | ||
<?php | ||
|
||
namespace Stripe; | ||
|
||
class FileLinkTest extends TestCase | ||
{ | ||
const TEST_RESOURCE_ID = 'fl_123'; | ||
|
||
public function testIsListable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/file_links' | ||
); | ||
$resources = FileLink::all(); | ||
$this->assertTrue(is_array($resources->data)); | ||
$this->assertInstanceOf("Stripe\\FileLink", $resources->data[0]); | ||
} | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/file_links/' . self::TEST_RESOURCE_ID | ||
); | ||
$resource = FileLink::retrieve(self::TEST_RESOURCE_ID); | ||
$this->assertInstanceOf("Stripe\\FileLink", $resource); | ||
} | ||
|
||
public function testIsCreatable() | ||
{ | ||
$this->expectsRequest( | ||
'post', | ||
'/v1/file_links' | ||
); | ||
$resource = FileLink::create([ | ||
"file" => "file_123" | ||
]); | ||
$this->assertInstanceOf("Stripe\\FileLink", $resource); | ||
} | ||
|
||
public function testIsSaveable() | ||
{ | ||
$resource = FileLink::retrieve(self::TEST_RESOURCE_ID); | ||
$resource->metadata["key"] = "value"; | ||
$this->expectsRequest( | ||
'post', | ||
'/v1/file_links/' . $resource->id | ||
); | ||
$resource->save(); | ||
$this->assertInstanceOf("Stripe\\FileLink", $resource); | ||
} | ||
|
||
public function testIsUpdatable() | ||
{ | ||
$this->expectsRequest( | ||
'post', | ||
'/v1/file_links/' . self::TEST_RESOURCE_ID | ||
); | ||
$resource = FileLink::update(self::TEST_RESOURCE_ID, [ | ||
"metadata" => ["key" => "value"], | ||
]); | ||
$this->assertInstanceOf("Stripe\\FileLink", $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