# frozen_string_literal: true # This file was auto-generated by lib/tasks/api.rake module Usps module Api module Endpoints module SundayHolidayAvailability # 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 https://about.usps.com/newsroom/events/. # @param [Hash] options # @option options [required, Hash] sunday_holiday_request 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 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 private def tag_unless_blank(xml, tag_name, data) xml.tag!(tag_name, data) unless data.blank? || data.nil? end def build_sunday_holiday_availability_request(xml, options = {}) xml.tag!('SundayHoliday', options[:sunday_holiday_request][:sunday_holiday]) xml.tag!('FromZipCode', options[:sunday_holiday_request][:from_zip_code]) xml.tag!('ToZipCode', options[:sunday_holiday_request][:to_zip_code]) xml.target! end end end end end