Open tadiou opened 4 years ago
Thanks @tadiou,
Feel free to open a pull request! I can't promise it's something we'll merge in, but we'd definitely like to make some improvements along those lines. At the very least it'd be great to see how you'd go about things.
I need to give this some more thought, but what do you think of something like:
dwolla = DwollaV2::Client.new(params)
customer = dwolla.get(customer_url)
funding_sources = dwolla.get(customer, :funding_sources, limit: 2)
One thing I've been thinking about is how there should be an easier way to access the responses of
links
.Example
So, granted I understand the HAL schema y'all are working off of, the fundamental basis of the schema will remain the same, but ideally my end goal would be to go
to accomplish roughly the same thing, where
.links
dynamcially dispatches the link information to methods to then re-call the client.So, codewise, I'd imagine that the https://github.com/Dwolla/dwolla-v2-ruby/blob/main/lib/dwolla_v2/response.rb would contain a method that would look directly into the response maps, pull out the direct child
_links
and_embedded
links object and create new methods based on that. The only caveat that would be tricky to work through is carrying over the same client request for both, which I think given the way token works, by adding the token to the initializer of theResponse
, we should (:crossed_fingers:) be able to easily pass over the request structure to the links by goingGranted I haven't tested this, but just thought it up over lunch, but if this is something amenable, I'd be happy to fork and set up a PR.