Class: FriendlyShipping::Services::UpsJson::GenerateAddressClassificationPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups_json/generate_address_classification_payload.rb

Class Method Summary collapse

Class Method Details

.call(location:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/friendly_shipping/services/ups_json/generate_address_classification_payload.rb', line 7

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