Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

Refactor and remove the weight/measurement methods with params on Package and PackageItem #466

Open
kmcphillips opened this issue Jan 12, 2017 · 3 comments

Comments

@kmcphillips
Copy link
Member

Both the Package and PackageItem classes have methods to return weight and dimensions in all kinds of units. Moreover, those methods accept options hashes and parameters to modify the return values of those methods.

The latter is bad practice. But now with using measured we can actually remove all of those methods I believe. Replace them with simply weight and other methods for volumetric and dimensional calculations. Then have them return measured objects which understand how to convert to different units by themselves.

Should make the files much much much simpler, and easier to work with.

@jonathankwok
Copy link
Contributor

Volumetric/Dimensional weight can't be calculated generically - it depends on the carrier's (and possibly their service's) density factor constant.

USPS has a constant 6000g/cm3

Canada Post has it different by service: 6000 for Expedited/Regular Parcel and 5000 for everything else

These functions are generally useless (I know we don't use it at all, instead opting to manually calculate it external to ActiveShipping), and potentially misleading. I'll start by removing them and re-implement them in a carrier-specific context.

Semi-related: the money parsing per carrier issue. I think solving this will provide a solution for this as well.

@kmcphillips
Copy link
Member Author

I'm really good with pushing these into the carrier implementations, and maybe having a default globally if it makes sense.

@garethson
Copy link
Contributor

I'm going to remove this item from the 2.0 milestone, for now.

@garethson garethson removed this from the Version 2.0 milestone May 26, 2017
@jonathankwok jonathankwok removed their assignment Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants