Shippex.Address.new

You're seeing just the function new, go back to Shippex.Address module for more information.

Specs

new(map()) :: {:ok, t()} | {:error, String.t()}

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.new(%{
  first_name: "Earl",
  last_name: "Grey",
  phone: "123-123-1234",
  address: "9999 Hobby Lane",
  address_line_2: nil,
  city: "Austin",
  state: "TX",
  postal_code: "78703"
})