shippex v0.2.0 Shippex.Address

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

Summary

Functions

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

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

Types

t()
t() :: %Shippex.Address{address: term, address_line_2: term, city: term, name: term, phone: term, state: term, zip: term}

Functions

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.

to_struct(params)
to_struct(map) :: t

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

Shippex.Address.to_struct(%{
  name: "Earl G",
  phone: "123-123-1234",
  address: "9999 Hobby Lane",
  address_line_2: nil,
  city: "Austin",
  state: "TX",
  zip: "78703"
})