# frozen_string_literal: true # This file was auto-generated by lib/tasks/api.rake module Usps module Api module Endpoints module PTSPod # # Proof of Delivery API # # Proof of # Delivery is a letter that includes the recipient's name and a copy of their # signature. The Proof of Delivery API # allows the customer to request proof of delivery notification via email. When # you request access for this API, please identify your anticipated API volume, # mailer ID and how you will be utilizing this API. A mailer identification # number (MID) is a 6 or 9-digit number assigned to a customer through the USPS # Business Customer Gateway (BCG). Please refer to the following links for help: # # @option option [(Alias)] :PTSPodRequest (Optional) # @option option [String] :TrackId (Required) # @option option [String] :ClientIp (Optional) # @option option [String] :SourceId (Optional) # @option option [integer] :MpSuffix (Required) # @option option [String] :MpDate (Required) # @option option [String] :RequestType (Required) # @option option [String] :FirstName (Required) # @option option [String] :LastName (Required) # @option option [String] :Email1 (Optional) # @option option [String] :Email2 (Optional) # @option option [String] :Email3 (Optional) # @option option [String] :FaxNumber (Optional) # @option option [String] :AddressLine1 (Optional) # @option option [String] :AddressLine2 (Optional) # @option option [String] :City (Optional) # @option option [String] :State (Optional) # @option option [String] :Zip (Optional) # @option option [Boolean] :VerifyAddress (Optional) # @option option [String] :TableCode (Required) # @option option [String] :CustRegID (Optional) # # @see def pts_pod(options = {}) request = build_request(:pts_pod, options) get('https://secure.shippingapis.com/ShippingAPI.dll', { API: 'PTSPod', XML: request, }) end private def tag_unless_blank(xml, tag_name, data) xml.tag!(tag_name, data) unless data.blank? || data.nil? end def build_pts_pod_request(xml, options = {}) xml.tag!('TrackId', options[:pts_pod_request][:track_id]) tag_unless_blank(xml, 'ClientIp', options[:pts_pod_request][:client_ip]) tag_unless_blank(xml, 'SourceId', options[:pts_pod_request][:source_id]) xml.tag!('MpSuffix', options[:pts_pod_request][:mp_suffix]) xml.tag!('MpDate', options[:pts_pod_request][:mp_date]) xml.tag!('RequestType', options[:pts_pod_request][:request_type]) xml.tag!('FirstName', options[:pts_pod_request][:first_name]) xml.tag!('LastName', options[:pts_pod_request][:last_name]) tag_unless_blank(xml, 'Email1', options[:pts_pod_request][:email1]) tag_unless_blank(xml, 'Email2', options[:pts_pod_request][:email2]) tag_unless_blank(xml, 'Email3', options[:pts_pod_request][:email3]) tag_unless_blank(xml, 'FaxNumber', options[:pts_pod_request][:fax_number]) tag_unless_blank(xml, 'AddressLine1', options[:pts_pod_request][:address_line1]) tag_unless_blank(xml, 'AddressLine2', options[:pts_pod_request][:address_line2]) tag_unless_blank(xml, 'City', options[:pts_pod_request][:city]) tag_unless_blank(xml, 'State', options[:pts_pod_request][:state]) tag_unless_blank(xml, 'Zip', options[:pts_pod_request][:zip]) tag_unless_blank(xml, 'VerifyAddress', options[:pts_pod_request][:verify_address]) xml.tag!('TableCode', options[:pts_pod_request][:table_code]) tag_unless_blank(xml, 'CustRegID', options[:pts_pod_request][:cust_reg_id]) xml.target! end end end end end