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

getId() method on Recurly_Stub #405

Closed
beberlei opened this issue Mar 27, 2019 · 3 comments
Closed

getId() method on Recurly_Stub #405

beberlei opened this issue Mar 27, 2019 · 3 comments
Labels
V2 V2 Client

Comments

@beberlei
Copy link

we have a repeated pattern in our code where given an invoice, transaction or subscription, we want the account id, but without having to fetch the stub and make one additional HTTP request.

This is possible by doing:

$parts = explode("/", $subscription->account->getHref());
$accountId = array_pop($parts);

This obviously assumes that the URLs stay the same and the ID is always at the end. Would it be possible to provide a getId() method in the Recurly_Stub instead that handles this logic in a more robust way?

@drewish
Copy link

drewish commented Mar 27, 2019

For the other maintainers I wanted to note that this isn't the first time this has come up: #95

@aaron-junot
Copy link

@beberlei Please see my comment here #95 (comment)

If you have any ideas about how to tackle the edge cases, I'm open to suggestions.

@aaron-junot
Copy link

Closing this out since there are no plausible ways to tackle the edge cases. If anyone has a suggestion on how to make this work for both of the following tags (and all the other edge cases mentioned here), please open a Pull Request and we'll be happy to review and merge:

<redemptions href="https://your-subdomain.recurly.com/v2/invoices/1007/redemptions"/>
<account href="https://your-subdomain.recurly.com/v2/accounts/1">

@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

4 participants