Class: FriendlyShipping::Services::Ups::SerializeCityStateLookupRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups/serialize_city_state_lookup_request.rb

Constant Summary collapse

REQUEST_ACTION =
'AV'

Class Method Summary collapse

Class Method Details

.call(location:) ⇒ Object



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

def self.call(location:)
  xml_builder = Nokogiri::XML::Builder.new do |xml|
    xml.AddressValidationRequest do
      xml.Request do
        xml.RequestAction REQUEST_ACTION
      end
      xml.Address do
        xml.PostalCode location.zip
        xml.CountryCode location.country.code
      end
    end
  end
  xml_builder.to_xml
end