Sha256: f1d299ea598b4f02e069a7d6ea96a7dbe188b65069f231833bfb9eabd599ae29
Contents?: true
Size: 1.14 KB
Versions: 7
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class UpsFreight class GenerateLocationHash class << self 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 def address_line(location) [ location.address1, location.address2, location.address3 ].compact. reject(&:empty?). join(", ") end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems