Module: Usps::Api::Endpoints::SundayHolidayAvailability

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

Instance Method Summary collapse

Instance Method Details

#sunday_holiday_availability(options = {}) ⇒ Object

The Sunday Holiday API allows customers to request information on package availability for Sunday’s and/or Holidays for a given zip code pairing. For information on USPS Holidays, please visit about.usps.com/newsroom/events/.

Parameters:

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

Options Hash (options):

  • sunday_holiday_request (required, Hash)

    API = SundayHolidayRequest

    • :sunday_holiday (required, String) — Select Sunday or Holiday

    • :from_zip_code (required, String) — 5 digit ship from Zip

    • :to_zip_code (required, String) — 5 digiit ship to zip



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/usps/api/endpoints/sunday_holiday_availability.rb', line 17

def sunday_holiday_availability(options = {})
	throw ArgumentError.new('Required arguments :sunday_holiday_request missing') if options[:sunday_holiday_request].nil?
	throw ArgumentError.new('Required arguments :sunday_holiday_request, :sunday_holiday missing') if options[:sunday_holiday_request][:sunday_holiday].nil?
	throw ArgumentError.new('Required arguments :sunday_holiday_request, :from_zip_code missing') if options[:sunday_holiday_request][:from_zip_code].nil?
	throw ArgumentError.new('Required arguments :sunday_holiday_request, :to_zip_code missing') if options[:sunday_holiday_request][:to_zip_code].nil?

	request = build_request(:sunday_holiday_availability, options)
	get('https://secure.shippingapis.com/shippingapi.dll', {
		API: 'SundayHolidayAvailability',
		XML: request,
	})
end