shippex v0.6.15 Shippex.Package

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.

The monetary_value might be required depending on the origin/destination countries of the shipment. Both monetary_value and insurance are integers stored in USD cents.

For USPS, a package has a container string which can be one of the pre-defined USPS containers.

Shippex.Package.package(%{length: 8
                          width: 8,
                          height: 8,
                          weight: 5.5,
                          monetary_value: 100_00})

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

Link to this type t()
t() :: %Shippex.Package{
  container: nil | String.t(),
  description: nil | String.t(),
  girth: nil | number(),
  height: number(),
  insurance: nil | integer(),
  length: number(),
  monetary_value: nil | integer(),
  weight: number(),
  width: number()
}

Link to this section Functions

Link to this function new(attrs)
new(map()) :: t()

Builds and returns a Package. Use this instead of directly initializing the struct.

Link to this function usps_containers()
usps_containers() :: %{optional(atom()) => String.t()}

Returns a map of predefined containers for use with USPS. These can be passed to package.container for fetching rates.

Link to this function usps_flat_rate_containers()
usps_flat_rate_containers() :: %{optional(atom()) => flat_rate_container()}

Returns a map of flat rate USPS containers, along with their string description and flat shipping rate (in cents).