Example #1
0
 /**
  * @runInSeparateProcess
  */
 public function testInitToken()
 {
     $this->assertNull($this->token->initToken());
     $data = array('username' => 'ConoHa', 'password' => 'paSSword123456#$%', 'tenantId' => '487727e3921d44e3bfe7ebb337bf085e', 'token' => 'sample00d88246078f2bexample788f7', 'cookies' => ['isStoreTokenCookie' => true, 'storeTokenCookieName' => 'cookieName']);
     $this->client = new Conoha($data);
     $this->token = new Token($this->client);
 }
Example #2
0
 /**
  * Conoha constructor.
  *
  * $data is your ConoHa API account information.
  *
  * For example,
  * $data = array(
  *  'username' => Your API Username,
  *  'password' => Your API Password,
  *  'tenantId' => Your API TenantID,
  *  'token' => Your API Token,
  *  'cookies' => [
  *      'isStoreTokenCookie' => true or false,
  *      'storeTokenCookieName' => Cookie Name
  *  ]
  * );
  *
  * If it not contain 'token', this class create and set token automatically.
  * If it not contain 'username' or 'password' (or both data), You can connect API,
  * but this class cannot refresh token.
  *
  * @param array $data
  */
 public function __construct($data = array())
 {
     $this->data = $data;
     if (!isset($data['cookies'])) {
         $this->data['cookies'] = array();
     }
     $token = new ConohaAPI\Common\DataStore\Token($this);
     $token->initToken();
 }