Thursday, March 19, 2015

minFraud Ruby gem

So I'm working on this new project that connects to the minFraud service, and there isn't a whole lot out there Ruby-wise for working with the API. The one gem that I did find is called minfraud-ruby. However, this gem seemed very limited. The minFraud service itself only requires you to send it an IP address, and a license key, but the gem also required city, state, zip and country. When you're working with IP addresses from countries outside of the US, some or all of these attributes will not be available. The gem also only returned a risk score. While the risk score is useful, there's much more useful data returned in the response from minFraud, such as ip_city, ip_region (which in the US is the state), ip_country_name, etc.
After working with the limitations for a while, I decided to fork the gem and give it a bit of an overhaul. I updated the required fields, so that now all you need is a license key and an IP address to get a response. Providing additional information will get you a more accurate response from the service, but this is not required. I also exposed a number of additional attributes in the transaction object, so you can retrieve things like city, state and country without any additional steps.

Happy coding, kids. Until next time..