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