Make a get request.

@param string $method
@param array  $data
@param string $key

@return array
518281
protected function get($method, array $data = [], $key = 'key')
    {
        $data = $this->data($data);

        if (!isset($this->cache[$method][$key])) {
            $this->cache[$method][$key] = $this->client->$method($data);
        }

        return $this->cache[$method][$key];
    }
53444
public function call($method, array $data = null)
    {
        $options = $this->proxySettings + [
            CURLOPT_URL => $this->getUrl().'/'.$method,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POST => null,
            CURLOPT_POSTFIELDS => null,
            CURLOPT_TIMEOUT => 5,
        ];

        if ($data) {
            $options[CURLOPT_POST] = true;
            $options[CURLOPT_POSTFIELDS] = $data;
        }

        if (!empty($this->customCurlOptions) && is_array($this->customCurlOptions)) {
            $options += $this->customCurlOptions;
        }

        $response = self::jsonValidate($this->executeCurl($options), $this->returnArray);

        if ($this->returnArray) {
            if (!isset($response['ok'])) {
                throw new Exception($response['description'], $response['error_code']);
            }

            return $response['result'];
        }

        if (!$response->ok) {
            throw new Exception($response->description, $response->error_code);
        }

        return $response->result;
    }
88997
public function get($method, $data = array())
    {
        //set cURL transfer option for get request
        // and get ouput
        return $this->createEndPoint($method, $data)
                    ->setOpt(CURLOPT_CUSTOMREQUEST, 'GET')
                    ->setopt(CURLOPT_HTTPGET, true)
                    ->exec();
    }
288138
public function parse($data, $key = null)
    {
        if ($key) $this->apiKey = $key;
        return $this->get($data, [], null, 'parse');
    }
410569
public function request(array $data = [], string $method = Request::GET): Response
    {
        $path = '_cluster/settings';

        return $this->getClient()->request($path, $method, $data);
    }
1089165
public function request($method, $scope = null, $data = null)
    {
        if (is_array($scope)) {
            $data = $scope;
            $scope = null;
        }
        $url = $scope ? $this->url.'/'.ltrim($scope, '/') : $this->url;
        $result = self::$client->request($method, $url, $data);
        if (!$scope && $result instanceof Resource) {
            // TODO: how should POST be handled here?
            foreach ($result->data() as $key => $value) {
                self::offsetSet($key, $value);
            }
        }
        return $scope ? $result : $this;
    }
655251
private function doSend($method, array $data, $token = null)
    {
        try {
            $data['token'] = $token ?: $this->token;

            $this->eventDispatcher->dispatch(self::EVENT_REQUEST, new RequestEvent($data));

            $request = $this->createRequest($method, $data);

            /** @var ResponseInterface $response */
            $response = $this->client->send($request);
        } catch (\Exception $e) {
            throw new SlackException('Failed to send data to the Slack API', null, $e);
        }

        try {
            $responseData = json_decode($response->getBody()->getContents(), true);
            if (!is_array($responseData)) {
                throw new \Exception(sprintf(
                    'Expected JSON-decoded response data to be of type "array", got "%s"',
                    gettype($responseData)
                ));
            }

            $this->eventDispatcher->dispatch(self::EVENT_RESPONSE, new ResponseEvent($responseData));

            return $responseData;
        } catch (\Exception $e) {
            throw new SlackException('Failed to process response from the Slack API', null, $e);
        }
    }
353322
public static function send(string $api, string $method, array $data) : array {
		// mail delivery first
		$class = \Application::get("apis.{$api}.submodule", ['class' => true]);
		if (empty($class)) {
			Throw new Exception('You need to specify API delivery submodule');
		}
		// check if backend has been enabled
		if (!Can::systemModuleExists('UA')) {
			Throw new Exception('You must enable UA module first!');
		}
		// initialize the object
		$object = new $class();
		return $object->send($method, $data, \Application::get("apis.{$api}"));
	}
816501
public function request($path, $method = Request::GET, $data = [], array $query = [])
    {
        return $this->_client->request('_snapshot/'.$path, $method, $data, $query);
    }
228813
protected function runRequest($path, $method = 'GET', $data = '')
    {
        $curl = $this->prepareRequest($path, $method, $data);

        $response = curl_exec($curl);
        $this->responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE);

        if (curl_errno($curl)) {
            $e = new \Exception(curl_error($curl), curl_errno($curl));
            curl_close($curl);
            throw $e;
        }
        curl_close($curl);

        return $this->processCurlResponse($response, $contentType);
    }
976815
public function makeRequest($method, $endpoint, array $data = [])
    {
        $response = $this->client->request($method, $endpoint, $data);

        return json_decode((string) $response->getBody());
    }
441490
protected function action($method, array $data = [], $flush = null)
    {
        $data = $this->data($data);

        $this->clearCache($flush);

        return $this->client->$method($data);
    }
191219
protected function createEndPoint($method, $data = array())
    {
        //create array for api key
        $data['api_token'] = $this->apiKey;
        //make API end point
        $endPoint = $this->url  . '/' . $method . '?' . http_build_query($data);
        //set API endpoint
        $this->setOpt(CURLOPT_URL, $endPoint);
        //return this object
        return $this;
    }
1354459
protected function _doRequest($method, $url, $data, $options)
    {
        $request = $this->_createRequest(
            $method,
            $url,
            $data,
            $options
        );

        return $this->send($request, $options);
    }
710680
private function recurseRecord($method, $name, array $data, $index = null)
    {
        // Get model and determine primary key column
        $class = Str::camel($name);
        $model = $this->{$class}()->getModel();
        $primaryKey = (isset($model->primaryKey)) ? $model->primaryKey : 'id';

        $key = array_get($data, $primaryKey);

        // Find record and perform action on it
        $record = $model->findOrCreateRecord($key);
        $result = $record->recurse($method, $data, $this->getParameters('ruleset', $name), $this->getParameters('messageset', $name));

        // Capture errors
        $this->errors = $this->mergeErrors($this->errors, $record->getErrorBag(), $index);

        // Attach relationhip to record
        if ($result) $this->setRelationship($record, $name, $class, $index);

        // Record failure
        return $result;
    }
848662
public function put($method, array $data)
    {
        //set cURL transfer option for post request
        // and get ouput
        return $this->createEndPoint($method)
                    ->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT')
                    ->setOpt(CURLOPT_POSTFIELDS, http_build_query($data))
                    ->exec();
    }
953788
public function requestAsync($url, $method = 'GET', $data = [])
    {

        $stack = HandlerStack::create();
        $stack->push(ApiMiddleware::auth());
        $client = new Client(['handler' => $stack]);

        $promise = $client->requestAsync($method, $url, [
            'headers' => [
                'Authorization' => 'Bearer ' . $this->token
            ],
            'json' => $data,
            'content-type' => 'application/json'
        ]);

        return $promise;

    }