Class: FriendlyShipping::Services::ShipEngine::SerializeAddressValidationRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ship_engine/serialize_address_validation_request.rb

Class Method Summary collapse

Class Method Details

.call(location:) ⇒ Array<Hash>

Parameters:

  • location (Physical::Location)

Returns:

  • (Array<Hash>)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/friendly_shipping/services/ship_engine/serialize_address_validation_request.rb', line 10

def call(location:)
  [
    {
      name: location.name,
      phone: location.phone,
      email: location.email,
      company_name: location.company_name,
      address_line1: location.address1,
      address_line2: location.address2,
      address_line3: location.address3,
      city_locality: location.city,
      state_province: location.region&.code,
      postal_code: location.zip,
      country_code: location.country&.code
    }.merge(SerializeAddressResidentialIndicator.call(location))
  ]
end