recurly/recurly-client-php — pull request #95 by deviantintegral (2014-06-30 20:16:20+00:00)
Title: Add a method to return an ID from an href.

This PR adds a method to return an ID of an object without having to get() it from the Recurly API - particularly useful for stubs. For example, given an invoice UUID, to find the ID of an account you have to get() on the account stub, which can add quite a bit of lag to any requests. When all you want is the account code, it's a bit of overkill.

Now, this method works for me, but will certainly need some improvement. I went with the most non-invasive change, just to unblock my own work, but I have ideas for other, better approaches.

1. Push the method down to Recurly_Stub, since if you've loaded an object you can directly access the id and you shouldn't need this method.
1. Make the method abstract (since we don't have an interface) and require classes to implement it.
1. Change every Recurly object to store the unique ID as a property, and assign it when constructing or getting.
1. Decide that this isn't the library's problem at all, and make href the canonical identifier. However... I noticed that sometimes _href doesn't have my account's subdomain and is just api.recurly.com, so I don't know if this would cause problems.

Anyways, I figured I'd throw this out there before I did much more.