-
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.
Merge pull request #6 from taciobrito/master
Update Plans and Subscriptions
- Loading branch information
Showing
7 changed files
with
313 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,49 @@ | ||
<?php | ||
|
||
namespace Zoop\Contracts; | ||
|
||
use Zoop\Lib\APIResource; | ||
|
||
interface ZoopPlans{ | ||
|
||
/** | ||
* API Resource. | ||
* | ||
* @param $APIResource $APIResource | ||
*/ | ||
public function __construct(APIResource $APIResource); | ||
|
||
/** | ||
* Create a new Plan | ||
* | ||
* @param $post array | ||
*/ | ||
public function create($post); | ||
|
||
/** | ||
* Update a created plan | ||
* | ||
* @param $planID string | ||
* @param $post array | ||
*/ | ||
public function update($planID, $post); | ||
|
||
/** | ||
* Delete a Plan by id | ||
* | ||
* @param $planID string | ||
*/ | ||
public function delete($planID); | ||
|
||
/** | ||
* Retrieve the details of a Plan by id | ||
* | ||
* @param $planID string | ||
*/ | ||
public function get($planID); | ||
|
||
/** | ||
* Returns a JSON object with a list of plans. | ||
*/ | ||
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,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 ZoopPlans extends Facade{ | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor(){ | ||
return 'ZoopPlans'; | ||
} | ||
} |
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,67 @@ | ||
<?php | ||
|
||
namespace Zoop\Lib; | ||
|
||
|
||
class ZoopPlans implements \Zoop\Contracts\ZoopPlans { | ||
|
||
/** | ||
* API Resource | ||
* | ||
* @var object | ||
*/ | ||
protected $APIResource; | ||
|
||
/** | ||
* ZoopPlans constructor. | ||
* @param APIResource $APIResource | ||
*/ | ||
public function __construct(APIResource $APIResource){ | ||
$this->APIResource = $APIResource; | ||
} | ||
|
||
/** | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function create($post = []){ | ||
$api = 'plans'; | ||
return $this->APIResource->createAPI($api, $post); | ||
} | ||
|
||
/** | ||
* @param string $planID | ||
* @param array $post | ||
* @return mixed | ||
*/ | ||
public function update($planID, $post){ | ||
$api = 'plans/' . $planID; | ||
return $this->APIResource->updateAPI($api, $post); | ||
} | ||
|
||
/** | ||
* @param string $planID | ||
* @return mixed | ||
*/ | ||
public function delete($planID){ | ||
$api = 'plans/' . $planID; | ||
return $this->APIResource->deleteAPI($api); | ||
} | ||
|
||
/** | ||
* @param string $planID | ||
* @return mixed | ||
*/ | ||
public function get($planID){ | ||
$api = 'plans/' . $planID; | ||
return $this->APIResource->searchAPI($api); | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getAll(){ | ||
$api = 'plans'; | ||
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
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