1 | <?php |
||
5 | class EnvatoApi |
||
6 | { |
||
7 | /** |
||
8 | * Envanto API bearer token. |
||
9 | * |
||
10 | * @var string |
||
11 | **/ |
||
12 | private $bearer; |
||
13 | |||
14 | /** |
||
15 | * Purchase verification endpoint. |
||
16 | * |
||
17 | * @var string |
||
18 | **/ |
||
19 | protected $url = 'https://api.envato.com/v3/market/author/sale?code='; |
||
20 | |||
21 | /** |
||
22 | * Request headers. |
||
23 | * |
||
24 | * @var array |
||
25 | **/ |
||
26 | private $headers; |
||
27 | |||
28 | /** |
||
29 | * Create EnvantoApi Instance. |
||
30 | **/ |
||
31 | public function __construct($bearer) |
||
36 | |||
37 | //end __construct() |
||
38 | |||
39 | /** |
||
40 | * Make a call to the Envato API to verify purchase. |
||
41 | * |
||
42 | * @return mixed Guzzle\Response::getBody() |
||
43 | * |
||
44 | * @param string $code |
||
45 | **/ |
||
46 | public function getPurchaseData($code) |
||
67 | |||
68 | //end getPurchaseData() |
||
69 | |||
70 | /** |
||
71 | * Verify purchase. |
||
72 | * |
||
73 | * @return string Array |
||
74 | * |
||
75 | * @param string $code Purchase Code |
||
76 | **/ |
||
77 | public function verifyPurchase(string $code) |
||
87 | |||
88 | //end verifyPurchase() |
||
89 | |||
90 | /** |
||
91 | * setting the header for the rest of the api. |
||
92 | **/ |
||
93 | protected function buildHeaders() |
||
106 | |||
107 | //end buildHeaders() |
||
108 | }//end class |
||
109 |