class FriendlyShipping::Services::UpsFreight::GenerateLocationHash
Public Class Methods
call(location:)
click to toggle source
# File lib/friendly_shipping/services/ups_freight/generate_location_hash.rb, line 8 def call(location:) # We ship freight here, which will mostly be used for businesses. # If a personal name is given, treat is as the contact person ("AttentionName") { Name: location.company_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
Private Class Methods
address_line(location)
click to toggle source
# File lib/friendly_shipping/services/ups_freight/generate_location_hash.rb, line 29 def address_line(location) [ location.address1, location.address2, location.address3 ].compact. reject(&:empty?). join(", ") end