Balanced::Account#debit accepts "on_behalf_of" as a option, but Balanced::Card#debit does not. It can be added simply by ignoring positionals (or make it arg[4]) and grabbing from options:
And then pass it in on the self.account.debit call below.
As an aside, it would also be useful to clean up the parameters to "debit" as well as the documentation. In the docs, we have "account_uri", "on_behalf_of_uri", "hold_uri", "source_uri", etc. In the code, "on_behalf_of_uri" doesn't exist - it's just "on_behalf_of".
A good change would be to allow either form in Balanced::Account and Balanced::Card, e.g. "on_behalf_of" and "on_behalf_of_uri" and then properly use whichever is passed in, pulling the uri if it's the non-uri style. The code in Balanced::Account already does that, but it's a bit clunky and undocumented. If it has a "uri" method, then that is used. If it's a string, it's assumed to be a uri. The same could easily be done for all of the *_uri methods.
Balanced::Account#debit accepts "on_behalf_of" as a option, but Balanced::Card#debit does not. It can be added simply by ignoring positionals (or make it arg[4]) and grabbing from options:
on_behalf_of = options.fetch(:on_behalf_of) { nil }
And then pass it in on the self.account.debit call below.
As an aside, it would also be useful to clean up the parameters to "debit" as well as the documentation. In the docs, we have "account_uri", "on_behalf_of_uri", "hold_uri", "source_uri", etc. In the code, "on_behalf_of_uri" doesn't exist - it's just "on_behalf_of".
A good change would be to allow either form in Balanced::Account and Balanced::Card, e.g. "on_behalf_of" and "on_behalf_of_uri" and then properly use whichever is passed in, pulling the uri if it's the non-uri style. The code in Balanced::Account already does that, but it's a bit clunky and undocumented. If it has a "uri" method, then that is used. If it's a string, it's assumed to be a uri. The same could easily be done for all of the *_uri methods.