Class: FriendlyShipping::Services::Ups::SerializeAddressValidationRequest
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::Ups::SerializeAddressValidationRequest
- Defined in:
- lib/friendly_shipping/services/ups/serialize_address_validation_request.rb
Constant Summary collapse
- REQUEST_ACTION =
'XAV'
- REQUEST_OPTIONS =
{ validation: 1, classification: 2, both: 3 }.freeze
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Class Method Summary collapse
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
7 8 9 |
# File 'lib/friendly_shipping/services/ups/serialize_address_validation_request.rb', line 7 def location @location end |
Class Method Details
.call(location:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/friendly_shipping/services/ups/serialize_address_validation_request.rb', line 16 def self.call(location:) xml_builder = Nokogiri::XML::Builder.new do |xml| xml.AddressValidationRequest do xml.Request do xml.RequestAction REQUEST_ACTION xml.RequestOption REQUEST_OPTIONS[:both] end xml.AddressKeyFormat do xml.ConsigneeName(location.company_name.presence || location.name) xml.AddressLine location.address1 xml.AddressLine location.address2 xml.PoliticalDivision2 location.city xml.PoliticalDivision1 location.region.code xml.PostcodePrimaryLow location.zip xml.CountryCode location.country.code end end end xml_builder.to_xml end |