Module: Usps::Api::Endpoints::PTSEmail

Included in:
Usps::Api::Endpoints
Defined in:
lib/usps/api/endpoints/pts_email.rb

Instance Method Summary collapse

Instance Method Details

#pts_email(options = {}) ⇒ Object

The Track and Confirm by Email API allows the customer to submit their email address to be notified of current or future tracking activity. 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:

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • pts_email_request (required, Hash)
    • :track_id (required, String)

    • :client_ip (String)

    • :source_id (String)

    • :mp_suffix (required, Integer)

    • :mp_date (required, String)

    • :request_type (Request Type)

    • :first_name (String)

    • :last_name (String)

    • :email1 (required, String)

    • :email2 (String)

    • :email3 (String)



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/usps/api/endpoints/pts_email.rb', line 29

def pts_email(options = {})
	throw ArgumentError.new('Required arguments :pts_email_request missing') if options[:pts_email_request].nil?
	throw ArgumentError.new('Required arguments :pts_email_request, :track_id missing') if options[:pts_email_request][:track_id].nil?
	throw ArgumentError.new('Required arguments :pts_email_request, :mp_suffix missing') if options[:pts_email_request][:mp_suffix].nil?
	throw ArgumentError.new('Required arguments :pts_email_request, :mp_date missing') if options[:pts_email_request][:mp_date].nil?
	throw ArgumentError.new('Required arguments :pts_email_request, :email1 missing') if options[:pts_email_request][:email1].nil?

	request = build_request(:pts_email, options)
	get('https://secure.shippingapis.com/ShippingAPI.dll', {
		API: 'PTSEmail',
		XML: request,
	})
end