diff --git a/404.html b/404.html index 11f5255..0fac05e 100644 --- a/404.html +++ b/404.html @@ -114,6 +114,6 @@ - + diff --git a/class-RetailCrm.ApiClient.html b/class-RetailCrm.ApiClient.html index 722740e..f2ca860 100644 --- a/class-RetailCrm.ApiClient.html +++ b/class-RetailCrm.ApiClient.html @@ -117,7 +117,7 @@ Namespace: RetailCrm
- Located at RetailCrm/ApiClient.php
+ Located at RetailCrm/ApiClient.php
@@ -135,7 +135,7 @@
# - __construct( string $url, string $apiKey ) + __construct( string $url, string $apiKey, string $site = null )

Client creating

@@ -154,6 +154,9 @@
$apiKey
+
+
$site
+
$siteCode
@@ -179,7 +182,7 @@
# - ordersCreate( array $order ) + ordersCreate( array $order, string $site = null )

Create a order

@@ -195,6 +198,9 @@
$order
+
+
$site
+
(default: null)
@@ -220,7 +226,7 @@
# - ordersEdit( array $order, mixed $by = 'externalId' ) + ordersEdit( array $order, string $by = 'externalId', mixed $site = null )

Edit a order

@@ -238,6 +244,9 @@
$by
+
$site (default: null) +
+
$site
@@ -264,7 +273,7 @@
# - ordersUpload( array $orders ) + ordersUpload( array $orders, string $site = null )

Upload array of the orders

@@ -280,6 +289,9 @@
$orders
+
+
$site
+
(default: null)
@@ -305,7 +317,7 @@
# - ordersGet( string $id, string $by = 'externalId' ) + ordersGet( string $id, string $by = 'externalId', string $site = null )

Get order by id or externalId

@@ -324,6 +336,9 @@
$by
(default: 'externalId') +
+
$site
+
(default: null)
@@ -349,7 +364,7 @@
# - ordersHistory( DateTime $startDate = null, DateTime $endDate = null, integer $limit = 100, integer $offset = 0, boolean $skipMyChanges = true ) + ordersHistory( DateTime $startDate = null, DateTime $endDate = null, integer $limit = 100, integer $offset = 0, boolean $skipMyChanges = true )

Returns a orders history

@@ -402,7 +417,7 @@
# - ordersList( array $filter = array(), integer $page = null, integer $limit = null ) + ordersList( array $filter = array(), integer $page = null, integer $limit = null )

Returns filtered orders list

@@ -449,7 +464,7 @@
# - ordersStatuses( array $ids = array(), array $externalIds = array() ) + ordersStatuses( array $ids = array(), array $externalIds = array() )

Returns statuses of the orders

@@ -493,7 +508,7 @@
# - ordersFixExternalIds( array $ids ) + ordersFixExternalIds( array $ids )

Save order IDs' (id and externalId) association in the CRM

@@ -534,7 +549,7 @@
# - customersCreate( array $customer ) + customersCreate( array $customer, string $site = null )

Create a customer

@@ -550,6 +565,9 @@
$customer
+
+
$site
+
(default: null)
@@ -575,7 +593,7 @@
# - customersEdit( array $customer, mixed $by = 'externalId' ) + customersEdit( array $customer, string $by = 'externalId', string $site = null )

Edit a customer

@@ -593,7 +611,10 @@
$by
-
+
(default: 'externalId') +
+
$site
+
(default: null)
@@ -619,7 +640,7 @@
# - customersUpload( array $customers ) + customersUpload( array $customers, string $site = null )

Upload array of the customers

@@ -635,6 +656,9 @@
$customers
+
+
$site
+
(default: null)
@@ -660,7 +684,7 @@
# - customersGet( string $id, string $by = 'externalId' ) + customersGet( string $id, string $by = 'externalId', string $site = null )

Get customer by id or externalId

@@ -679,6 +703,9 @@
$by
(default: 'externalId') +
+
$site
+
(default: null)
@@ -704,7 +731,7 @@
# - customersList( array $filter = array(), integer $page = null, integer $limit = null ) + customersList( array $filter = array(), integer $page = null, integer $limit = null )

Returns filtered customers list

@@ -751,7 +778,7 @@
# - customersFixExternalIds( array $ids ) + customersFixExternalIds( array $ids )

Save customer IDs' (id and externalId) association in the CRM

@@ -792,7 +819,7 @@
# - deliveryServicesList( ) + deliveryServicesList( )

Returns deliveryServices list

@@ -827,7 +854,7 @@
# - deliveryTypesList( ) + deliveryTypesList( )

Returns deliveryTypes list

@@ -862,7 +889,7 @@
# - orderMethodsList( ) + orderMethodsList( )

Returns orderMethods list

@@ -897,7 +924,7 @@
# - orderTypesList( ) + orderTypesList( )

Returns orderTypes list

@@ -932,7 +959,7 @@
# - paymentStatusesList( ) + paymentStatusesList( )

Returns paymentStatuses list

@@ -967,7 +994,7 @@
# - paymentTypesList( ) + paymentTypesList( )

Returns paymentTypes list

@@ -1002,7 +1029,7 @@
# - productStatusesList( ) + productStatusesList( )

Returns productStatuses list

@@ -1037,7 +1064,7 @@
# - statusGroupsList( ) + statusGroupsList( )

Returns statusGroups list

@@ -1072,7 +1099,7 @@
# - statusesList( ) + statusesList( )

Returns statuses list

@@ -1093,6 +1120,41 @@ +
+
+ + + + + public + RetailCrm\Response\ApiResponse + + + + +
+ # + sitesList( ) + +
+

Returns sites list

+ +
+ +
@@ -1107,7 +1169,7 @@
# - deliveryServicesEdit( array $data ) + deliveryServicesEdit( array $data )

Edit deliveryService

@@ -1148,7 +1210,7 @@
# - deliveryTypesEdit( array $data ) + deliveryTypesEdit( array $data )

Edit deliveryType

@@ -1189,7 +1251,7 @@
# - orderMethodsEdit( array $data ) + orderMethodsEdit( array $data )

Edit orderMethod

@@ -1230,7 +1292,7 @@
# - orderTypesEdit( array $data ) + orderTypesEdit( array $data )

Edit orderType

@@ -1271,7 +1333,7 @@
# - paymentStatusesEdit( array $data ) + paymentStatusesEdit( array $data )

Edit paymentStatus

@@ -1312,7 +1374,7 @@
# - paymentTypesEdit( array $data ) + paymentTypesEdit( array $data )

Edit paymentType

@@ -1353,7 +1415,7 @@
# - productStatusesEdit( array $data ) + productStatusesEdit( array $data )

Edit productStatus

@@ -1394,7 +1456,7 @@
# - statusesEdit( array $data ) + statusesEdit( array $data )

Edit order status

@@ -1421,6 +1483,47 @@ +
+
+ + + + + public + RetailCrm\Response\ApiResponse + + + + +
+ # + sitesEdit( array $data ) + +
+

Edit site

+ +
+ +
@@ -1435,7 +1538,7 @@
# - statisticUpdate( ) + statisticUpdate( )

Update CRM basic statistic

@@ -1456,6 +1559,78 @@ +
+
+ + + + + public + string + + + + +
+ # + getSite( ) + +
+

Return current site

+ +
+ + +
+ + + + + public + + + + + +
+ # + setSite( string $site ) + +
+

Set site

+ +
+ +
@@ -1510,6 +1685,6 @@
- + diff --git a/class-RetailCrm.Exception.CurlException.html b/class-RetailCrm.Exception.CurlException.html index ad060da..dedb817 100644 --- a/class-RetailCrm.Exception.CurlException.html +++ b/class-RetailCrm.Exception.CurlException.html @@ -175,6 +175,6 @@ RuntimeException
- + diff --git a/class-RetailCrm.Exception.InvalidJsonException.html b/class-RetailCrm.Exception.InvalidJsonException.html index 4fabd63..f295dc3 100644 --- a/class-RetailCrm.Exception.InvalidJsonException.html +++ b/class-RetailCrm.Exception.InvalidJsonException.html @@ -181,6 +181,6 @@ DomainException
- + diff --git a/class-RetailCrm.Http.Client.html b/class-RetailCrm.Http.Client.html index 3388d10..40ce5c3 100644 --- a/class-RetailCrm.Http.Client.html +++ b/class-RetailCrm.Http.Client.html @@ -282,6 +282,6 @@
- + diff --git a/class-RetailCrm.Response.ApiResponse.html b/class-RetailCrm.Response.ApiResponse.html index 2e6e4dd..ebda3e5 100644 --- a/class-RetailCrm.Response.ApiResponse.html +++ b/class-RetailCrm.Response.ApiResponse.html @@ -507,6 +507,6 @@
- + diff --git a/deprecated.html b/deprecated.html index 4385397..f086ff9 100644 --- a/deprecated.html +++ b/deprecated.html @@ -118,6 +118,6 @@
- + diff --git a/elementlist.js b/elementlist.js index 17f8281..3dba260 100644 --- a/elementlist.js +++ b/elementlist.js @@ -1,3 +1,3 @@ var ApiGen = ApiGen || {}; -ApiGen.elements = [["c","RetailCrm\\ApiClient"],["m","RetailCrm\\ApiClient::__construct()"],["m","RetailCrm\\ApiClient::customersCreate()"],["m","RetailCrm\\ApiClient::customersEdit()"],["m","RetailCrm\\ApiClient::customersFixExternalIds()"],["m","RetailCrm\\ApiClient::customersGet()"],["m","RetailCrm\\ApiClient::customersList()"],["m","RetailCrm\\ApiClient::customersUpload()"],["m","RetailCrm\\ApiClient::deliveryServicesEdit()"],["m","RetailCrm\\ApiClient::deliveryServicesList()"],["m","RetailCrm\\ApiClient::deliveryTypesEdit()"],["m","RetailCrm\\ApiClient::deliveryTypesList()"],["m","RetailCrm\\ApiClient::orderMethodsEdit()"],["m","RetailCrm\\ApiClient::orderMethodsList()"],["m","RetailCrm\\ApiClient::ordersCreate()"],["m","RetailCrm\\ApiClient::ordersEdit()"],["m","RetailCrm\\ApiClient::ordersFixExternalIds()"],["m","RetailCrm\\ApiClient::ordersGet()"],["m","RetailCrm\\ApiClient::ordersHistory()"],["m","RetailCrm\\ApiClient::ordersList()"],["m","RetailCrm\\ApiClient::ordersStatuses()"],["m","RetailCrm\\ApiClient::ordersUpload()"],["m","RetailCrm\\ApiClient::orderTypesEdit()"],["m","RetailCrm\\ApiClient::orderTypesList()"],["m","RetailCrm\\ApiClient::paymentStatusesEdit()"],["m","RetailCrm\\ApiClient::paymentStatusesList()"],["m","RetailCrm\\ApiClient::paymentTypesEdit()"],["m","RetailCrm\\ApiClient::paymentTypesList()"],["m","RetailCrm\\ApiClient::productStatusesEdit()"],["m","RetailCrm\\ApiClient::productStatusesList()"],["m","RetailCrm\\ApiClient::statisticUpdate()"],["m","RetailCrm\\ApiClient::statusesEdit()"],["m","RetailCrm\\ApiClient::statusesList()"],["m","RetailCrm\\ApiClient::statusGroupsList()"],["cc","RetailCrm\\ApiClient::VERSION"],["c","RetailCrm\\Exception\\CurlException"],["c","RetailCrm\\Exception\\InvalidJsonException"],["c","RetailCrm\\Http\\Client"],["m","RetailCrm\\Http\\Client::__construct()"],["m","RetailCrm\\Http\\Client::makeRequest()"],["cc","RetailCrm\\Http\\Client::METHOD_GET"],["cc","RetailCrm\\Http\\Client::METHOD_POST"],["c","RetailCrm\\Response\\ApiResponse"],["m","RetailCrm\\Response\\ApiResponse::__call()"],["m","RetailCrm\\Response\\ApiResponse::__construct()"],["m","RetailCrm\\Response\\ApiResponse::__get()"],["m","RetailCrm\\Response\\ApiResponse::getStatusCode()"],["m","RetailCrm\\Response\\ApiResponse::isSuccessful()"],["m","RetailCrm\\Response\\ApiResponse::offsetExists()"],["m","RetailCrm\\Response\\ApiResponse::offsetGet()"],["m","RetailCrm\\Response\\ApiResponse::offsetSet()"],["m","RetailCrm\\Response\\ApiResponse::offsetUnset()"]]; +ApiGen.elements = [["c","RetailCrm\\ApiClient"],["m","RetailCrm\\ApiClient::__construct()"],["m","RetailCrm\\ApiClient::customersCreate()"],["m","RetailCrm\\ApiClient::customersEdit()"],["m","RetailCrm\\ApiClient::customersFixExternalIds()"],["m","RetailCrm\\ApiClient::customersGet()"],["m","RetailCrm\\ApiClient::customersList()"],["m","RetailCrm\\ApiClient::customersUpload()"],["m","RetailCrm\\ApiClient::deliveryServicesEdit()"],["m","RetailCrm\\ApiClient::deliveryServicesList()"],["m","RetailCrm\\ApiClient::deliveryTypesEdit()"],["m","RetailCrm\\ApiClient::deliveryTypesList()"],["m","RetailCrm\\ApiClient::getSite()"],["m","RetailCrm\\ApiClient::orderMethodsEdit()"],["m","RetailCrm\\ApiClient::orderMethodsList()"],["m","RetailCrm\\ApiClient::ordersCreate()"],["m","RetailCrm\\ApiClient::ordersEdit()"],["m","RetailCrm\\ApiClient::ordersFixExternalIds()"],["m","RetailCrm\\ApiClient::ordersGet()"],["m","RetailCrm\\ApiClient::ordersHistory()"],["m","RetailCrm\\ApiClient::ordersList()"],["m","RetailCrm\\ApiClient::ordersStatuses()"],["m","RetailCrm\\ApiClient::ordersUpload()"],["m","RetailCrm\\ApiClient::orderTypesEdit()"],["m","RetailCrm\\ApiClient::orderTypesList()"],["m","RetailCrm\\ApiClient::paymentStatusesEdit()"],["m","RetailCrm\\ApiClient::paymentStatusesList()"],["m","RetailCrm\\ApiClient::paymentTypesEdit()"],["m","RetailCrm\\ApiClient::paymentTypesList()"],["m","RetailCrm\\ApiClient::productStatusesEdit()"],["m","RetailCrm\\ApiClient::productStatusesList()"],["m","RetailCrm\\ApiClient::setSite()"],["m","RetailCrm\\ApiClient::sitesEdit()"],["m","RetailCrm\\ApiClient::sitesList()"],["m","RetailCrm\\ApiClient::statisticUpdate()"],["m","RetailCrm\\ApiClient::statusesEdit()"],["m","RetailCrm\\ApiClient::statusesList()"],["m","RetailCrm\\ApiClient::statusGroupsList()"],["cc","RetailCrm\\ApiClient::VERSION"],["c","RetailCrm\\Exception\\CurlException"],["c","RetailCrm\\Exception\\InvalidJsonException"],["c","RetailCrm\\Http\\Client"],["m","RetailCrm\\Http\\Client::__construct()"],["m","RetailCrm\\Http\\Client::makeRequest()"],["cc","RetailCrm\\Http\\Client::METHOD_GET"],["cc","RetailCrm\\Http\\Client::METHOD_POST"],["c","RetailCrm\\Response\\ApiResponse"],["m","RetailCrm\\Response\\ApiResponse::__call()"],["m","RetailCrm\\Response\\ApiResponse::__construct()"],["m","RetailCrm\\Response\\ApiResponse::__get()"],["m","RetailCrm\\Response\\ApiResponse::getStatusCode()"],["m","RetailCrm\\Response\\ApiResponse::isSuccessful()"],["m","RetailCrm\\Response\\ApiResponse::offsetExists()"],["m","RetailCrm\\Response\\ApiResponse::offsetGet()"],["m","RetailCrm\\Response\\ApiResponse::offsetSet()"],["m","RetailCrm\\Response\\ApiResponse::offsetUnset()"]]; diff --git a/index.html b/index.html index 7becd90..cd14963 100644 --- a/index.html +++ b/index.html @@ -7,6 +7,7 @@ + diff --git a/namespace-RetailCrm.Exception.html b/namespace-RetailCrm.Exception.html index 4e1b1c9..b75b471 100644 --- a/namespace-RetailCrm.Exception.html +++ b/namespace-RetailCrm.Exception.html @@ -125,6 +125,6 @@
- + diff --git a/namespace-RetailCrm.Http.html b/namespace-RetailCrm.Http.html index e72d411..21b6ab4 100644 --- a/namespace-RetailCrm.Http.html +++ b/namespace-RetailCrm.Http.html @@ -119,6 +119,6 @@
- + diff --git a/namespace-RetailCrm.Response.html b/namespace-RetailCrm.Response.html index c945b01..349e435 100644 --- a/namespace-RetailCrm.Response.html +++ b/namespace-RetailCrm.Response.html @@ -119,6 +119,6 @@
- + diff --git a/namespace-RetailCrm.html b/namespace-RetailCrm.html index 422ef3c..3bd03bc 100644 --- a/namespace-RetailCrm.html +++ b/namespace-RetailCrm.html @@ -131,6 +131,6 @@
- + diff --git a/source-class-RetailCrm.ApiClient.html b/source-class-RetailCrm.ApiClient.html index 505684f..ea327f5 100644 --- a/source-class-RetailCrm.ApiClient.html +++ b/source-class-RetailCrm.ApiClient.html @@ -113,599 +113,697 @@ 15 protected $client; 16 17 /** - 18 * Client creating - 19 * - 20 * @param string $url - 21 * @param string $apiKey - 22 * @return mixed - 23 */ - 24 public function __construct($url, $apiKey) - 25 { - 26 if ('/' != substr($url, strlen($url) - 1, 1)) { - 27 $url .= '/'; - 28 } - 29 - 30 $url = $url . 'api/' . self::VERSION; - 31 - 32 $this->client = new Client($url, array('apiKey' => $apiKey)); - 33 } - 34 - 35 /** - 36 * Create a order - 37 * - 38 * @param array $order - 39 * @return ApiResponse - 40 */ - 41 public function ordersCreate(array $order) - 42 { - 43 if (!sizeof($order)) { - 44 throw new \InvalidArgumentException('Parameter `order` must contains a data'); - 45 } - 46 - 47 return $this->client->makeRequest("/orders/create", Client::METHOD_POST, array( - 48 'order' => json_encode($order) - 49 )); - 50 } - 51 - 52 /** - 53 * Edit a order - 54 * - 55 * @param array $order - 56 * @return ApiResponse - 57 */ - 58 public function ordersEdit(array $order, $by = 'externalId') - 59 { - 60 if (!sizeof($order)) { - 61 throw new \InvalidArgumentException('Parameter `order` must contains a data'); - 62 } - 63 - 64 $this->checkIdParameter($by); - 65 - 66 if (!isset($order[$by])) { - 67 throw new \InvalidArgumentException(sprintf('Order array must contain the "%s" parameter.', $by)); - 68 } - 69 - 70 return $this->client->makeRequest("/orders/" . $order[$by] . "/edit", Client::METHOD_POST, array( - 71 'order' => json_encode($order), - 72 'by' => $by, - 73 )); - 74 } - 75 - 76 /** - 77 * Upload array of the orders - 78 * - 79 * @param array $orders - 80 * @return ApiResponse - 81 */ - 82 public function ordersUpload(array $orders) - 83 { - 84 if (!sizeof($orders)) { - 85 throw new \InvalidArgumentException('Parameter `orders` must contains array of the orders'); - 86 } - 87 - 88 return $this->client->makeRequest("/orders/upload", Client::METHOD_POST, array( - 89 'orders' => json_encode($orders), - 90 )); - 91 } - 92 - 93 /** - 94 * Get order by id or externalId - 95 * - 96 * @param string $id - 97 * @param string $by (default: 'externalId') - 98 * @return ApiResponse - 99 */ -100 public function ordersGet($id, $by = 'externalId') -101 { -102 $this->checkIdParameter($by); -103 -104 return $this->client->makeRequest("/orders/$id", Client::METHOD_GET, array('by' => $by)); + 18 * Site code + 19 */ + 20 protected $siteCode; + 21 + 22 /** + 23 * Client creating + 24 * + 25 * @param string $url + 26 * @param string $apiKey + 27 * @param string $siteCode + 28 * @return mixed + 29 */ + 30 public function __construct($url, $apiKey, $site = null) + 31 { + 32 if ('/' != substr($url, strlen($url) - 1, 1)) { + 33 $url .= '/'; + 34 } + 35 + 36 $url = $url . 'api/' . self::VERSION; + 37 + 38 $this->client = new Client($url, array('apiKey' => $apiKey)); + 39 $this->siteCode = $site; + 40 } + 41 + 42 /** + 43 * Create a order + 44 * + 45 * @param array $order + 46 * @param string $site (default: null) + 47 * @return ApiResponse + 48 */ + 49 public function ordersCreate(array $order, $site = null) + 50 { + 51 if (!sizeof($order)) { + 52 throw new \InvalidArgumentException('Parameter `order` must contains a data'); + 53 } + 54 + 55 return $this->client->makeRequest("/orders/create", Client::METHOD_POST, $this->fillSite($site, array( + 56 'order' => json_encode($order) + 57 ))); + 58 } + 59 + 60 /** + 61 * Edit a order + 62 * + 63 * @param array $order + 64 * @param string $site (default: null) + 65 * @return ApiResponse + 66 */ + 67 public function ordersEdit(array $order, $by = 'externalId', $site = null) + 68 { + 69 if (!sizeof($order)) { + 70 throw new \InvalidArgumentException('Parameter `order` must contains a data'); + 71 } + 72 + 73 $this->checkIdParameter($by); + 74 + 75 if (!isset($order[$by])) { + 76 throw new \InvalidArgumentException(sprintf('Order array must contain the "%s" parameter.', $by)); + 77 } + 78 + 79 return $this->client->makeRequest( + 80 "/orders/" . $order[$by] . "/edit", + 81 Client::METHOD_POST, + 82 $this->fillSite($site, array( + 83 'order' => json_encode($order), + 84 'by' => $by, + 85 )) + 86 ); + 87 } + 88 + 89 /** + 90 * Upload array of the orders + 91 * + 92 * @param array $orders + 93 * @param string $site (default: null) + 94 * @return ApiResponse + 95 */ + 96 public function ordersUpload(array $orders, $site = null) + 97 { + 98 if (!sizeof($orders)) { + 99 throw new \InvalidArgumentException('Parameter `orders` must contains array of the orders'); +100 } +101 +102 return $this->client->makeRequest("/orders/upload", Client::METHOD_POST, $this->fillSite($site, array( +103 'orders' => json_encode($orders), +104 ))); 105 } 106 107 /** -108 * Returns a orders history +108 * Get order by id or externalId 109 * -110 * @param \DateTime $startDate (default: null) -111 * @param \DateTime $endDate (default: null) -112 * @param int $limit (default: 100) -113 * @param int $offset (default: 0) -114 * @param bool $skipMyChanges (default: true) -115 * @return ApiResponse -116 */ -117 public function ordersHistory( -118 \DateTime $startDate = null, -119 \DateTime $endDate = null, -120 $limit = 100, -121 $offset = 0, -122 $skipMyChanges = true -123 ) { -124 $parameters = array(); -125 -126 if ($startDate) { -127 $parameters['startDate'] = $startDate->format('Y-m-d H:i:s'); -128 } -129 if ($endDate) { -130 $parameters['endDate'] = $endDate->format('Y-m-d H:i:s'); -131 } -132 if ($limit) { -133 $parameters['limit'] = (int) $limit; -134 } -135 if ($offset) { -136 $parameters['offset'] = (int) $offset; -137 } -138 if ($skipMyChanges) { -139 $parameters['skipMyChanges'] = (bool) $skipMyChanges; -140 } -141 -142 return $this->client->makeRequest('/orders/history', Client::METHOD_GET, $parameters); -143 } -144 -145 /** -146 * Returns filtered orders list -147 * -148 * @param array $filter (default: array()) -149 * @param int $page (default: null) -150 * @param int $limit (default: null) -151 * @return ApiResponse -152 */ -153 public function ordersList(array $filter = array(), $page = null, $limit = null) -154 { -155 $parameters = array(); -156 -157 if (sizeof($filter)) { -158 $parameters['filter'] = $filter; -159 } -160 if (null !== $page) { -161 $parameters['page'] = (int) $page; -162 } -163 if (null !== $limit) { -164 $parameters['limit'] = (int) $limit; -165 } -166 -167 return $this->client->makeRequest('/orders', Client::METHOD_GET, $parameters); -168 } -169 -170 /** -171 * Returns statuses of the orders -172 * -173 * @param array $ids (default: array()) -174 * @param array $externalIds (default: array()) -175 * @return ApiResponse -176 */ -177 public function ordersStatuses(array $ids = array(), array $externalIds = array()) -178 { -179 $parameters = array(); -180 -181 if (sizeof($ids)) { -182 $parameters['ids'] = $ids; -183 } -184 if (sizeof($externalIds)) { -185 $parameters['externalIds'] = $externalIds; -186 } -187 -188 return $this->client->makeRequest('/orders/statuses', Client::METHOD_GET, $parameters); -189 } -190 -191 /** -192 * Save order IDs' (id and externalId) association in the CRM -193 * -194 * @param array $ids -195 * @return ApiResponse -196 */ -197 public function ordersFixExternalIds(array $ids) -198 { -199 if (!sizeof($ids)) { -200 throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair'); -201 } -202 -203 return $this->client->makeRequest("/orders/fix-external-ids", Client::METHOD_POST, array( -204 'orders' => json_encode($ids), -205 )); +110 * @param string $id +111 * @param string $by (default: 'externalId') +112 * @param string $site (default: null) +113 * @return ApiResponse +114 */ +115 public function ordersGet($id, $by = 'externalId', $site = null) +116 { +117 $this->checkIdParameter($by); +118 +119 return $this->client->makeRequest("/orders/$id", Client::METHOD_GET, $this->fillSite($site, array( +120 'by' => $by +121 ))); +122 } +123 +124 /** +125 * Returns a orders history +126 * +127 * @param \DateTime $startDate (default: null) +128 * @param \DateTime $endDate (default: null) +129 * @param int $limit (default: 100) +130 * @param int $offset (default: 0) +131 * @param bool $skipMyChanges (default: true) +132 * @return ApiResponse +133 */ +134 public function ordersHistory( +135 \DateTime $startDate = null, +136 \DateTime $endDate = null, +137 $limit = 100, +138 $offset = 0, +139 $skipMyChanges = true +140 ) { +141 $parameters = array(); +142 +143 if ($startDate) { +144 $parameters['startDate'] = $startDate->format('Y-m-d H:i:s'); +145 } +146 if ($endDate) { +147 $parameters['endDate'] = $endDate->format('Y-m-d H:i:s'); +148 } +149 if ($limit) { +150 $parameters['limit'] = (int) $limit; +151 } +152 if ($offset) { +153 $parameters['offset'] = (int) $offset; +154 } +155 if ($skipMyChanges) { +156 $parameters['skipMyChanges'] = (bool) $skipMyChanges; +157 } +158 +159 return $this->client->makeRequest('/orders/history', Client::METHOD_GET, $parameters); +160 } +161 +162 /** +163 * Returns filtered orders list +164 * +165 * @param array $filter (default: array()) +166 * @param int $page (default: null) +167 * @param int $limit (default: null) +168 * @return ApiResponse +169 */ +170 public function ordersList(array $filter = array(), $page = null, $limit = null) +171 { +172 $parameters = array(); +173 +174 if (sizeof($filter)) { +175 $parameters['filter'] = $filter; +176 } +177 if (null !== $page) { +178 $parameters['page'] = (int) $page; +179 } +180 if (null !== $limit) { +181 $parameters['limit'] = (int) $limit; +182 } +183 +184 return $this->client->makeRequest('/orders', Client::METHOD_GET, $parameters); +185 } +186 +187 /** +188 * Returns statuses of the orders +189 * +190 * @param array $ids (default: array()) +191 * @param array $externalIds (default: array()) +192 * @return ApiResponse +193 */ +194 public function ordersStatuses(array $ids = array(), array $externalIds = array()) +195 { +196 $parameters = array(); +197 +198 if (sizeof($ids)) { +199 $parameters['ids'] = $ids; +200 } +201 if (sizeof($externalIds)) { +202 $parameters['externalIds'] = $externalIds; +203 } +204 +205 return $this->client->makeRequest('/orders/statuses', Client::METHOD_GET, $parameters); 206 } 207 208 /** -209 * Create a customer +209 * Save order IDs' (id and externalId) association in the CRM 210 * -211 * @param array $customer +211 * @param array $ids 212 * @return ApiResponse 213 */ -214 public function customersCreate(array $customer) +214 public function ordersFixExternalIds(array $ids) 215 { -216 if (!sizeof($customer)) { -217 throw new \InvalidArgumentException('Parameter `customer` must contains a data'); +216 if (!sizeof($ids)) { +217 throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair'); 218 } 219 -220 return $this->client->makeRequest("/customers/create", Client::METHOD_POST, array( -221 'customer' => json_encode($customer) +220 return $this->client->makeRequest("/orders/fix-external-ids", Client::METHOD_POST, array( +221 'orders' => json_encode($ids), 222 )); 223 } 224 225 /** -226 * Edit a customer +226 * Create a customer 227 * 228 * @param array $customer -229 * @return ApiResponse -230 */ -231 public function customersEdit(array $customer, $by = 'externalId') -232 { -233 if (!sizeof($customer)) { -234 throw new \InvalidArgumentException('Parameter `customer` must contains a data'); -235 } -236 -237 $this->checkIdParameter($by); -238 -239 if (!isset($customer[$by])) { -240 throw new \InvalidArgumentException(sprintf('Customer array must contain the "%s" parameter.', $by)); -241 } +229 * @param string $site (default: null) +230 * @return ApiResponse +231 */ +232 public function customersCreate(array $customer, $site = null) +233 { +234 if (!sizeof($customer)) { +235 throw new \InvalidArgumentException('Parameter `customer` must contains a data'); +236 } +237 +238 return $this->client->makeRequest("/customers/create", Client::METHOD_POST, $this->fillSite($site, array( +239 'customer' => json_encode($customer) +240 ))); +241 } 242 -243 return $this->client->makeRequest("/customers/" . $customer[$by] . "/edit", Client::METHOD_POST, array( -244 'customer' => json_encode($customer), -245 'by' => $by, -246 )); -247 } -248 -249 /** -250 * Upload array of the customers -251 * -252 * @param array $customers -253 * @return ApiResponse -254 */ -255 public function customersUpload(array $customers) -256 { -257 if (!sizeof($customers)) { -258 throw new \InvalidArgumentException('Parameter `customers` must contains array of the customers'); -259 } -260 -261 return $this->client->makeRequest("/customers/upload", Client::METHOD_POST, array( -262 'customers' => json_encode($customers), -263 )); -264 } -265 -266 /** -267 * Get customer by id or externalId -268 * -269 * @param string $id -270 * @param string $by (default: 'externalId') -271 * @return ApiResponse -272 */ -273 public function customersGet($id, $by = 'externalId') -274 { -275 $this->checkIdParameter($by); -276 -277 return $this->client->makeRequest("/customers/$id", Client::METHOD_GET, array('by' => $by)); -278 } -279 -280 /** -281 * Returns filtered customers list -282 * -283 * @param array $filter (default: array()) -284 * @param int $page (default: null) -285 * @param int $limit (default: null) -286 * @return ApiResponse -287 */ -288 public function customersList(array $filter = array(), $page = null, $limit = null) -289 { -290 $parameters = array(); -291 -292 if (sizeof($filter)) { -293 $parameters['filter'] = $filter; -294 } -295 if (null !== $page) { -296 $parameters['page'] = (int) $page; -297 } -298 if (null !== $limit) { -299 $parameters['limit'] = (int) $limit; -300 } -301 -302 return $this->client->makeRequest('/customers', Client::METHOD_GET, $parameters); -303 } -304 -305 /** -306 * Save customer IDs' (id and externalId) association in the CRM -307 * -308 * @param array $ids -309 * @return ApiResponse -310 */ -311 public function customersFixExternalIds(array $ids) -312 { -313 if (!sizeof($ids)) { -314 throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair'); -315 } -316 -317 return $this->client->makeRequest("/customers/fix-external-ids", Client::METHOD_POST, array( -318 'customers' => json_encode($ids), -319 )); -320 } -321 -322 /** -323 * Returns deliveryServices list -324 * -325 * @return ApiResponse -326 */ -327 public function deliveryServicesList() -328 { -329 return $this->client->makeRequest('/reference/delivery-services', Client::METHOD_GET); -330 } -331 -332 /** -333 * Returns deliveryTypes list -334 * -335 * @return ApiResponse -336 */ -337 public function deliveryTypesList() -338 { -339 return $this->client->makeRequest('/reference/delivery-types', Client::METHOD_GET); -340 } -341 -342 /** -343 * Returns orderMethods list -344 * -345 * @return ApiResponse -346 */ -347 public function orderMethodsList() -348 { -349 return $this->client->makeRequest('/reference/order-methods', Client::METHOD_GET); -350 } -351 -352 /** -353 * Returns orderTypes list -354 * -355 * @return ApiResponse -356 */ -357 public function orderTypesList() -358 { -359 return $this->client->makeRequest('/reference/order-types', Client::METHOD_GET); -360 } -361 -362 /** -363 * Returns paymentStatuses list -364 * -365 * @return ApiResponse -366 */ -367 public function paymentStatusesList() -368 { -369 return $this->client->makeRequest('/reference/payment-statuses', Client::METHOD_GET); -370 } -371 -372 /** -373 * Returns paymentTypes list -374 * -375 * @return ApiResponse -376 */ -377 public function paymentTypesList() -378 { -379 return $this->client->makeRequest('/reference/payment-types', Client::METHOD_GET); -380 } -381 -382 /** -383 * Returns productStatuses list -384 * -385 * @return ApiResponse -386 */ -387 public function productStatusesList() -388 { -389 return $this->client->makeRequest('/reference/product-statuses', Client::METHOD_GET); -390 } -391 -392 /** -393 * Returns statusGroups list -394 * -395 * @return ApiResponse -396 */ -397 public function statusGroupsList() -398 { -399 return $this->client->makeRequest('/reference/status-groups', Client::METHOD_GET); -400 } -401 -402 /** -403 * Returns statuses list -404 * -405 * @return ApiResponse -406 */ -407 public function statusesList() -408 { -409 return $this->client->makeRequest('/reference/statuses', Client::METHOD_GET); -410 } -411 -412 /** -413 * Edit deliveryService -414 * -415 * @param array $data delivery service data -416 * @return ApiResponse -417 */ -418 public function deliveryServicesEdit(array $data) -419 { -420 if (!isset($data['code'])) { -421 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -422 } -423 -424 return $this->client->makeRequest( -425 '/reference/delivery-services/' . $data['code'] . '/edit', -426 Client::METHOD_POST, -427 array( -428 'deliveryService' => json_encode($data) -429 ) -430 ); -431 } -432 -433 /** -434 * Edit deliveryType -435 * -436 * @param array $data delivery type data -437 * @return ApiResponse -438 */ -439 public function deliveryTypesEdit(array $data) -440 { -441 if (!isset($data['code'])) { -442 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -443 } -444 -445 return $this->client->makeRequest( -446 '/reference/delivery-types/' . $data['code'] . '/edit', -447 Client::METHOD_POST, -448 array( -449 'deliveryType' => json_encode($data) -450 ) -451 ); -452 } -453 -454 /** -455 * Edit orderMethod -456 * -457 * @param array $data order method data -458 * @return ApiResponse -459 */ -460 public function orderMethodsEdit(array $data) -461 { -462 if (!isset($data['code'])) { -463 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -464 } -465 -466 return $this->client->makeRequest( -467 '/reference/order-methods/' . $data['code'] . '/edit', -468 Client::METHOD_POST, -469 array( -470 'orderMethod' => json_encode($data) -471 ) -472 ); -473 } -474 -475 /** -476 * Edit orderType -477 * -478 * @param array $data order type data -479 * @return ApiResponse -480 */ -481 public function orderTypesEdit(array $data) -482 { -483 if (!isset($data['code'])) { -484 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -485 } -486 -487 return $this->client->makeRequest( -488 '/reference/order-types/' . $data['code'] . '/edit', -489 Client::METHOD_POST, -490 array( -491 'orderType' => json_encode($data) -492 ) -493 ); -494 } -495 -496 /** -497 * Edit paymentStatus -498 * -499 * @param array $data payment status data -500 * @return ApiResponse -501 */ -502 public function paymentStatusesEdit(array $data) -503 { -504 if (!isset($data['code'])) { -505 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -506 } -507 -508 return $this->client->makeRequest( -509 '/reference/payment-statuses/' . $data['code'] . '/edit', -510 Client::METHOD_POST, -511 array( -512 'paymentStatus' => json_encode($data) -513 ) -514 ); -515 } -516 -517 /** -518 * Edit paymentType -519 * -520 * @param array $data payment type data -521 * @return ApiResponse -522 */ -523 public function paymentTypesEdit(array $data) -524 { -525 if (!isset($data['code'])) { -526 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -527 } -528 -529 return $this->client->makeRequest( -530 '/reference/payment-types/' . $data['code'] . '/edit', -531 Client::METHOD_POST, -532 array( -533 'paymentType' => json_encode($data) -534 ) -535 ); -536 } -537 -538 /** -539 * Edit productStatus -540 * -541 * @param array $data product status data -542 * @return ApiResponse -543 */ -544 public function productStatusesEdit(array $data) -545 { -546 if (!isset($data['code'])) { -547 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -548 } -549 -550 return $this->client->makeRequest( -551 '/reference/product-statuses/' . $data['code'] . '/edit', -552 Client::METHOD_POST, -553 array( -554 'productStatus' => json_encode($data) -555 ) -556 ); -557 } -558 -559 /** -560 * Edit order status -561 * -562 * @param array $data status data -563 * @return ApiResponse -564 */ -565 public function statusesEdit(array $data) -566 { -567 if (!isset($data['code'])) { -568 throw new \InvalidArgumentException('Data must contain "code" parameter.'); -569 } -570 -571 return $this->client->makeRequest( -572 '/reference/statuses/' . $data['code'] . '/edit', -573 Client::METHOD_POST, -574 array( -575 'status' => json_encode($data) -576 ) -577 ); -578 } -579 -580 /** -581 * Update CRM basic statistic -582 * -583 * @return ApiResponse -584 */ -585 public function statisticUpdate() -586 { -587 return $this->client->makeRequest('/statistic/update', Client::METHOD_GET); -588 } -589 -590 /** -591 * Check ID parameter -592 * -593 * @param string $by -594 * @return bool -595 */ -596 protected function checkIdParameter($by) -597 { -598 $allowedForBy = array('externalId', 'id'); -599 if (!in_array($by, $allowedForBy)) { -600 throw new \InvalidArgumentException(sprintf( -601 'Value "%s" for parameter "by" is not valid. Allowed values are %s.', -602 $by, -603 implode(', ', $allowedForBy) -604 )); -605 } -606 -607 return true; -608 } -609 } -610 +243 /** +244 * Edit a customer +245 * +246 * @param array $customer +247 * @param string $by (default: 'externalId') +248 * @param string $site (default: null) +249 * @return ApiResponse +250 */ +251 public function customersEdit(array $customer, $by = 'externalId', $site = null) +252 { +253 if (!sizeof($customer)) { +254 throw new \InvalidArgumentException('Parameter `customer` must contains a data'); +255 } +256 +257 $this->checkIdParameter($by); +258 +259 if (!isset($customer[$by])) { +260 throw new \InvalidArgumentException(sprintf('Customer array must contain the "%s" parameter.', $by)); +261 } +262 +263 return $this->client->makeRequest( +264 "/customers/" . $customer[$by] . "/edit", +265 Client::METHOD_POST, +266 $this->fillSite($site, array( +267 'customer' => json_encode($customer), +268 'by' => $by, +269 ) +270 )); +271 } +272 +273 /** +274 * Upload array of the customers +275 * +276 * @param array $customers +277 * @param string $site (default: null) +278 * @return ApiResponse +279 */ +280 public function customersUpload(array $customers, $site = null) +281 { +282 if (!sizeof($customers)) { +283 throw new \InvalidArgumentException('Parameter `customers` must contains array of the customers'); +284 } +285 +286 return $this->client->makeRequest("/customers/upload", Client::METHOD_POST, $this->fillSite($site, array( +287 'customers' => json_encode($customers), +288 ))); +289 } +290 +291 /** +292 * Get customer by id or externalId +293 * +294 * @param string $id +295 * @param string $by (default: 'externalId') +296 * @param string $site (default: null) +297 * @return ApiResponse +298 */ +299 public function customersGet($id, $by = 'externalId', $site = null) +300 { +301 $this->checkIdParameter($by); +302 +303 return $this->client->makeRequest("/customers/$id", Client::METHOD_GET, $this->fillSite($site, array( +304 'by' => $by +305 ))); +306 } +307 +308 /** +309 * Returns filtered customers list +310 * +311 * @param array $filter (default: array()) +312 * @param int $page (default: null) +313 * @param int $limit (default: null) +314 * @return ApiResponse +315 */ +316 public function customersList(array $filter = array(), $page = null, $limit = null) +317 { +318 $parameters = array(); +319 +320 if (sizeof($filter)) { +321 $parameters['filter'] = $filter; +322 } +323 if (null !== $page) { +324 $parameters['page'] = (int) $page; +325 } +326 if (null !== $limit) { +327 $parameters['limit'] = (int) $limit; +328 } +329 +330 return $this->client->makeRequest('/customers', Client::METHOD_GET, $parameters); +331 } +332 +333 /** +334 * Save customer IDs' (id and externalId) association in the CRM +335 * +336 * @param array $ids +337 * @return ApiResponse +338 */ +339 public function customersFixExternalIds(array $ids) +340 { +341 if (!sizeof($ids)) { +342 throw new \InvalidArgumentException('Method parameter must contains at least one IDs pair'); +343 } +344 +345 return $this->client->makeRequest("/customers/fix-external-ids", Client::METHOD_POST, array( +346 'customers' => json_encode($ids), +347 )); +348 } +349 +350 /** +351 * Returns deliveryServices list +352 * +353 * @return ApiResponse +354 */ +355 public function deliveryServicesList() +356 { +357 return $this->client->makeRequest('/reference/delivery-services', Client::METHOD_GET); +358 } +359 +360 /** +361 * Returns deliveryTypes list +362 * +363 * @return ApiResponse +364 */ +365 public function deliveryTypesList() +366 { +367 return $this->client->makeRequest('/reference/delivery-types', Client::METHOD_GET); +368 } +369 +370 /** +371 * Returns orderMethods list +372 * +373 * @return ApiResponse +374 */ +375 public function orderMethodsList() +376 { +377 return $this->client->makeRequest('/reference/order-methods', Client::METHOD_GET); +378 } +379 +380 /** +381 * Returns orderTypes list +382 * +383 * @return ApiResponse +384 */ +385 public function orderTypesList() +386 { +387 return $this->client->makeRequest('/reference/order-types', Client::METHOD_GET); +388 } +389 +390 /** +391 * Returns paymentStatuses list +392 * +393 * @return ApiResponse +394 */ +395 public function paymentStatusesList() +396 { +397 return $this->client->makeRequest('/reference/payment-statuses', Client::METHOD_GET); +398 } +399 +400 /** +401 * Returns paymentTypes list +402 * +403 * @return ApiResponse +404 */ +405 public function paymentTypesList() +406 { +407 return $this->client->makeRequest('/reference/payment-types', Client::METHOD_GET); +408 } +409 +410 /** +411 * Returns productStatuses list +412 * +413 * @return ApiResponse +414 */ +415 public function productStatusesList() +416 { +417 return $this->client->makeRequest('/reference/product-statuses', Client::METHOD_GET); +418 } +419 +420 /** +421 * Returns statusGroups list +422 * +423 * @return ApiResponse +424 */ +425 public function statusGroupsList() +426 { +427 return $this->client->makeRequest('/reference/status-groups', Client::METHOD_GET); +428 } +429 +430 /** +431 * Returns statuses list +432 * +433 * @return ApiResponse +434 */ +435 public function statusesList() +436 { +437 return $this->client->makeRequest('/reference/statuses', Client::METHOD_GET); +438 } +439 +440 /** +441 * Returns sites list +442 * +443 * @return ApiResponse +444 */ +445 public function sitesList() +446 { +447 return $this->client->makeRequest('/reference/sites', Client::METHOD_GET); +448 } +449 +450 /** +451 * Edit deliveryService +452 * +453 * @param array $data delivery service data +454 * @return ApiResponse +455 */ +456 public function deliveryServicesEdit(array $data) +457 { +458 if (!isset($data['code'])) { +459 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +460 } +461 +462 return $this->client->makeRequest( +463 '/reference/delivery-services/' . $data['code'] . '/edit', +464 Client::METHOD_POST, +465 array( +466 'deliveryService' => json_encode($data) +467 ) +468 ); +469 } +470 +471 /** +472 * Edit deliveryType +473 * +474 * @param array $data delivery type data +475 * @return ApiResponse +476 */ +477 public function deliveryTypesEdit(array $data) +478 { +479 if (!isset($data['code'])) { +480 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +481 } +482 +483 return $this->client->makeRequest( +484 '/reference/delivery-types/' . $data['code'] . '/edit', +485 Client::METHOD_POST, +486 array( +487 'deliveryType' => json_encode($data) +488 ) +489 ); +490 } +491 +492 /** +493 * Edit orderMethod +494 * +495 * @param array $data order method data +496 * @return ApiResponse +497 */ +498 public function orderMethodsEdit(array $data) +499 { +500 if (!isset($data['code'])) { +501 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +502 } +503 +504 return $this->client->makeRequest( +505 '/reference/order-methods/' . $data['code'] . '/edit', +506 Client::METHOD_POST, +507 array( +508 'orderMethod' => json_encode($data) +509 ) +510 ); +511 } +512 +513 /** +514 * Edit orderType +515 * +516 * @param array $data order type data +517 * @return ApiResponse +518 */ +519 public function orderTypesEdit(array $data) +520 { +521 if (!isset($data['code'])) { +522 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +523 } +524 +525 return $this->client->makeRequest( +526 '/reference/order-types/' . $data['code'] . '/edit', +527 Client::METHOD_POST, +528 array( +529 'orderType' => json_encode($data) +530 ) +531 ); +532 } +533 +534 /** +535 * Edit paymentStatus +536 * +537 * @param array $data payment status data +538 * @return ApiResponse +539 */ +540 public function paymentStatusesEdit(array $data) +541 { +542 if (!isset($data['code'])) { +543 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +544 } +545 +546 return $this->client->makeRequest( +547 '/reference/payment-statuses/' . $data['code'] . '/edit', +548 Client::METHOD_POST, +549 array( +550 'paymentStatus' => json_encode($data) +551 ) +552 ); +553 } +554 +555 /** +556 * Edit paymentType +557 * +558 * @param array $data payment type data +559 * @return ApiResponse +560 */ +561 public function paymentTypesEdit(array $data) +562 { +563 if (!isset($data['code'])) { +564 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +565 } +566 +567 return $this->client->makeRequest( +568 '/reference/payment-types/' . $data['code'] . '/edit', +569 Client::METHOD_POST, +570 array( +571 'paymentType' => json_encode($data) +572 ) +573 ); +574 } +575 +576 /** +577 * Edit productStatus +578 * +579 * @param array $data product status data +580 * @return ApiResponse +581 */ +582 public function productStatusesEdit(array $data) +583 { +584 if (!isset($data['code'])) { +585 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +586 } +587 +588 return $this->client->makeRequest( +589 '/reference/product-statuses/' . $data['code'] . '/edit', +590 Client::METHOD_POST, +591 array( +592 'productStatus' => json_encode($data) +593 ) +594 ); +595 } +596 +597 /** +598 * Edit order status +599 * +600 * @param array $data status data +601 * @return ApiResponse +602 */ +603 public function statusesEdit(array $data) +604 { +605 if (!isset($data['code'])) { +606 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +607 } +608 +609 return $this->client->makeRequest( +610 '/reference/statuses/' . $data['code'] . '/edit', +611 Client::METHOD_POST, +612 array( +613 'status' => json_encode($data) +614 ) +615 ); +616 } +617 +618 /** +619 * Edit site +620 * +621 * @param array $data site data +622 * @return ApiResponse +623 */ +624 public function sitesEdit(array $data) +625 { +626 if (!isset($data['code'])) { +627 throw new \InvalidArgumentException('Data must contain "code" parameter.'); +628 } +629 +630 return $this->client->makeRequest( +631 '/reference/sites/' . $data['code'] . '/edit', +632 Client::METHOD_POST, +633 array( +634 'site' => json_encode($data) +635 ) +636 ); +637 } +638 +639 /** +640 * Update CRM basic statistic +641 * +642 * @return ApiResponse +643 */ +644 public function statisticUpdate() +645 { +646 return $this->client->makeRequest('/statistic/update', Client::METHOD_GET); +647 } +648 +649 /** +650 * Return current site +651 * +652 * @return string +653 */ +654 public function getSite() +655 { +656 return $this->siteCode; +657 } +658 +659 /** +660 * Set site +661 * +662 * @param string $site +663 * @return void +664 */ +665 public function setSite($site) +666 { +667 $this->siteCode = $site; +668 } +669 +670 /** +671 * Check ID parameter +672 * +673 * @param string $by +674 * @return bool +675 */ +676 protected function checkIdParameter($by) +677 { +678 $allowedForBy = array('externalId', 'id'); +679 if (!in_array($by, $allowedForBy)) { +680 throw new \InvalidArgumentException(sprintf( +681 'Value "%s" for parameter "by" is not valid. Allowed values are %s.', +682 $by, +683 implode(', ', $allowedForBy) +684 )); +685 } +686 +687 return true; +688 } +689 +690 /** +691 * Fill params by site value +692 * +693 * @param string $site +694 * @param array $params +695 * @return array +696 */ +697 protected function fillSite($site, array $params) +698 { +699 if ($site) { +700 $params['site'] = $site; +701 } elseif ($this->siteCode) { +702 $params['site'] = $this->siteCode; +703 } +704 +705 return $params; +706 } +707 } +708
- + diff --git a/source-class-RetailCrm.Exception.CurlException.html b/source-class-RetailCrm.Exception.CurlException.html index 2609383..116ddd7 100644 --- a/source-class-RetailCrm.Exception.CurlException.html +++ b/source-class-RetailCrm.Exception.CurlException.html @@ -112,6 +112,6 @@
- + diff --git a/source-class-RetailCrm.Exception.InvalidJsonException.html b/source-class-RetailCrm.Exception.InvalidJsonException.html index bdca89b..12e4701 100644 --- a/source-class-RetailCrm.Exception.InvalidJsonException.html +++ b/source-class-RetailCrm.Exception.InvalidJsonException.html @@ -112,6 +112,6 @@
- + diff --git a/source-class-RetailCrm.Http.Client.html b/source-class-RetailCrm.Http.Client.html index 6d55d28..990808d 100644 --- a/source-class-RetailCrm.Http.Client.html +++ b/source-class-RetailCrm.Http.Client.html @@ -186,6 +186,6 @@
- + diff --git a/source-class-RetailCrm.Response.ApiResponse.html b/source-class-RetailCrm.Response.ApiResponse.html index 1e00010..de78d35 100644 --- a/source-class-RetailCrm.Response.ApiResponse.html +++ b/source-class-RetailCrm.Response.ApiResponse.html @@ -231,6 +231,6 @@
- + diff --git a/todo.html b/todo.html index 7b8d857..612fb2f 100644 --- a/todo.html +++ b/todo.html @@ -118,6 +118,6 @@
- + diff --git a/tree.html b/tree.html index eb748db..b231101 100644 --- a/tree.html +++ b/tree.html @@ -186,6 +186,6 @@
- +