public function createPUTConversationMessage(ConversationMessageObject $messageObject) { $this->request = new OutgoingRequest(); $this->request->setServer($this->getDomainFromProfileLocation($this->targetSocialRecord->getProfileLocation())); $this->request->setPath($this->getPathFromProfileLocation($this->targetSocialRecord->getProfileLocation()) . $this->targetSocialRecord->getGlobalID() . '/' . self::RESOURCE_NAME_CONVERSATION . '/' . $messageObject->getTargetID() . '/' . self::RESOURCE_NAME_MESSAGE . '/' . $messageObject->getObjectID()); $this->request->setRequestMethod('PUT'); $this->request->setRequestBody($messageObject->getJSONString()); return $this; }
public function build() { if ($this->objectID == NULL) { $this->objectID = UOID::createUOID(); } if ($this->datetime == NULL) { $this->datetime = XSDDateTime::getXSDDateTime(); } if (!UOID::isValid($this->objectID)) { throw new IllegalModelStateException('Invalid objectID'); } if (!UOID::isValid($this->targetID)) { throw new IllegalModelStateException('Invalid targetID'); } if (!GID::isValid($this->author)) { throw new IllegalModelStateException('Invalid author'); } if ($this->body == '' || $this->body == NULL) { throw new IllegalModelStateException('Invalid body'); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $conversationMessage = new ConversationMessageObject($this); if ($conversationMessage->getSignature() == NULL) { $conversationMessage->signObject(); } if (!$conversationMessage->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationMessage; }