Sha256: f6806aac4ed0a9144f0603d6a4edd3aa91adcba3121842a847d1db458af2f13f
Contents?: true
Size: 1.74 KB
Versions: 4
Compression:
Stored size: 1.74 KB
Contents
# frozen_string_literal: true module FriendlyShipping module Services class Ups class SerializeAddressSnippet class << self def call(xml:, location:) if location.company_name # Is this a business address? name = location.company_name[0..34] attention_name = location.name else name = location.name attention_name = nil end # UPS wants a different main Name tag when it's the shipper if xml.parent.name == "Shipper" xml.Name(name) else xml.CompanyName(name) end if attention_name xml.AttentionName(attention_name) end xml.PhoneNumber(location.phone) if location.phone xml.Address do xml.AddressLine1(location.address1) if location.address1 xml.AddressLine2(location.address2) if location.address2 xml.City(location.city) if location.city xml.PostalCode(location.zip) if location.zip # StateProvinceCode required for negotiated rates but not otherwise, for some reason xml.StateProvinceCode(location.region.code) if location.region xml.CountryCode(location.country.code) if location.country # Quote residential rates by default. If UPS doesn't know if the address is residential or # commercial, it will quote a residential rate by default. Even with this flag being set, # if UPS knows the address is commercial it will quote a commercial rate. # xml.ResidentialAddressIndicator end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems