Skip to content

Commit 0714069

Browse files
committed
Rename ShopifyClient to ShopifySDK
1 parent e8198a4 commit 0714069

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PHPShopify uses curl extension for handling http calls. So you need to have the
2525

2626
You can use PHPShopify in a pretty simple object oriented way.
2727

28-
#### Configure ShopifyClient SDK
28+
#### Configure ShopifySDK
2929
If you are using your own private API, provide the ApiKey and Password.
3030

3131
```php
@@ -35,7 +35,7 @@ $config = array(
3535
'Password' => '***YOUR-PRIVATE-API-PASSWORD***',
3636
);
3737

38-
PHPShopify\ShopifyClient::config($config);
38+
PHPShopify\ShopifySDK::config($config);
3939
```
4040

4141
For Third party apps, use the permanent access token.
@@ -46,12 +46,12 @@ $config = array(
4646
'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
4747
);
4848

49-
PHPShopify\ShopifyClient::config($config);
49+
PHPShopify\ShopifySDK::config($config);
5050
```
5151
##### How to get the permanent access token for a shop?
5252
There is a AuthHelper class to help you getting the permanent access token from the shop using oAuth.
5353

54-
1) First, you need to configure the client with additional parameter SharedSecret
54+
1) First, you need to configure the SDK with additional parameter SharedSecret
5555

5656
```php
5757
$config = array(
@@ -60,7 +60,7 @@ $config = array(
6060
'SharedSecret' => '***YOUR-SHARED-SECRET***',
6161
);
6262

63-
PHPShopify\ShopifyClient::config($config);
63+
PHPShopify\ShopifySDK::config($config);
6464
```
6565

6666
2) Create the authentication request
@@ -81,7 +81,7 @@ $redirectUrl = 'https://yourappurl.com/your_redirect_url.php';
8181

8282
```php
8383
//your_redirect_url.php
84-
PHPShopify\ShopifyClient::config($config);
84+
PHPShopify\ShopifySDK::config($config);
8585
$accessToken = \PHPShopify\AuthHelper::getAccessToken();
8686
//Now store it in database or somewhere else
8787
```
@@ -90,21 +90,21 @@ $accessToken = \PHPShopify\AuthHelper::getAccessToken();
9090
9191
```php
9292
//your_authorize_and_redirect_url.php
93-
PHPShopify\ShopifyClient::config($config);
93+
PHPShopify\ShopifySDK::config($config);
9494
$accessToken = \PHPShopify\AuthHelper::createAuthRequest($scopes);
9595
//Now store it in database or somewhere else
9696
```
9797

98-
#### Get the ShopifyClient SDK Object
98+
#### Get the ShopifySDK Object
9999

100100
```php
101-
$shopify = new PHPShopify\ShopifyClient;
101+
$shopify = new PHPShopify\ShopifySDK;
102102
```
103103

104104
You can provide the configuration as a parameter while instantiating the object (if you didn't configure already by calling `config()` method)
105105

106106
```php
107-
$shopify = new PHPShopify\ShopifyClient($config);
107+
$shopify = new PHPShopify\ShopifySDK($config);
108108
```
109109

110110
##### Now you can do `get()`, `post()`, `put()`, `delete()` calling the resources in the object oriented way. All resources are named as same as it is named in shopify API reference. (See the resource map below.)

lib/AuthHelper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public static function verifyShopifyRequest()
4343
{
4444
$data = $_GET;
4545

46-
if(!isset(ShopifyClient::$config['SharedSecret'])) {
46+
if(!isset(ShopifySDK::$config['SharedSecret'])) {
4747
throw new SdkException("Please provide SharedSecret while configuring the SDK client.");
4848
}
4949

50-
$sharedSecret = ShopifyClient::$config['SharedSecret'];
50+
$sharedSecret = ShopifySDK::$config['SharedSecret'];
5151

5252
//Get the hmac and remove it from array
5353
if (isset($data['hmac'])) {
@@ -87,7 +87,7 @@ public static function verifyShopifyRequest()
8787
*/
8888
public static function createAuthRequest($scopes, $redirectUrl = null)
8989
{
90-
$config = ShopifyClient::$config;
90+
$config = ShopifySDK::$config;
9191

9292
if(!isset($config['ShopUrl']) || !isset($config['ApiKey'])) {
9393
throw new SdkException("ShopUrl and ApiKey are required for authentication request. Please check SDK configuration!");
@@ -124,7 +124,7 @@ public static function createAuthRequest($scopes, $redirectUrl = null)
124124
*/
125125
public static function getAccessToken()
126126
{
127-
$config = ShopifyClient::$config;
127+
$config = ShopifySDK::$config;
128128

129129
if(!isset($config['SharedSecret']) || !isset($config['ApiKey'])) {
130130
throw new SdkException("SharedSecret and ApiKey are required for getting access token. Please check SDK configuration!");

lib/ShopifyAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function __construct($id = null, $parentResourceUrl = '')
110110
{
111111
$this->id = $id;
112112

113-
$config = ShopifyClient::$config;
113+
$config = ShopifySDK::$config;
114114

115115
$this->resourceUrl = ($parentResourceUrl ? $parentResourceUrl . '/' : $config['AdminUrl']) . $this->getResourcePath() . ($this->id ? '/' . $this->id : '');
116116

lib/ShopifyClient.php renamed to lib/ShopifySDK.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
| 'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
3131
| );
3232
| //Create the shopify client object
33-
| $shopify = new ShopifyClient($config);
33+
| $shopify = new ShopifySDK($config);
3434
|
3535
| //Get shop details
3636
| $products = $shopify->Shop->get();
@@ -63,7 +63,7 @@
6363
*/
6464
use PHPShopify\Exception\SdkException;
6565

66-
class ShopifyClient
66+
class ShopifySDK
6767
{
6868
/**
6969
* Shop / API configurations
@@ -131,7 +131,7 @@ class ShopifyClient
131131
);
132132

133133
/*
134-
* ShopifyClient constructor
134+
* ShopifySDK constructor
135135
*
136136
* @param array $config
137137
*
@@ -140,8 +140,8 @@ class ShopifyClient
140140
public function __construct($config = array())
141141
{
142142
if(!empty($config)) {
143-
ShopifyClient::$config = $config;
144-
ShopifyClient::setAdminUrl();
143+
ShopifySDK::$config = $config;
144+
ShopifySDK::setAdminUrl();
145145
}
146146
}
147147

@@ -198,7 +198,7 @@ public function __call($resourceName, $arguments)
198198
*
199199
* @param array $config
200200
*
201-
* @return ShopifyClient
201+
* @return ShopifySDK
202202
*/
203203
public static function config($config)
204204
{
@@ -211,7 +211,7 @@ public static function config($config)
211211
self::setAdminUrl();
212212
}
213213

214-
return new ShopifyClient;
214+
return new ShopifySDK;
215215
}
216216

217217
/**

0 commit comments

Comments
 (0)