Esempio n. 1
0
 public function testMultiPost()
 {
     $responses = $this->guzzle_adapter->multiPost(array(array('url' => 'http://www.ebussola.com', 'data' => array(), 'headers' => array()), array('url' => 'http://posttestserver.com', 'data' => array(), 'headers' => array())));
     $this->assertCount(2, $responses);
     foreach ($responses as $response) {
         $this->assertInstanceOf('\\SimpleXMLElement', $response);
     }
 }
Esempio n. 2
0
 /**
  * @param array $calls
  * An array of Calls
  * Each call is an array with keys: service, parameters and endpoint
  *
  * @return \SimpleXMLElement[]
  */
 public function multiCall(array $calls)
 {
     $requests = array();
     foreach ($calls as $call) {
         $parameters = $this->buildParams($call['service'], $call['parameters'], $call['endpoint']);
         $requests[] = array('url' => $call['endpoint'], 'data' => $parameters, 'headers' => array());
     }
     return $this->http->multiPost($requests);
 }
Esempio n. 3
0
 /**
  * @param string $service    service
  * @param array  $parameters parameters
  * @param string $endpoint   endpoint
  *
  * @return \SimpleXMLElement
  */
 public function call($service = null, array $parameters = array(), $endpoint = null)
 {
     if (null === $endpoint) {
         $endpoint = $this->metadata->getEndpoint();
     }
     $default = array('api_key' => $this->metadata->getApiKey(), 'format' => 'json');
     if ($service) {
         $default['method'] = $service;
     }
     $parameters = array_merge($default, $parameters);
     $parameters = array_filter($parameters, function ($value) {
         return null !== $value;
     });
     $parameters['api_sig'] = $this->buildSignature($parameters);
     $this->addOAuthParameters($endpoint, $parameters);
     return $this->http->post($endpoint, $parameters);
 }