Class: FriendlyShipping::Services::UpsFreight::GenerateLocationHash

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups_freight/generate_location_hash.rb

Class Method Summary collapse

Class Method Details

.call(location:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/friendly_shipping/services/ups_freight/generate_location_hash.rb', line 8

def call(location:)
  {
    Name: location.company_name.presence || location.name,
    Address: {
      AddressLine: address_line(location),
      City: location.city,
      StateProvinceCode: location.region&.code,
      PostalCode: location.zip,
      CountryCode: location.country&.code
    },
    AttentionName: location.name,
    Phone: {
      Number: location.phone
    }.compact.presence
  }.compact
end