Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new pagination #249

Merged
merged 3 commits into from
Aug 1, 2016
Merged

Add support for new pagination #249

merged 3 commits into from
Aug 1, 2016

Conversation

drewish
Copy link

@drewish drewish commented Jul 6, 2016

Here's the testing code I was using to check this out

function fetchIt($list) {
  $initialCount = $list->count();
  print "\thas {$initialCount} rows\n";
  // print "links:\n"; var_dump($list->getLinks());
  // print "href:\n"; var_dump($list->getHref());
  $first = $list->current()->getHref();
  print "\tfirst is {$first}\n";

  $count = 0;
  foreach ($list as $item) {
    ++$count;
  }
  assert($initialCount == $count);

  $list->rewind();

  print "\tfirst is {$list->current()->getHref()}\n\n";
  assert($first == $list->current()->getHref());
}

$accountCode = 'd4a354bb326f3b7386ad351d7c0750';
$planCode = 'perferendis_in8';

$options = array('per_page' => 200, 'sort' => 'updated_at', 'order' => 'asc', 'begin_time' => '2016-01-01');

fetchIt(Recurly_AccountList::get($options));

fetchIt(Recurly_AdjustmentList::get($accountCode, $options));

fetchIt(Recurly_CouponList::get($options));

fetchIt(Recurly_InvoiceList::get($options));
fetchIt(Recurly_InvoiceList::getForAccount($accountCode, $options));

fetchIt(Recurly_NoteList::get($accountCode));//, $options));

fetchIt(Recurly_PlanList::get($options));

fetchIt(Recurly_AddonList::get($planCode, $options));

fetchIt(Recurly_CouponRedemptionList::getForAccount($accountCode, $options));
fetchIt(Recurly_CouponRedemptionList::getForInvoice('10343', $options));
fetchIt(Recurly_CouponRedemptionList::getForSubscription('2d0c6ac7430b27b0780dd34a03b1607d', $options));

fetchIt(Recurly_SubscriptionList::get($options));
fetchIt(Recurly_SubscriptionList::getForAccount($accountCode, $options));

fetchIt(Recurly_TransactionList::get($options));
fetchIt(Recurly_TransactionList::getForAccount($accountCode, $options));

fetchIt(Recurly_UniqueCouponCodeList::get('for_subs', $options));

$this->_loadRecordCount($response);
$this->_loadLinks($response);
$this->_href = isset($this->_links['start']) ? $this->_links['start'] : $uri;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a bug where we were rewinding to the second page rather than the first.

@drewish drewish force-pushed the new-pagination branch 3 times, most recently from ca87899 to 95da354 Compare July 7, 2016 21:47
@@ -4,7 +4,12 @@

* Added support for `original_transaction` to `Recurly_Transaction` [#238](https://github.com/recurly/recurly-client-php/pull/238)
* Added `Recurly_AccountBalance` [#239](https://github.com/recurly/recurly-client-php/pull/239)
* Print warnings when using a deprecated version of the API.
* Print warnings when using a deprecated version of the API. [#250](https://github.com/recurly/recurly-client-php/pull/250):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized this one didn't have a PR links so I just stuck it in here while rebasing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Good enough

@bobalbert
Copy link

Any status on when this will be merged into master?

@bhelx
Copy link
Contributor

bhelx commented Aug 1, 2016

@bobalbert I will be finishing review today

@drewish
Copy link
Author

drewish commented Aug 1, 2016

@bobalbert but it'll probably be a couple days before the api-2.3 branch is merged. there's at least one more PR we need to add.

@bobalbert
Copy link

@drewish thanks for the info. I'll manually merge over this one item into my version development version. I'll look for the full merge later this week hopefully.

@bhelx
Copy link
Contributor

bhelx commented Aug 1, 2016

👍

@bhelx bhelx merged commit 9453fe9 into api-2.3 Aug 1, 2016
@bhelx bhelx deleted the new-pagination branch August 1, 2016 20:50
@drewish drewish mentioned this pull request Aug 1, 2016
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants