/**
  * @name UpdateCustomAttribute
  * @description Updates and existing custom attribute
  * @request CustomAttributeRequest
  * @response CustomAttributeUpdatedResponse
  * @param $attributeId
  * @return void
  */
 public function Update($attributeId)
 {
     /** @var $request CustomAttributeRequest */
     $request = $this->server->GetRequest();
     Log::Debug('AttributesWriteWebService.Update() User=%s, AttributeId=%s, Request=%s', $this->server->GetSession()->UserId, $attributeId, json_encode($request));
     $result = $this->attributeController->Update($attributeId, $request, $this->server->GetSession());
     if ($result->WasSuccessful()) {
         Log::Debug('AttributesWriteWebService.Update() - Attribute Updated. AttributeId=%s', $result->AttributeId());
         $this->server->WriteResponse(new CustomAttributeUpdatedResponse($this->server, $result->AttributeId()), RestResponse::CREATED_CODE);
     } else {
         Log::Debug('AttributesWriteWebService.Update() - Update Failed.');
         $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()), RestResponse::BAD_REQUEST_CODE);
     }
 }
Ejemplo n.º 2
0
 /**
  * @name UpdateUser
  * @description Updates an existing user
  * @request UpdateUserRequest
  * @response UserUpdatedResponse
  * @param $userId
  * @return void
  */
 public function Update($userId)
 {
     /** @var $request UpdateUserRequest */
     $request = new UpdateUserRequest($this->server->GetRequest());
     Log::Debug('UsersWriteWebService.Update() User=%s', $this->server->GetSession()->UserId);
     $result = $this->controller->Update($userId, $request, $this->server->GetSession());
     if ($result->WasSuccessful()) {
         Log::Debug('UsersWriteWebService.Update() - User Updated. UserId=%s', $result->UserId());
         $this->server->WriteResponse(new UserUpdatedResponse($this->server, $result->UserId()), RestResponse::OK_CODE);
     } else {
         Log::Debug('UsersWriteWebService.Create() - User Update Failed.');
         $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()), RestResponse::BAD_REQUEST_CODE);
     }
 }
Ejemplo n.º 3
0
 /**
  * @name UpdateReservation
  * @description Updates an existing reservation.
  * Pass an optional updateScope query string parameter to restrict changes. Possible values for updateScope are this|full|future
  * @request ReservationRequest
  * @response ReservationUpdatedResponse
  * @param string $referenceNumber
  * @return void
  */
 public function Update($referenceNumber)
 {
     /** @var $request ReservationRequest */
     $request = $this->server->GetRequest();
     Log::Debug('ReservationWriteWebService.Update() User=%s, ReferenceNumber=%s, Request=%s', $referenceNumber, $this->server->GetSession()->UserId, json_encode($request));
     $updateScope = $this->server->GetQueryString(WebServiceQueryStringKeys::UPDATE_SCOPE);
     $result = $this->controller->Update($request, $this->server->GetSession(), $referenceNumber, $updateScope);
     if ($result->WasSuccessful()) {
         Log::Debug('ReservationWriteWebService.Update() - Reservation Updated. ReferenceNumber=%s', $result->CreatedReferenceNumber());
         $this->server->WriteResponse(new ReservationUpdatedResponse($this->server, $result->CreatedReferenceNumber(), $result->RequiresApproval()), RestResponse::OK_CODE);
     } else {
         Log::Debug('ReservationWriteWebService.Update() - Reservation Failed.');
         $this->server->WriteResponse(new FailedResponse($this->server, $result->Errors()), RestResponse::BAD_REQUEST_CODE);
     }
 }