Shippex.Package (shippex v0.17.0) View Source
Defines the struct for storing a Package
, which is then passed along with
an origin and destination address for shipping estimates. A description
is
optional, as it may or may not be used with various carriers.
For USPS, a package has a container
string which can be one of the
pre-defined USPS containers.
Do not pass a weight
parameter. Instead, pass in a list of :items
with a
weight parameter on each of these. The weight on the package will be the sum
of the weights of each of these. Same for :monetary_value
.
:description
can optionally be passed in. Otherwise, it will be generated
by joining the descriptions of each of the items.
Shippex.Package.package(%{length: 8
width: 8,
height: 8,
items: [
%{weight: 1, monetary_value: 100, description: "A"},
%{weight: 2, monetary_value: 200, description: "B"}
]})
# => %Package{weight: 3, monetary_value: 300, description: "A, B", ...}
Link to this section Summary
Functions
Builds and returns a Package
. Use this instead of directly initializing
the struct.
Returns a map of predefined containers for use with USPS. These can be
passed to package.container
for fetching rates.
Returns a map of flat rate USPS containers, along with their string description and flat shipping rate (in cents).
Link to this section Types
Specs
Link to this section Functions
Specs
Builds and returns a Package
. Use this instead of directly initializing
the struct.
Specs
Returns a map of predefined containers for use with USPS. These can be
passed to package.container
for fetching rates.
Specs
usps_flat_rate_containers() :: %{required(atom()) => flat_rate_container()}
Returns a map of flat rate USPS containers, along with their string description and flat shipping rate (in cents).