| Total Complexity | 5 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class Client extends AbstractClient |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Base URL of resource |
||
| 17 | * |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $baseUrl = 'https://mandrillapp.com/api/1.0/'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get client's credentials |
||
| 24 | * |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | protected function credentials(): array |
||
| 28 | { |
||
| 29 | return config('connector.credentials.clients.mandrill', []); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Authorize the client |
||
| 34 | * |
||
| 35 | * @return void |
||
| 36 | */ |
||
| 37 | protected function authorize() |
||
| 38 | { |
||
| 39 | if (!$secret = $this->credential('secretKey')) { |
||
| 40 | $this->abort(); |
||
| 41 | |||
| 42 | return; |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->body([ |
||
| 46 | 'key' => $secret |
||
| 47 | ]); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * List of supported requests |
||
| 52 | * |
||
| 53 | * @return array |
||
| 54 | */ |
||
| 55 | public function requests(): array |
||
| 56 | { |
||
| 57 | return [ |
||
| 58 | Requests\SendTemplate::class |
||
| 59 | ]; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Send a new transactional message through Mandrill using a template |
||
| 64 | * |
||
| 65 | * @param array $attributes |
||
| 66 | * |
||
| 67 | * @return mixed |
||
| 68 | */ |
||
| 69 | public function sendTemplate(array $attributes) |
||
| 72 | } |
||
| 73 | } |