Sha256: 3755ebe44165fb815dde6de905ce89bdcbf6bdbb720b29ebec45e1acc197a182

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

# frozen_string_literal: true

module FriendlyShipping
  module Services
    class UpsJson
      class GenerateAddressClassificationPayload
        def self.call(location:)
          {
            XAVRequest: {
              Request: {
                RequestOption: '2', # Address Classification, duplicated in the url path
              },
              AddressKeyFormat: [
                {
                  AddressLine: [location.address1, location.address2, location.address3].compact,
                  ConsigneeName: location.company_name || location.name,
                  CountryCode: location.country.code,
                  PoliticalDivision1: location.region.name,
                  PoliticalDivision2: location.city,
                  PostcodePrimaryLow: location.zip
                }
              ]
            }
          }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friendly_shipping-0.9.0 lib/friendly_shipping/services/ups_json/generate_address_classification_payload.rb