Fix money parsing
Package.cents_from is a problem.
https://github.com/Shopify/active_shipping/blob/e76c8c7314f7fbc6a3f7e66fa076624498c8bf39/lib/active_shipping/package.rb#L117-L131
It makes a bunch of guesses of how it thinks money is being represented, then parses with switch cases and some weird defaults. Plus assumes anything that responds to cents is money.
We could make each Carrier implement its own money parser, based on the types coming back for a given provider. Or something cleaner. Plus it shouldn't really be in the Package class anyway.
See #457 #455 for examples.
I started working on this the other day. It's a big refactor, made a little harder by the fact that the expected money format of each Carrier is not codified anywhere in this library. We will have to check the docs for each API to make sure we get it right.
Pulling in something like RubyMoney would be overkill, but an ActiveShipping::Money class would save us from some money arithmetic pitfalls in the future. Here's what it could look like:
https://gist.github.com/dustMason/433437f0746ba54a07f84f2f8d1dc76a
Then, as mentioned above, each Carrier class would create instances of ActiveShipping::Money as needed, taking care to parse values in API responses as amounts in dollars, cents or whatever.