Skip to content

Commit

Permalink
Merge pull request #63 from EugeneGpil/subdomain
Browse files Browse the repository at this point in the history
subdomain
  • Loading branch information
tooyz authored Mar 13, 2020
2 parents 8aaee08 + 41d7dde commit afc4777
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Components/Http/MoySkladHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ class MoySkladHttpClient{
private $preRequestSleepTime = 200;

private
$endpoint = "https://online.moysklad.ru/api/remap/1.1/",
$posEndpoint = "https://online.moysklad.ru/api/posap/1.0/",
$login,
$password,
$posToken;

public function __construct($login, $password, $posToken)
public function __construct($login, $password, $posToken, $subdomain = "online")
{
$this->login = $login;
$this->password = $password;
$this->posToken = $posToken;
$this->endpoint = "https://" . $subdomain . ".moysklad.ru/api/remap/1.1/";
}

public function setPosToken($posToken){
Expand Down
8 changes: 4 additions & 4 deletions src/MoySklad.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class MoySklad{
*/
private static $instances = [];

private function __construct($login, $password, $posToken, $hashCode)
private function __construct($login, $password, $posToken, $hashCode, $subdomain = "online")
{
$this->client = new MoySkladHttpClient($login, $password, $posToken);
$this->client = new MoySkladHttpClient($login, $password, $posToken, $subdomain);
$this->hashCode = $hashCode;
}

Expand All @@ -45,10 +45,10 @@ private static function makeHash($login, $password){
* @param $posToken
* @return MoySklad
*/
public static function getInstance($login, $password, $posToken = null){
public static function getInstance($login, $password, $subdomain = "online", $posToken = null){
$hash = static::makeHash($login, $password);
if ( empty(static::$instances[$hash]) ){
static::$instances[$hash] = new static($login, $password, $posToken, $hash);
static::$instances[$hash] = new static($login, $password, $posToken, $hash, $subdomain);
EntityRegistry::instance()->bootEntities();
}
return static::$instances[$hash];
Expand Down

0 comments on commit afc4777

Please sign in to comment.