Beispiel #1
0
 /**
  * Test the Account's getter methods.
  */
 public function testGetter()
 {
     $account = new Account('access-key', 'secret-key', 'api-host');
     $this->assertEquals('access-key', $account->getAccessKey());
     $this->assertEquals('secret-key', $account->getSecretKey());
     $this->assertEquals('api-host', $account->getApiHost());
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 protected function createHttpClient(Account $account, $cloudId)
 {
     $guzzleClient = new Client('https://' . $account->getApiHost() . '/v2');
     $httpClient = new HttpClient();
     $httpClient->setAccount($account);
     $httpClient->setCloudId($cloudId);
     $httpClient->setGuzzleClient($guzzleClient);
     return $httpClient;
 }
Beispiel #3
0
 private function completeParams(array $params)
 {
     if (!isset($params['cloud_id'])) {
         $params['cloud_id'] = $this->cloudId;
     }
     if (!isset($params['access_key'])) {
         $params['access_key'] = $this->account->getAccessKey();
     }
     if (!isset($params['timestamp'])) {
         $oldTz = date_default_timezone_get();
         date_default_timezone_set('UTC');
         $params['timestamp'] = date('c');
         date_default_timezone_set($oldTz);
     }
     return $params;
 }