From cc7e4a30b724df47f5c495a264ad4a02ee0932b8 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 14 May 2015 17:15:56 -0400 Subject: [PATCH 1/2] Sky API changed to accommodate new vf server version 3 --- lib/Sky/Api.php | 50 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/lib/Sky/Api.php b/lib/Sky/Api.php index 875cd6f..35078f1 100644 --- a/lib/Sky/Api.php +++ b/lib/Sky/Api.php @@ -139,10 +139,45 @@ public function __construct($oauth_token = null) // set the identity -- this implies your Identity class is in the // Api namespace. $identityClass = '\\' . get_called_class() . '\\Identity'; - $this->identity = $identityClass::get($oauth_token); - // initialize output response $responseClass = '\\' . get_called_class() . '\\Response'; - $this->response = new $responseClass(); + //d($identityClass, $responseClass); + if($identityClass == "\Vfolder\Api_v2\Identity"){ + $identityClass = "\Vfolder\Api_v2\Identity"; + $responseClass = "\Vfolder\Api_v2\Item"; + $this->identity = new $identityClass(); + + $venue_ide = $_POST[1]; + $filename = $_POST[2]; + if($_POST[5] == 1){ + $crop = true; + }else{ + $crop = false; + } + if($_POST[6] == 1){ + $resize = true; + }else{ + $resize = false; + } + $config = [ + 'width' => $_POST[3], + 'height' => $_POST[4], + 'crop' =>$crop, + 'resize'=>$resize + ]; + $params = [ + 'venue_ide'=>$venue_ide, + 'filename'=>$filename, + 'config'=>$config + ]; + //d($this, $request, $_POST, $venue_ide, $filename, $config, $params); + + $this->response = \Vfolder\Api_v2\Item::getItem($params); + }else{ + $this->identity = $identityClass::get($oauth_token); + // initialize output response + $this->response = new $responseClass(); + } + //d($this->response); } /** @@ -153,7 +188,7 @@ public function __construct($oauth_token = null) * @return \Sky\Api\Response */ public static function call($path, $oauth_token, array $params = array()) - { + { // first check to make sure protocol is ok if (!static::isProtocolOk()) { return static::error(500, 'https_required', 'HTTPS is required.'); @@ -161,7 +196,12 @@ public static function call($path, $oauth_token, array $params = array()) try { $apiClass = get_called_class(); $o = $apiClass::init($oauth_token); - $ret = $o->apiCall($path, $params); + if(get_class($o) == "Vfolder\Api_v2"){ + $ret = $o; + }else{ + $ret = $o->apiCall($path, $params); + } + //d($ret); return $ret; } catch (\Exception $e) { return static::error(500, 'internal_error', $e->getMessage(), $e); From df49eaf247f40b4ac696bfc5539e4db75b77742e Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 20 May 2015 17:48:13 -0400 Subject: [PATCH 2/2] v3 media server --- lib/Sky/Api.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Sky/Api.php b/lib/Sky/Api.php index 35078f1..d8b1fb3 100644 --- a/lib/Sky/Api.php +++ b/lib/Sky/Api.php @@ -164,10 +164,16 @@ public function __construct($oauth_token = null) 'crop' =>$crop, 'resize'=>$resize ]; + $flyer_type = ""; + if(isset($_POST[8])){ + $flyer_type = $_POST[8]; + } $params = [ 'venue_ide'=>$venue_ide, 'filename'=>$filename, - 'config'=>$config + 'config'=>$config, + 'type'=>$_POST[7], + 'flyer_type'=>$flyer_type ]; //d($this, $request, $_POST, $venue_ide, $filename, $config, $params);