-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from tarfin-labs/iys-integration
Iys integration
- Loading branch information
Showing
11 changed files
with
610 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace TarfinLabs\Netgsm\Iys; | ||
|
||
use TarfinLabs\Netgsm\NetgsmApiClient; | ||
|
||
abstract class AbstractNetgsmIys extends NetgsmApiClient | ||
{ | ||
protected string $url = ''; | ||
|
||
protected string $method = 'GET'; | ||
|
||
protected array $body = []; | ||
|
||
/** | ||
* Send request. | ||
* | ||
* @return string | ||
*/ | ||
public function send(): string | ||
{ | ||
$response = $this->client->request($this->method, $this->url, [ | ||
'headers' => [ | ||
'Content-Type' => 'application/json', | ||
], | ||
'json' => [ | ||
'header' => [ | ||
'username' => $this->credentials['user_code'], | ||
'password' => $this->credentials['secret'], | ||
'brandCode' => $this->credentials['brand_code'], | ||
], | ||
'body' => [ | ||
'data' => [ | ||
$this->body, | ||
], | ||
], | ||
], | ||
]); | ||
|
||
return $response->getBody()->getContents(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace TarfinLabs\Netgsm\Iys; | ||
|
||
use TarfinLabs\Netgsm\Iys\Requests\Add; | ||
use TarfinLabs\Netgsm\Iys\Requests\Search; | ||
|
||
class NetgsmIys extends AbstractNetgsmIys | ||
{ | ||
/** | ||
* Add address request. | ||
* | ||
* @param Add $request | ||
* @return $this | ||
*/ | ||
public function addAddress(Add $request): NetgsmIys | ||
{ | ||
$this->url = $request->getUrl(); | ||
$this->body = $request->body(); | ||
$this->method = 'POST'; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Search address request. | ||
* | ||
* @param Search $request | ||
* @return $this | ||
*/ | ||
public function searchAddress(Search $request): NetgsmIys | ||
{ | ||
$this->url = $request->getUrl(); | ||
$this->body = $request->body(); | ||
$this->method = 'POST'; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.