Exemplo n.º 1
0
 /**
  * Mock/Force the initialization of a REST call.
  * Typically avoiding some HTTP request processing.
  * Circumvents the need to go through a REST client to invoke the API.
  *
  * @param Api_AbstractRest $rest
  * @param array $apiParams
  *
  * @return The initialized REST object.
  */
 protected function initRest(Api_AbstractRest &$rest, $apiParams)
 {
     $context = Api_RequestContext::createRequestContext($apiParams);
     $rest->_setContext($context);
     $rest->validateRequest();
     return $rest;
 }
Exemplo n.º 2
0
 /**
  * Mock/Force the initialization of a REST call.
  * Typically avoiding the Session creation and other HTTP request processing.
  *
  * @param Api_AbstractRest $rest
  * @param string $uid
  * @param array $apiParams
  * @return The initialized REST object.
  */
 protected function initRest(Api_AbstractRest &$rest, $apiParams, $uid = null, $aid = null, $nid = null, &$session = array())
 {
     if ($uid != null) {
         $session['uid'] = $uid;
     }
     if ($aid != null) {
         $session['app_id'] = $aid;
     }
     if ($nid != null) {
         $session['network_key'] = $nid;
     }
     $context = Api_RequestContext::createRequestContext($apiParams);
     $rest->_setContext($context);
     $rest->_setSession($session);
     $rest->validateRequest();
     return $rest;
 }