Skip to content

Commit 3fb054b

Browse files
committed
count() method to use get() method.
1 parent 8132ee3 commit 3fb054b

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

lib/ShopifyAPI.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,15 @@ public function generateUrl($urlParams = array(), $customAction = null)
308308
*
309309
* @return array
310310
*/
311-
public function get($urlParams = array(), $url = null)
311+
public function get($urlParams = array(), $url = null, $dataKey = null)
312312
{
313-
314313
if (!$url) $url = $this->generateUrl($urlParams);
315314

316315
$this->prepareRequest();
317316

318317
$response = CurlRequest::get($url, $this->httpHeaders);
319318

320-
$dataKey = $this->id ? $this->resourceKey : $this->pluralizeKey();
319+
if (!$dataKey) $dataKey = $this->id ? $this->resourceKey : $this->pluralizeKey();
321320

322321
return $this->processResponse($response, $dataKey);
323322

@@ -327,22 +326,14 @@ public function get($urlParams = array(), $url = null)
327326
* Get count for the number of resources available
328327
*
329328
* @param array $urlParams Check Shopify API reference of the specific resource for the list of URL parameters
330-
* @param string $url
331-
*
332-
* @uses CurlRequest::get() to send the HTTP request
333329
*
334330
* @return integer
335331
*/
336-
public function count($urlParams = array(), $url = null)
332+
public function count($urlParams = array())
337333
{
334+
$url = $this->generateUrl($urlParams, 'count');
338335

339-
if (!$url) $url = $this->generateUrl($urlParams, 'count');
340-
341-
$this->prepareRequest();
342-
343-
$response = CurlRequest::get($url, $this->httpHeaders);
344-
345-
return $this->processResponse($response, 'count');
336+
return $this->get(array(), $url, 'count');
346337
}
347338

348339
/**

0 commit comments

Comments
 (0)