Skip to content

Commit fc128e7

Browse files
committed
Revert "Fix: some inventory level actions body should not be wrapped"
This reverts commit ec927f5.
1 parent 70eeeb2 commit fc128e7

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

lib/HttpRequestJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,4 @@ protected static function processResponse($response)
139139
return json_decode($response, true);
140140
}
141141

142-
}
142+
}

lib/InventoryLevel.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,4 @@ class InventoryLevel extends ShopifyResource
2626
'connect',
2727
'set',
2828
];
29-
30-
protected $customPostActionsNoWrap = [
31-
'adjust',
32-
'connect',
33-
'set',
34-
];
3529
}

lib/ShopifyResource.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,6 @@ abstract class ShopifyResource
9696
protected $customPutActions = array();
9797
protected $customDeleteActions = array();
9898

99-
/**
100-
* Some actions from inventory levels do not wrap the content of the request
101-
*
102-
* Wrapping such request body leads to errors. This list is used to disable this wrapping
103-
* on certain methods.
104-
*
105-
* @var array
106-
*/
107-
protected $customPostActionsNoWrap = array();
108-
10999
/**
110100
* The ID of the resource
111101
*
@@ -235,7 +225,7 @@ public function __call($name, $arguments)
235225

236226
$url = $this->generateUrl($urlParams, $customAction);
237227

238-
return $this->$httpMethod($dataArray, $url, !in_array($name, $this->customPostActionsNoWrap));
228+
return $this->$httpMethod($dataArray, $url);
239229
}
240230
}
241231

@@ -365,22 +355,18 @@ public function search($query)
365355
/**
366356
* Call POST method to create a new resource
367357
*
368-
* @param array $dataArray Check Shopify API reference of the specific resource for the list of required and optional data elements to be provided
358+
* @param array $dataArray Check Shopify API reference of the specific resource for the list of required and optional data elements to be provided
369359
* @param string $url
370360
*
371-
* @param bool $wrapBody
372-
*
373-
* @return array
374-
* @throws ApiException
375-
* @throws CurlException
376361
* @uses HttpRequestJson::post() to send the HTTP request
377362
*
363+
* @return array
378364
*/
379-
public function post($dataArray, $url = null, $wrapBody = true)
365+
public function post($dataArray, $url = null)
380366
{
381367
if (!$url) $url = $this->generateUrl();
382368

383-
if ($wrapBody && !empty($dataArray)) $dataArray = $this->wrapData($dataArray);
369+
if (!empty($dataArray)) $dataArray = $this->wrapData($dataArray);
384370

385371
$response = HttpRequestJson::post($url, $dataArray, $this->httpHeaders);
386372

0 commit comments

Comments
 (0)