-
Notifications
You must be signed in to change notification settings - Fork 18
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
p_917148
committed
Jul 29, 2019
1 parent
60d3675
commit 04435e5
Showing
4 changed files
with
176 additions
and
5 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,63 @@ | ||
<?php | ||
|
||
namespace Zoop\Contracts; | ||
|
||
use Zoop\Lib\APIResource; | ||
|
||
interface ZoopSubscriptions{ | ||
|
||
/** | ||
* API Resource. | ||
* | ||
* @param $APIResource $APIResource | ||
*/ | ||
public function __construct(APIResource $APIResource); | ||
|
||
/** | ||
* Create a new Subscription | ||
* | ||
* @param $post array | ||
*/ | ||
public function create($post); | ||
|
||
/** | ||
* Update a created Subscription | ||
* | ||
* @param $subscriptionID string | ||
* @param $post array | ||
*/ | ||
public function update($subscriptionID, $post); | ||
|
||
/** | ||
* Delete a Subscription by id | ||
* | ||
* @param $subscriptionID string | ||
*/ | ||
public function delete($subscriptionID); | ||
|
||
/** | ||
* Suspend a Subscription by id | ||
* | ||
* @param $subscriptionID string | ||
*/ | ||
public function suspend($subscriptionID); | ||
|
||
/** | ||
* Reactivate a Subscription by id | ||
* | ||
* @param $subscriptionID string | ||
*/ | ||
public function reactivate($subscriptionID); | ||
|
||
/** | ||
* Retrieve the details of a Subscription by id | ||
* | ||
* @param $subscriptionID string | ||
*/ | ||
public function get($subscriptionID); | ||
|
||
/** | ||
* Returns a JSON object with a list of Subscriptions. | ||
*/ | ||
public function getAll(); | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace Zoop\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class ZoopSubscriptions extends Facade{ | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor(){ | ||
return 'ZoopSubscriptions'; | ||
} | ||
} |
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,87 @@ | ||
<?php | ||
|
||
namespace Zoop\Lib; | ||
|
||
|
||
class ZoopSubscriptions implements \Zoop\Contracts\ZoopSubscriptions { | ||
|
||
/** | ||
* API Resource | ||
* | ||
* @var object | ||
*/ | ||
protected $APIResource; | ||
|
||
/** | ||
* ZoopSubscriptions constructor. | ||
* @param APIResource $APIResource | ||
*/ | ||
public function __construct(APIResource $APIResource){ | ||
$this->APIResource = $APIResource; | ||
} | ||
|
||
/** | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function create($post = []){ | ||
$api = 'subscriptions'; | ||
return $this->APIResource->createAPI($api, $post); | ||
} | ||
|
||
/** | ||
* @param string $subscriptionID | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function update($subscriptionID, $post){ | ||
$api = 'subscriptions/' . $subscriptionID; | ||
return $this->APIResource->updateAPI($api, $post); | ||
} | ||
|
||
/** | ||
* @param string $subscriptionID | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function suspend($subscriptionID){ | ||
$api = 'subscriptions/' . $subscriptionID . '/suspend'; | ||
return $this->APIResource->createAPI($api); | ||
} | ||
|
||
/** | ||
* @param string $subscriptionID | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function reactivate($subscriptionID){ | ||
$api = 'subscriptions/' . $subscriptionID . '/reactivate'; | ||
return $this->APIResource->createAPI($api); | ||
} | ||
|
||
/** | ||
* @param string $subscriptionID | ||
* @return mixed | ||
*/ | ||
public function delete($subscriptionID){ | ||
$api = 'subscriptions/' . $subscriptionID; | ||
return $this->APIResource->deleteAPI($api); | ||
} | ||
|
||
/** | ||
* @param string $subscriptionID | ||
* @return mixed | ||
*/ | ||
public function get($subscriptionID){ | ||
$api = 'subscriptions/' . $subscriptionID; | ||
return $this->APIResource->searchAPI($api); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getAll(){ | ||
$api = 'subscriptions'; | ||
return $this->APIResource->searchAPI($api); | ||
} | ||
} |
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