Skip to content

Commit

Permalink
Merge branch 'comento:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
calc2te authored Nov 28, 2023
2 parents bf2a8e1 + b414ea8 commit e90df5d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/SensAlimtalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;

class SensAlimtalk
{
Expand All @@ -13,7 +14,7 @@ class SensAlimtalk
private $baseURL;
private $targetURL;
private $method = 'POST';
private $timestamp;
private $timestamp = '';

/**
* SensAlimtalk constructor.
Expand All @@ -25,7 +26,6 @@ class SensAlimtalk
public function __construct($accessKey, $secretKey, $serviceId)
{
$this->baseURL = 'https://sens.apigw.ntruss.com';
$this->timestamp = (string)(int)round(microtime(true) * 1000);
$this->accessKey = $accessKey;
$this->secretKey = $secretKey;
$this->targetURL = '/alimtalk/v2/services/' . $serviceId . '/messages';
Expand Down Expand Up @@ -64,12 +64,14 @@ protected function setClient()

/**
* @param $body
* @return \Psr\Http\Message\ResponseInterface
* @return ResponseInterface
*/
public function send($body)
{
$client = $this->setClient();

$this->timestamp = (string)(int)round(microtime(true) * 1000);

return $client->request(
$this->method,
$this->targetURL,
Expand All @@ -84,4 +86,4 @@ public function send($body)
]
);
}
}
}

0 comments on commit e90df5d

Please sign in to comment.