Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luca committed Dec 9, 2017
1 parent 560061b commit cf14f4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion examples/get_available_couriers.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@

require '../src/autoload.php';

$sdk = new Qapla\Qapla(['auth' => '{YOUR-AUTH-KEY}']);
try{
$sdk = new Qapla\Qapla(['auth' => '{YOUR-AUTH-KEY}']);
}
catch(Qapla\QaplaSDKException $e){
exit($e->getMessage());
}

$_response = $sdk->get('/1.1/getCouriers/');

Expand Down
6 changes: 4 additions & 2 deletions src/qapla/Qapla.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Qapla {

const SDK_VERSION = '0.5-alpha';

const API_VERSION = '1.1';

const AUTH_KEY = '';

protected $config;
Expand All @@ -48,7 +50,7 @@ public function __construct(array $config = []){
public function get($endpoint, $params = []){

if(!empty($params)){
//return $this->api($endpoint.http_build_query($params), 'GET');

return $this->api($endpoint, 'GET', $params); //fixed get endpoint build with params
}

Expand All @@ -66,7 +68,7 @@ private function api($endpoint, $method, $params = [], $callback = ''){

if($method == 'GET'){

$endpoint .= '?auth='.$this->config['auth'];
$endpoint .= '?apiKey='.$this->config['auth'];

if(!empty($params)){
$endpoint .= '?auth='.$this->config['auth'].'&'.http_build_query($params); //fixed get endpoint build with params
Expand Down

0 comments on commit cf14f4b

Please sign in to comment.