public function fetchLatestGrams() { $db = new DynamoDBService($this->config); $raw = $db->getLatestGrams(); $s3 = new S3Service($this->config); $grams = array(); foreach ($raw as $protogram) { $ref = current($protogram['gramified']); $grams[$ref]['uploadDate'] = current($protogram['uploadDate']); $grams[$ref]['message'] = current($protogram['message']); $grams[$ref]['gramified'] = $s3->getGramified($ref); } return $grams; }
public function handleMessage(array $message) { if ($message['Type'] == 'SubscriptionConfirmation') { $sns = new SNSService($this->config); $sns->confirmSubscription($message); } elseif ($message['Type'] == 'Notification') { $s3 = new S3Service($this->config); $url = $s3->getImageUrl($message['Subject']); $img = $this->resizeImage($url); $text = $img ? $this->gramifyImage($img) : 'Error!'; $textName = $s3->persistGramified($text); $db = new DynamoDBService($this->config); $db->persist($message['Subject'], $textName, $message['Message']); } }