| 1 | package Mojolicious::Plugin::Sendgrid; | ||
| 2 | use Mojo::Base 'Mojolicious::Plugin'; | ||
| 3 | |||
| 4 | use Mojo::Sendgrid; | ||
| 5 | |||
| 6 | sub register { | ||
| 7 | my ($self, $app, $conf) = @_; | ||
| 8 | |||
| 9 | push @{$app->commands->namespaces}, 'Mojo::Sendgrid::Command'; | ||
| 10 | |||
| 11 | my $sendgrid = Mojo::Sendgrid->new({%{$app->config('sendgrid')||{}}, %{$conf||{}}}) or return; | ||
| 12 | $app->helper(sendgrid => sub {$sendgrid}); | ||
| 13 | } | ||
| 14 | |||
| 15 | 1; | ||
| 16 | __END__ |