public function createPOSTConversationStatus(ConversationStatusObject $statusObject) { $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 . '/' . $statusObject->getTargetID() . '/' . self::RESOURCE_NAME_STATUS); $this->request->setRequestMethod('POST'); $this->request->setRequestBody($statusObject->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->targetGID != "" && !GID::isValid($this->targetGID)) { throw new IllegalModelStateException('Invalid targetGID: ' . $this->targetGID); } if ($this->status == '' || $this->status == NULL) { throw new IllegalModelStateException('Invalid status: ' . $this->status); } if (!XSDDateTime::validateXSDDateTime($this->datetime)) { throw new IllegalModelStateException('Invalid datetime'); } $conversationStatus = new ConversationStatusObject($this); if ($conversationStatus->getSignature() == NULL) { $conversationStatus->signObject(); } if (!$conversationStatus->verifyObjectSignature()) { throw new IllegalModelStateException('Invalid signature'); } return $conversationStatus; }