# 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 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: # @param [Hash] options # @option options [required, Hash] pts_pod_request # * *:track_id* (required, String) # * *:client_ip* (String) # * *:source_id* (String) # * *:mp_suffix* (required, integer) # * *:mp_date* (required, String) # * *:request_type* (required, String) # * *:first_name* (required, String) # * *:last_name* (required, String) # * *:email1* (String) # * *:email2* (String) # * *:email3* (String) # * *:fax_number* (String) # * *:address_line1* (String) # * *:address_line2* (String) # * *:city* (String) # * *:state* (String) # * *:zip* (String) # * *:verify_address* (Boolean) # * *:table_code* (required, String) # * *:cust_reg_id* (String) 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