public function __construct(Client $eloqua, array $parameters, HookDispatcher $dispatcher)
 {
     $eloqua->authenticate($parameters['site'], $parameters['login'], $parameters['password'], $parameters['baseUrl']);
     $this->client = $eloqua;
     $this->parameters = $parameters;
     $this->dispatcher = $dispatcher;
 }
Esempio n. 2
0
 /**
  * Sends a DELETE request with JSON-encoded parameters.
  *
  * @param string $path
  *   The request path.
  *
  * @param array $parameters
  *   The POST parameters to be JSON encoded.
  *
  * @param array $requestHeaders
  *   The request headers.
  */
 protected function delete($path, array $parameters = array(), $requestHeaders = array())
 {
     $response = $this->client->getHttpClient()->delete($path, $this->createJsonBody($parameters), $requestHeaders);
     return ResponseMediator::getContent($response);
 }
Esempio n. 3
0
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function shouldNotGetApiInstance()
 {
     $client = new Client();
     $client->api('not_a_thing');
 }
Esempio n. 4
0
 protected function getClientMock(HttpClientInterface $httpClient = null)
 {
     // if no httpClient isset use the default HttpClient mock
     if (!$httpClient) {
         $httpClient = $this->getHttpClientMock();
     }
     $client = new \Eloqua\Client($httpClient);
     $client->setHttpClient($httpClient);
     return $client;
 }