From 6162b9daf91e71f990c0e76250bdf3eefb4d5307 Mon Sep 17 00:00:00 2001 From: caddy1970 Date: Wed, 13 May 2015 13:03:21 +0200 Subject: [PATCH] Update WGAPI.php Added new API for wgn and replaced the wot-deprecated calls. --- WGAPI.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/WGAPI.php b/WGAPI.php index 916348c..049a6ff 100644 --- a/WGAPI.php +++ b/WGAPI.php @@ -19,6 +19,7 @@ class WGAPI { private $apikey = NULL; private $access_token = NULL; + private $api_format_wgn = "api.worldoftanks.%s/wgn/%s/%s/"; private $api_format_wot = "api.worldoftanks.%s/wot/%s/%s/"; private $api_format_wowp = "api.worldofwarplanes.%s/wowp/%s/%s/"; @@ -191,7 +192,7 @@ function clanList($search, $limit = 100, $order_by = "", $fields = array()) { if(count($fields) > 0) $request_data['fields'] = $fields; - return $this->doRequest(sprintf($this->api_format_wot, $this->tld, "clan", "list"), $request_data); + return $this->doRequest(sprintf($this->api_format_wgn, $this->tld, "clans", "list"), $request_data); } /* @@ -328,7 +329,7 @@ function clanMemberInfo($member_id, $fields = array()) { if(count($fields) > 0) $request_data['fields'] = $fields; - return $this->doRequest(sprintf($this->api_format_wot, $this->tld, "clan", "membersinfo"), $request_data); + return $this->doRequest(sprintf($this->api_format_wgn, $this->tld, "clans", "membersinfo"), $request_data); } //////////////////////////// @@ -540,7 +541,11 @@ private function formStandardClanRequest($function, $clan_id, $fields) { if(count($fields) > 0) $request_data['fields'] = $fields; - return $this->doRequest(sprintf($this->api_format_wot, $this->tld, "clan", $function), $request_data); + // wot api for clans is partial deprecated... + if( $function === 'info' ) + return $this->doRequest(sprintf($this->api_format_wgn, $this->tld, "clans", $function), $request_data); + else + return $this->doRequest(sprintf($this->api_format_wot, $this->tld, "clan", $function), $request_data); } /////////////////////////////////// @@ -586,4 +591,4 @@ private function doRequest($url, $data, $force_https = false) { return $response; } } -?> \ No newline at end of file +?>