Respond with data.

@param array $data
@return Response
333905
public function found(array $data): Response
    {
        $this->response->setBody(json_encode(['data' => $data]));
        return $this->response;
    }
180283
private function prepareResponseData($data)
    {
        switch (true)
        {
            case is_object($data):
                if (method_exists($data, 'toArray'))
                {
                    $data = $data->toArray();
                }
                else
                {
                    $data = get_object_vars($data);
                }
                $data = $this->prepareResponseData($data);
                break;
            case is_array($data):
                foreach ($data as $key => $value)
                {
                    $data[$key] = $this->prepareResponseData($value);
                }
                break;
        }
        return $data;
    }
940958
public function create($data = [])
    {
        if (! $data) {
            $data = $this->data;
        } else {
            $this->populate($data);
        }

        $response = $this->client->post('', [], $data);

        if (!$response->hasErrors()) {
            $this->event->dispatch('SUBSCRIPTION.UPDATE', new SubscriptionsEvent($this->data));
        }

        return $this;
    }
1219144
public function sendData($data)
    {
        $response = $this->gocardless->customers()->create($data);

        return $this->response = new CustomerResponse($this, $response);
    }
937213
public function send($data = [])
    {
        $params = $this->formatMessage($data);

        $this->restoreMessage();

        return $this->httpPostJson(static::API_SEND, $params);
    }
1120612
public function sendData($data)
    {
        $response = $this->gocardless->payments()->create($data);

        return $this->response = new PaymentResponse($this, $response);
    }
467577
public function sendData($data)
    {
        $httpResponse = $this->sendRequest($this->getEndpointAction(), null, 'GET');
        $responseData = json_decode($httpResponse->getBody(true), true);

        return $this->response = new HostedPurchaseResponse($this, $responseData);
    }
594328
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post(
            $this->getEndpoint(),
            ['Content-Type' => 'text/xml; charset=utf-8'],
            $this->xmlSerialize($data)
        )->send();

        return $this->response = $this->newResponse( $httpResponse->xml() );
    }
742670
protected function respondWithSuccessMessage($data = [], $headers = [])
    {
        $response = [];
        $response['success'] = true;

        if (!empty($data)) {
            $response['response'] = $data;
        }

        return $this->respond($response, $headers);
    }
304551
public static function CreateFromResponse(Array $data)
    {
        $id = $data["id"];
        $name = $data["name"];
        $price = $data["price"];

        $product = new Product($name, $price, $id);

        return $product;
    }
133966
public function request(array $data) {
    // Create request
    $request = Loader::request($this->config, $data);
    // Return response
    return Loader::response(
      // Execute
      $this->getHttp()->post($this->getRequestUrl(), (string) $request)->json
      // Attach request
    )->attach('request', $request);
  }
934083
public function sendData($data)
    {
        $response = $this->gocardless->refunds()->update($data['refundId'], $data['refundData']);

        return $this->response = new RefundResponse($this, $response);
    }
34695
public function sendData($data)
    {
        $response = $this->gocardless->payments()->retry($data['paymentId']);

        return $this->response = new PaymentResponse($this, $response);
    }
578859
public function sendData($data)
    {
        $response = $this->braintree->customer()->update($data['customerId'], $data['customerData']);

        return $this->response = new CustomerResponse($this, $response);
    }
1217536
public function sendData($data)
    {
        $httpResponse = $this->httpClient->post($this->getEndpoint(), null, $data)->send();

        return $this->response = new PaymentResponse($this, $httpResponse);
    }
1175638
public function sendData($data)
    {
        $data = parent::sendData($data);

        return $this->response = new AopTransferToAccountResponse($this, $data);
    }
855609
public function update($data)
    {
        $response = $this->api->put($this->url(), $data);
        $this->data = (array) $response->data;

        return $this;
    }