示例#1
0
 /**
  * Update account
  *
  * @param AccountType $accountType AccountType instance with updated data
  *
  * @return bool
  */
 public function update(AccountType $accountType)
 {
     // at least one of these fields is required
     $requirementsMet = !empty($accountType->password) || !empty($accountType->isStaff) || !empty($accountType->isActive) || !empty($accountType->name) || !empty($accountType->note) || !empty($accountType->storage);
     if (!$requirementsMet) {
         return false;
     }
     $uri = sprintf('%s/accounts/' . $accountType->email . '/', $this->clipUri($this->client->getConfig('base_uri')));
     $response = $this->client->put($uri, ['headers' => ['Accept' => 'application/json; charset=utf-8'], 'multipart' => $accountType->toArray(Type::ARRAY_MULTI_PART)]);
     return $response->getStatusCode() === 200;
 }