Skip to content

Commit ca11941

Browse files
author
Aman Alam
authored
Merge pull request #25 from PaymentRails/fix-missing-fields
Fix: missing fields in response
2 parents 9ea196f + cc4418b commit ca11941

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/PaymentRails/ResourceCollection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ class ResourceCollection implements Iterator
4040
*/
4141
public function __construct($response, $items, $pager)
4242
{
43-
$this->_page = $response["meta"]["page"];
43+
// Add "meta" fields only when they exist in JSON response
44+
$this->_page = isset($response["meta"]) ? $response["meta"]["page"] : null;
4445
$this->_items = $items;
45-
$this->_records = $response["meta"]["records"];
46+
$this->_records = isset($response["meta"]) ? $response["meta"]["records"] : null;
4647
$this->_pager = $pager;
4748
$this->_index = 0;
4849
if (isset($response["meta"]["pages"])) {

lib/PaymentRails/Version.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Version
1111
* class constants
1212
*/
1313
const MAJOR = 2;
14-
const MINOR = 2;
15-
const TINY = 0;
14+
const MINOR = 1;
15+
const TINY = 4;
1616

1717
/**
1818
* @ignore

0 commit comments

Comments
 (0)