/** * Create a new mail gateway instance. * * @param string[] $config * * @return \NotifyMeHQ\Mail\MailGateway */ public function make(array $config) { Arr::requires($config, ['host', 'port', 'encryption', 'username', 'password', 'from']); // SwiftMailer Configuration $transport = Swift_SmtpTransport::newInstance(); $transport->setHost($config['host']); $transport->setPort($config['port']); $transport->setUsername($config['username']); $transport->setPassword($config['password']); $transport->setEncryption($config['encryption']); // Create the Mailer using the created Transport. $mailer = Swift_Mailer::newInstance($transport); unset($config['host']); unset($config['port']); unset($config['encryption']); unset($config['username']); unset($config['password']); return new MailGateway($config, $mailer, $config['from']); }
/** * Create a new pagerduty gateway instance. * * @param string[] $config * * @return \NotifyMeHQ\Pagerduty\PagerdutyGateway */ public function make(array $config) { Arr::requires($config, ['token']); $client = new Client(); return new PagerdutyGateway($client, $config); }
/** * Send a notification. * * @param string $to * @param string $message * * @return \NotifyMeHQ\Contracts\ResponseInterface */ public function notify($to, $message) { $params = ['to' => $to, 'service_key' => $this->config['token'], 'event_type' => Arr::get($this->config, 'event_type', 'trigger'), 'client' => Arr::get($this->config, 'client', null), 'client_url' => Arr::get($this->config, 'client_url', null), 'details' => Arr::get($this->config, 'details', null), 'description' => $message]; return $this->send($this->buildUrlFromString('create_event.json'), $params); }
/** * Create a new plivo gateway instance. * * @param string[] $config * * @return \NotifyMeHQ\Plivo\PlivoGateway */ public function make(array $config) { Arr::requires($config, ['from', 'auth_id', 'auth_token']); $client = new Client(); return new PlivoGateway($client, $config); }