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

Can't get Coupon list using Recurly_CouponList #305

Closed
NotAmaan opened this issue Feb 17, 2017 · 2 comments
Closed

Can't get Coupon list using Recurly_CouponList #305

NotAmaan opened this issue Feb 17, 2017 · 2 comments
Assignees
Labels
V2 V2 Client

Comments

@NotAmaan
Copy link

Hi,

I'm able to get the coupon list in XML using Recurly_Client::request('GET', '/coupons')
But when I use Recurly_CouponList::get(), this is what I get:

Recurly_CouponList Object
(
    [_position:Recurly_Pager:private] => 0
    [_count:protected] => 
    [_objects:protected] => 
    [_href:protected] => /coupons
    [_type:protected] => 
    [_client:protected] => Recurly_Client Object
        (
            [_apiKey:Recurly_Client:private] => 
            [_acceptLanguage:Recurly_Client:private] => en-US
        )

    [_links:protected] => Array
        (
        )

)

I don't get the coupon list in the second case. What could I be doing wrong?

@bhelx bhelx self-assigned this Feb 17, 2017
@bhelx
Copy link
Contributor

bhelx commented Feb 17, 2017

@NotAmaan I think what you are looking at is a Pager. Did you try this?

$coupons = Recurly_CouponList::get();
foreach ($coupons as $coupon) {
  print "Coupon: $coupon\n";
}

@NotAmaan
Copy link
Author

@bhelx Thanks, that worked. I was trying to print $coupons which I assumed would have been the dump of all data but it wasn't. Works if I loop through $coupons though and print $coupon then.

@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
V2 V2 Client
Projects
None yet
Development

No branches or pull requests

2 participants