shiphawk v0.1.0 Shiphawk.Rates View Source

Reponsible to handle the Rates logic and endpoints.

Link to this section Summary

Functions

get/2 is the function responsible for getting rates for specific set of line items and addresses

Link to this section Functions

get/2 is the function responsible for getting rates for specific set of line items and addresses.

Parameters

  • items: List of items that are being shipped.
  • from: Map with the address where it’s being shipped from.
  • to: Map with the address where it’s being shipped to.

Example

  items = [%{
    package_type: "box",
    item_type: "handling_unit",
    handling_unit_type: "pallet", # Must be "pallet", "carton", "box", "crate", or "bag"
    length: "10",
    width: "10",
    height: "11",
    weight: "10",
    value: 100.00
  }]

  from = %{ "zip" => "93101"}
  to = %{ "zip" => "60060"}

  Shiphawk.Rates.get(items, from, to)