Skip to content

Conversation

@kevdotpub
Copy link
Contributor

Hi again!

I've a need to be able to buy cards in multiple currencies and regions in the same app so I've added a couple of changes to make this easier. Again, I don't know if you're interested in these changes but here they are if you do :)

Firstly, the API has different endpoints for different regions which only service certain currencies. I've altered AGCOD.config.uri to return the correct URI given the currently set region and whether it's in production mode. This can, of course, still be overriden with a custom URI

Secondly, I've changed the way the AGCOD.configure config works slightly. Previously it would always create a new AGCOD::Config object, initialised with the defaults, which meant in order to change one value (like the region for instance) you'd have to re-set everything again including secret keys and so on. I've changed it so that it will use an existing configuration for attributes you don't change.

It's worth mentioning that there's a tiny edge case where this could break an existing app if it was relying on AGCOD.configure to change the production, region or timeout values back to their defaults from a previously set value. It would be a bit of a weird way to do it but I thought it worth mentioning!

While I'm here, thanks for this gem by the way, which saved me from doing a lot of irritating work 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant