-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Chelout\PhpSdk\Actions; | ||
|
||
use Chelout\PhpSdk\Resources\Funnel; | ||
use Chelout\PhpSdk\Resources\ApiResourceCollection; | ||
|
||
trait ManagesFunnels | ||
{ | ||
public function funnels(): ApiResourceCollection | ||
{ | ||
$response = $this->get('funnels'); | ||
|
||
return new ApiResourceCollection($response, Funnel::class); | ||
} | ||
|
||
public function createFunnel(array $data): Funnel | ||
{ | ||
$response = $this->post('funnels', $data); | ||
|
||
return new Funnel($response); | ||
} | ||
|
||
public function funnel(int $id): Funnel | ||
{ | ||
$response = $this->get("funnels/{$id}"); | ||
|
||
return new Funnel($response); | ||
} | ||
|
||
public function updateFunnel(int $id, array $data): Funnel | ||
{ | ||
$response = $this->put("funnels/{$id}", $data); | ||
|
||
return new Funnel($response); | ||
} | ||
|
||
public function deleteFunnel(int $id) | ||
{ | ||
$this->delete("funnels/{$id}"); | ||
} | ||
} |
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
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,13 @@ | ||
<?php | ||
|
||
namespace Chelout\PhpSdk\Resources; | ||
|
||
class Funnel extends ApiResource | ||
{ | ||
/** | ||
* Funnel name. | ||
* | ||
* @var string | ||
*/ | ||
public $name; | ||
} |