Esempio n. 1
0
 /**
  * Run the Flowdock plugin.
  * @return bool
  * @throws \Exception
  */
 public function execute()
 {
     $message = $this->phpci->interpolate($this->message);
     $successfulBuild = $this->build->isSuccessful() ? 'Success' : 'Failed';
     $push = new Push($this->api_key);
     $flowMessage = TeamInboxMessage::create()->setSource("PHPCI")->setFromAddress($this->email)->setFromName($this->build->getProject()->getTitle())->setSubject($successfulBuild)->setTags(['#ci'])->setLink($this->build->getBranchLink())->setContent($message);
     if (!$push->sendTeamInboxMessage($flowMessage, array('connect_timeout' => 5000, 'timeout' => 5000))) {
         throw new \Exception(sprintf('Flowdock Failed: %s', $flowMessage->getResponseErrors()));
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $push = new Push($input->getArgument('flow-api-token'));
     $message = TeamInboxMessage::create()->setSource($input->getArgument('source'))->setFromAddress($input->getArgument('from-address'))->setSubject($input->getArgument('subject'))->setContent($input->getArgument('content'))->setFromName($input->getOption('from-name'))->setReplyTo($input->getOption('reply-to'))->setProject($input->getOption('project'))->setFormat($input->getOption('format'))->setLink($input->getOption('link'))->setTags($input->getOption('tags'));
     $options = $input->getOption('options') ? json_decode($input->getOption('options'), true) : array();
     if ($push->sendTeamInboxMessage($message, $options)) {
         $output->writeln('<info>Success:</info> the message has been sent');
         return;
     }
     $output->writeln(sprintf('<error>Failure:</error> %s', $message->getResponseMessage()));
     $output->writeln(var_export($message->getResponseErrors(), true));
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $push = new Push($input->getArgument('flow-api-token'));
     $message = ChatMessage::create()->setContent($input->getArgument('content'))->setExternalUserName($input->getArgument('external-user-name'))->setTags($input->getOption('tags'))->setMessageId($input->getOption('message-id'));
     $options = $input->getOption('options') ? json_decode($input->getOption('options'), true) : array();
     if ($push->sendChatMessage($message, $options)) {
         $output->writeln('<info>Success:</info> the message has been sent');
         return;
     }
     $output->writeln(sprintf('<error>Failure:</error> %s', $message->getResponseMessage()));
     $output->writeln(var_export($message->getResponseErrors(), true));
 }