Skip to content

Commit

Permalink
Update to 2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
SteeinSource committed Jul 26, 2017
1 parent 5cbea99 commit cc59b21
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/Steein/SDK/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/**
* Class Application
*
* @package Steein
* @package Steein\SDK
*/
class Application implements Serializable
{
Expand Down Expand Up @@ -66,7 +66,7 @@ public function __construct($id, $secret)
{
// Хранение этого для BS. Целые числа, превышающие PHP_INT_MAX, сделают is_int() return false
if (!is_string($id) && !is_int($id)) {
throw new SteeinSDKException('"client_id" должна отформатироваться как строка');
throw new SteeinSDKException('"client_id" должен быть строковым');
}

$this->id = (string) $id;
Expand Down
4 changes: 2 additions & 2 deletions src/Steein/SDK/Authentication/OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
namespace Steein\SDK\Authentication;

use Steein\SDK\Application;
use Steein\SDK\Core\SteeinConstants;
use Steein\SDK\Exceptions\ResponseException;
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Steein;
Expand All @@ -43,7 +44,6 @@
*/
class OAuth2Client
{

/**
* Экземпляр приложения Application
*
Expand Down Expand Up @@ -111,13 +111,13 @@ public function getAuthorizationUrl($redirectUrl, $scope = [], $params = [], $se
'client_id' => $this->app->getId(),
'redirect_uri' => $redirectUrl,
'response_type' => 'code',
'sdk' => SteeinConstants::SDK_NAME.'-'.SteeinConstants::SDK_VERSION,
'scope' => $this->formatScopes($scope)
];

return $this->app->baseUrl().'/oauth/authorize?'.http_build_query($params, null, $separator);
}


/**
* Получить действительный токен ключ из "code".
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Bundler\FileUpload;
namespace Steein\SDK\Core\FileUpload;

/**
* Provides mappings of file extensions to mimetypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Bundler\FileUpload;
namespace Steein\SDK\Core\FileUpload;

use Steein\SDK\Exceptions\SteeinSDKException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\HttpClients;
namespace Steein\SDK\Core\Http\Clients;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\ResponseInterface;
use Steein\SDK\Core\SteeinConstants;
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Http\RawResponse;
use Steein\SDK\Core\Http\RawResponse;
use Steein\SDK\Interfaces\HttpClients\HttpClientInterface;

/**
Expand Down Expand Up @@ -71,9 +72,13 @@ public function send($url, $method, $body, array $headers, $timeOut)
'body' => $body,
'timeout' => $timeOut,
'connect_timeout' => 10,
'verify' => true,
'verify' => __DIR__.'/certs/DigiCertHighAssuranceEVRootCA.pem'
];

if(SteeinConstants::DEBUG == true) {
$options['verify'] = false;
}

$request = new Request($method, $url, $options['headers'], $options['body']);

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
*/

namespace Steein\SDK\HttpClients;
namespace Steein\SDK\Core\Http\Clients;

/**
* Class SteeinCurl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
*
*/

namespace Steein\SDK\HttpClients;
namespace Steein\SDK\Core\Http\Clients;

use Steein\SDK\Core\SteeinConstants;
use Steein\SDK\Http\RawResponse;
use Steein\SDK\Core\Http\RawResponse;
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Interfaces\HttpClients\HttpClientInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Http\Helpers;
namespace Steein\SDK\Core\Http\Helpers;

use Steein\SDK\Authentication\AccessToken;
use Steein\SDK\Authentication\OAuth2Client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Http;
namespace Steein\SDK\Core\Http;

/**
* Class RawResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Http;
namespace Steein\SDK\Core\Http;

use Steein\SDK\Bundler\FileUpload\SteeinFile;
use Steein\SDK\Interfaces\Http\RequestBodyInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\Http;
namespace Steein\SDK\Core\Http;

use Steein\SDK\Interfaces\Http\RequestBodyInterface;

Expand Down
8 changes: 4 additions & 4 deletions src/Steein/SDK/Core/SteeinConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class SteeinConstants
const DEBUG = true;

const SDK_NAME = 'Steein-PHP-SDK';
const SDK_VERSION = '2.0.5';
const SDK_VERSION = '2.0.6';

const REST_BASE_ENDPOINT = "https://st.ru";
const REST_ENDPOINT = "https://st.ru/api/";
const OPENID_REDIRECT_URL = "https://st.ru";
const REST_BASE_ENDPOINT = "https://www.steein.ru";
const REST_ENDPOINT = "https://www.steein.ru/api/";
const OPENID_REDIRECT_URL = "https://www.steein.ru";

const DEFAULT_API_VERSION = "2.0";
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@
* DEALINGS IN THE SOFTWARE.
*
*/
namespace Steein\SDK\HttpClients;
namespace Steein\SDK\Core;

use Exception;
use GuzzleHttp\Client;
use InvalidArgumentException;
use Steein\SDK\Core\Http\Clients\GuzzleHttpClient;
use Steein\SDK\Core\Http\Clients\SteeinCurlHttpClient;
use Steein\SDK\Exceptions\HttpClientException;
use Steein\SDK\Interfaces\HttpClients\HttpClientInterface;

/**
* Class HttpClientsFactory
* Class SteeinHttpFactory
*
* @package Steein\SDK
*/
class HttpClientsFactory
class SteeinHttpFactory
{
private function __construct()
{
Expand Down
12 changes: 6 additions & 6 deletions src/Steein/SDK/Steein.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
use Steein\Common\Collections\Collection;
use Steein\SDK\Authentication\AccessToken;
use Steein\SDK\Authentication\OAuth2Client;
use Steein\SDK\Bundler\FileUpload\SteeinFile;
use Steein\SDK\Core\FileUpload\SteeinFile;
use Steein\SDK\Core\Http\Helpers\RedirectOAuth;
use Steein\SDK\Core\SteeinHttpFactory;
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Http\Helpers\RedirectOAuth;
use Steein\SDK\HttpClients\HttpClientsFactory;
use Steein\SDK\Interfaces\SteeinInterface;

/**
* Class Steein
*
* @package Steein
* @package Steein\SDK
*/
class Steein implements SteeinInterface
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public function __construct($config = [])
//Начинаем работу
$this->app = new Application($config->get('client_id'), $config->get('client_secret'));
$this->client = new SteeinClient(
HttpClientsFactory::createHttpClient()
SteeinHttpFactory::createHttpClient()
);

//Проверяем токен ключ
Expand Down Expand Up @@ -156,7 +156,7 @@ public function getClient()
/**
* Возвращает логин для перенаправления.
*
* @return \Steein\SDK\Http\Helpers\RedirectOAuth
* @return \Steein\SDK\Core\Http\Helpers\RedirectOAuth
*/
public function redirectOAuth()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Steein/SDK/SteeinClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/**
* Class SteeinClient
*
* @package Steein
* @package Steein\SDK
*/
class SteeinClient
{
Expand Down
6 changes: 3 additions & 3 deletions src/Steein/SDK/SteeinRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
namespace Steein\SDK;

use Steein\SDK\Authentication\AccessToken;
use Steein\SDK\Bundler\FileUpload\SteeinFile;
use Steein\SDK\Core\FileUpload\SteeinFile;
use Steein\SDK\Core\SteeinConstants;
use Steein\SDK\Exceptions\SteeinSDKException;
use Steein\SDK\Http\RequestBodyMultipart;
use Steein\SDK\Http\RequestBodyUrlEncoded;
use Steein\SDK\Core\Http\RequestBodyMultipart;
use Steein\SDK\Core\Http\RequestBodyUrlEncoded;
use Steein\SDK\Url\UrlManipulator;

/**
Expand Down

0 comments on commit cc59b21

Please sign in to comment.