shippex v0.6.8 Shippex.Address

Represents an address that can be passed to other Shippex functions. Do not initialize this struct directly. Instead, use address/1.

Link to this section Summary

Functions

Initializes an Address struct from the given params, and performs minor validations that do not require any service requests

Returns the list of non-nil address lines. If no address_line_2 is present, it returns a list of a single String

Link to this section Types

Link to this type t()
t() :: %Shippex.Address{address: term, address_line_2: term, city: term, company_name: term, country: term, first_name: term, last_name: term, name: term, phone: term, state: term, zip: term}

Link to this section Functions

Link to this function address(params)
address(map) :: t | none

Initializes an Address struct from the given params, and performs minor validations that do not require any service requests.

You may specify first_name and last_name separately, which will be concatenated to make the name property, or just specify name directly.

If name is specified directly, Shippex will try to infer the first and last names in case they’re required separately for API calls.

Shippex.Address.address(%{
  first_name: "Earl",
  last_name: "Grey",
  phone: "123-123-1234",
  address: "9999 Hobby Lane",
  address_line_2: nil,
  city: "Austin",
  state: "TX",
  zip: "78703"
})
Link to this function address_line_list(address)
address_line_list(t) :: [String.t]

Returns the list of non-nil address lines. If no address_line_2 is present, it returns a list of a single String.