Esempio n. 1
0
 public function setUp()
 {
     $settings = $this->getSettings();
     $joindin = $settings['settings']['joindin'];
     $joindinConfig = new \PHPMinds\Config\JoindinConfig(['apiKey' => $joindin['key'], 'baseUrl' => $joindin['baseUrl'], 'frontendBaseUrl' => $joindin['frontendBaseUrl'], 'callback' => $joindin['callback'], 'username' => $joindin['username']]);
     $fileRepository = new \PHPMinds\Repository\FileRepository($settings['settings']['file_store']['path']);
     $this->joindinEvent = new JoindinEvent($joindinConfig, $fileRepository);
     $this->event = $this->getEvent();
     $this->event->setName("PHPMinds");
     $this->event->setDescription("Event description");
 }
Esempio n. 2
0
 /**
  * @param $userID
  * @return \Psr\Http\Message\ResponseInterface
  * @throws \Exception
  */
 public function createJoindinEvent($userID)
 {
     if ($this->eventManager->eventExists($this->event->getName())) {
         throw new \Exception('An event by the name: ' . $this->event->getName() . ', already exists.');
     }
     $this->joindinEventService->setEvent($this->event);
     return $this->joindinEventService->createEvent($userID);
 }
Esempio n. 3
0
 public static function getMergedFromArrays(array $meetupEvent = [], array $dbEvent = null)
 {
     if (empty($meetupEvent)) {
         $supporter = new NullSupporter();
         $date = new \DateTime();
         $talk = new NullTalk();
         $venue = new NullVenue();
         $model = new EventModel($talk, $date, $venue, $supporter);
         return $model;
     }
     if (!is_null($dbEvent)) {
         $speaker = new Speaker($dbEvent['first_name'], $dbEvent['last_name'], new Email($dbEvent['email']), new Twitter($dbEvent['twitter']), $dbEvent['avatar']);
         $speaker->setId($dbEvent['speaker_id']);
         $supporter = new Supporter($dbEvent['supporter_name'], $dbEvent['supporter_url'], new Twitter($dbEvent['supporter_twitter']), new Email($dbEvent['supporter_email']), $dbEvent['supporter_logo']);
         $supporter->setId($dbEvent['supporter_id']);
     } else {
         $speaker = new NullSpeaker();
         $supporter = new NullSupporter();
     }
     $talk = new Talk($meetupEvent['subject'], $meetupEvent['description'], $speaker);
     $venue = new Venue($meetupEvent['venue_name'], $meetupEvent['venue_address']);
     $venue->setId($meetupEvent['venue_id']);
     $date = \DateTime::createFromFormat('F jS Y g:ia', $meetupEvent['date'] . ' ' . $meetupEvent['time']);
     $event = new EventModel($talk, $date, $venue, $supporter);
     $event->setName($meetupEvent['group']);
     $event->setMindsUrl($meetupEvent['minds_url']);
     $event->setMeetupID($meetupEvent['id']);
     $event->setMeetupURL($meetupEvent['event_url']);
     return $event;
 }
Esempio n. 4
0
 /**
  * @param EventModel $event
  * @param string $language
  * @return array
  */
 public function getCreateEventTitlePayload(EventModel $event, $language = 'English - UK')
 {
     $speakers = [$event->getTalk()->getSpeaker()->getFirstName() . ' ' . $event->getTalk()->getSpeaker()->getLastName()];
     $payload = ['talk_title' => $event->getTalk()->getTitle(), 'talk_description' => $event->getTalk()->getDescription(), 'language' => $language, 'talk_type' => 'Talk', 'start_date' => $event->getDate()->setTimezone(new \DateTimeZone('UTC'))->format('Y-m-d H:i:s'), 'speakers' => $speakers];
     return $payload;
 }
Esempio n. 5
0
 public function testCanCreateAnEventPayload()
 {
     $eventPayload = $this->meetupEvent->getCreateEventPayload($this->event);
     $expected = ['name' => 'A title', 'description' => 'A description', 'venue_id' => 123, 'publish_status' => 'draft', 'time' => $this->event->getDate()->getTimestamp() * 1000, 'venue_visibility' => 'members'];
     $this->assertEquals($expected, $eventPayload);
 }
Esempio n. 6
0
 /**
  * @param EventModel     $event
  * @return array
  */
 public function getCreateEventPayload(EventModel $event)
 {
     // x-www-form-urlencoded
     // have not tried using json
     $payload = ['name' => $event->getTalk()->getTitle(), 'description' => $event->getTalk()->getDescription(), 'venue_id' => $event->getVenue()->getId(), 'publish_status' => $this->publishStatus, 'time' => $event->getDate()->getTimestamp() * 1000, 'venue_visibility' => 'members'];
     if ($this->publishStatus !== 'draft') {
         unset($payload['publish_status']);
     }
     return $payload;
 }