@param string $handle The job handle of the job we want to get. Example: 1
@param array  $options

@return \frankmayer\ArangoDbPhpCore\Protocols\Http\HttpResponse
190682
public function fetchJobResult($handle, array $options = [])
    {
        /** @var AbstractHttpRequest $request */
        $request          = $this->getRequest();
        $request->options = $options;
        $request->path    = $this->client->fullDatabasePath . static::API_PATH . '/' . $handle;
        $request->method  = static::METHOD_PUT;

        return $this->getReturnObject($request);
    }
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
1120136
public function get($method, array $params, array $options = array())
    {
        $this->parseOptions($options);

        $params = array_merge($params, $this->apiKeys);

        $response = $this->httpAdapter->getContent(
            sprintf(self::API_ENDPOINT, $this->scheme, $this->outputFormat, $method .'?'. http_build_query($params)),
            $this->headers
        );

        return $this->responseHandler($response);
    }
937180
public static function put($route, $handler, $options = [])
    {
        app()->router->put($route, $handler, $options);
    }
999841
public function run( $handler = null )
	{
		if ( !is_null( $handler ) )
		{
			$this->handler( $handler );
		}
		
		// if there is a special fetch handler defined pass him all the 
		// needed parameters and retrive the results
		if ( !is_null( $this->fetch_handler ) )
		{
			$results = call_user_func_array( $this->fetch_handler, array(
				&$this
			));
		}
		// otherwise simply do the default select fetch
		else 
		{
			$results = $this->handler->fetch( $this->build(), $this->handler->builder()->parameters, $this->fetch_arguments );
		}
		
		// In case we should forward a key means using a value
		// from every result as array key.
		if ( $this->forward_key !== false )
		{
			$raw_results = $results;
			$results = array();
			
			if ( in_array( 'assoc', $this->fetch_arguments ) )
			{
				foreach( $raw_results as $result )
				{
					$results[$result[$this->forward_key]] = $result;
				}
			}
			else
			{
				foreach( $raw_results as $result )
				{
					$results[$result->{$this->forward_key}] = $result;
				}
			}
		}
		
		// Group the results by a value
		if ( $this->group_result !== false )
		{
			$raw_results = $results;
			$results = array();
			
			if ( in_array( 'assoc', $this->fetch_arguments ) )
			{
				foreach( $raw_results as $key => $result )
				{
					$results[$result[$this->group_result]][$key] = $result;
				}
			}
			else
			{
				foreach( $raw_results as $key => $result )
				{
					$results[$result->{$this->group_result}][$key] = $result;
				}
			}
		}
		
		// when the limit is 1 we are going to return the 
		// result directly
		if ( $this->limit === 1 )
		{
			return reset( $results );
		}
		
		return $results;
	}
610223
public function window($handle)
    {
        $params = ['name' => (string) $handle];
        $this->executor->execute(DriverCommand::SWITCH_TO_WINDOW, $params);

        return $this->driver;
    }
1189937
public function getOption($handle)
    {
        return isset($this->options[$handle]) ? $this->options[$handle] : null;
    }
762969
public function getHandler()
    {
        if (is_callable($this->handler)) {
            return $this->handler;
        }

        $options = $this->options;

        return function ($value) use ($options) {
            if (in_array($value, $options)) {
                return true;
            }

            return false;
        };
    }
240303
public function get($url, $headers = [], $options = [])
    {
        return $this->request('GET', $url, null, $headers, $options);
    }
876219
public function get($url, $options = [], $body = null, $raw = true)
    {
        return $this->httpRequest('GET', $this->createUrl($url, $options), $body, $raw);
    }
500109
public function runAjaxHandler($handler)
    {
        /**
         * @event cms.component.beforeRunAjaxHandler
         * Provides an opportunity to modify an AJAX request to a component before it is processed by the component
         *
         * The parameter provided is `$handler` (the requested AJAX handler to be run)
         *
         * Example usage (forwards AJAX handlers to a backend widget):
         *
         *     Event::listen('cms.component.beforeRunAjaxHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler) {
         *         if (strpos($handler, '::')) {
         *             list($componentAlias, $handlerName) = explode('::', $handler);
         *             if ($componentAlias === $this->getBackendWidgetAlias()) {
         *                 return $this->backendControllerProxy->runAjaxHandler($handler);
         *             }
         *         }
         *     });
         *
         * Or
         *
         *     $this->controller->bindEvent('component.beforeRunAjaxHandler', function ((string) $handler) {
         *         if (strpos($handler, '::')) {
         *             list($componentAlias, $handlerName) = explode('::', $handler);
         *             if ($componentAlias === $this->getBackendWidgetAlias()) {
         *                 return $this->backendControllerProxy->runAjaxHandler($handler);
         *             }
         *         }
         *     });
         *
         */
        if ($event = $this->fireSystemEvent('cms.component.beforeRunAjaxHandler', [$handler])) {
            return $event;
        }

        $result = $this->$handler();

        /**
         * @event cms.component.runAjaxHandler
         * Provides an opportunity to modify an AJAX request to a component after it is processed by the component
         *
         * The parameters provided are `$handler` (the requested AJAX handler to be run) and `$result` (the result of the component processing the request)
         *
         * Example usage (Logs requests and their response):
         *
         *     Event::listen('cms.component.beforeRunHandler', function((\Cms\Classes\ComponentBase) $component, (string) $handler, (mixed) $result) {
         *         if (in_array($handler, $interceptHandlers)) {
         *             return 'request has been intercepted, original response: ' . json_encode($result);
         *         }
         *     });
         *
         * Or
         *
         *     $this->controller->bindEvent('componenet.beforeRunAjaxHandler', function ((string) $handler, (mixed) $result) {
         *         if (in_array($handler, $interceptHandlers)) {
         *             return 'request has been intercepted, original response: ' . json_encode($result);
         *         }
         *     });
         *
         */
        if ($event = $this->fireSystemEvent('cms.component.runAjaxHandler', [$handler, $result])) {
            return $event;
        }

        return $result;
    }
404944
public function request($url, $method = 'GET', $options = []): ResponseInterface
    {
        $method = strtoupper($method);

        $options = array_merge(self::$defaults, $options, ['handler' => $this->getHandlerStack()]);

        $options = $this->fixJsonIssue($options);

        if (property_exists($this, 'baseUri') && !is_null($this->baseUri)) {
            $options['base_uri'] = $this->baseUri;
        }

        $response = $this->getHttpClient()->request($method, $url, $options);
        $response->getBody()->rewind();

        return $response;
    }
370895
public static function processRequest(array $options = []) {
        $controller = self::me();
        $request    = Request::me();
        $response   = Response::me();

        // select Module
        $prefix = $controller->getModulePrefix($request);
        $module = $controller->modules[$prefix];
        $request->setAttribute(MODULE_KEY, $module);

        // get RequestProcessor
        $processor = $controller->getRequestProcessor($module, $options);

        // process Request
        $processor->process($request, $response);

        return $response;
    }
731589
public function getHeader($handle, array $options = [])
    {
        /** @var AbstractHttpRequest $request */
        $request          = $this->getRequest();
        $request->options = $options;
        $request->path    = $this->client->fullDatabasePath . static::API_PATH . '/' . $handle;
        $request->method  = static::METHOD_HEAD;

        return $this->getReturnObject($request);
    }
455567
public function request($options)
    {
        $request = $this->getRequest($options);
        $requestOptions = isset($options['query']) ? ['query' => $options['query']] : [];

        // Try to perform request
        try {
            $response = $this->httpClient->send($request, $requestOptions);
        } catch (GuzzleRequestException $err) {
            $hasResponse = $err->hasResponse();
            if (!$hasResponse) {
                // @todo how do we handle, wrap guzzle err
                throw $err;
            }

            $response = $err->getResponse();
            $code = $response->getStatusCode();

            if ($code >= 500) {
                throw new ServerException($response);
            } elseif ($code >= 400) {
                throw new ClientException($response);
            }
        }

        $contentType = $response->getHeader('Content-Type')[0];
        $isJson = stripos($contentType, 'application/json') !== false;
        $rawBody = (string) $response->getBody();
        $body = $isJson ? json_decode($rawBody, true) : $rawBody;

        return $body;
    }
1034802
private function vetHandler ( $handler ) {
      if ( is_callable( $handler ) )
        return $handler;
      else if ( is_string( $handler ) && preg_match( "/^.+\#.+$/", $handler ) == 1 )
        return function ( $service, $request ) use ( $handler ) {
          list($controller, $method) = explode( '#', $handler );
          $controller = new $controller( $service );
          return $controller->{$method}( $request );
        };
      return NULL;
    }
1337883
public static function delete($route, $handler, $options = [])
    {
        app()->router->delete($route, $handler, $options);
    }