lib/active_shipping/carriers/usps.rb in active_shipping-1.0.0.pre4 vs lib/active_shipping/carriers/usps.rb in active_shipping-1.0.0

- old
+ new

@@ -11,11 +11,11 @@ # to do before they put your API key in production mode. class USPS < Carrier EventDetails = Struct.new(:description, :time, :zoneless_time, :location) EVENT_MESSAGE_PATTERNS = [ /^(.*), (\w+ \d{1,2}, \d{4}, \d{1,2}:\d\d [ap]m), (.*), (\w\w) (\d{5})$/i, - /^Your item \w{2,3} (out for delivery|delivered) at (\d{1,2}:\d\d [ap]m on \w+ \d{1,2}, \d{4}) in (.*), (\w\w) (\d{5})\.$/i + /^Your item \w{2,3} (out for delivery|delivered).* at (\d{1,2}:\d\d [ap]m on \w+ \d{1,2}, \d{4}) in (.*), (\w\w) (\d{5})\.$/i ] self.retry_safe = true cattr_reader :name @@name = "USPS" @@ -284,11 +284,11 @@ <ZIP5>94110</ZIP5> <ZIP4>9411</ZIP4> </CarrierPickupAvailabilityRequest> EOF xml = Nokogiri.XML(commit(:test, request, true)) { |config| config.strict } - xml.at('/CarrierPickupAvailabilityResponse/City').text == 'SAN FRANCISCO' && xml.at('/CarrierPickupAvailabilityResponse/Address2').text == '18 FAIR AVE' + xml.at('/CarrierPickupAvailabilityResponse/City').try(:text) == 'SAN FRANCISCO' && xml.at('/CarrierPickupAvailabilityResponse/Address2').try(:text) == '18 FAIR AVE' end # options[:service] -- One of [:first_class, :priority, :express, :bpm, :parcel, # :media, :library, :online, :plus, :all]. defaults to :all. # options[:books] -- Either true or false. Packages of books or other printed matter @@ -314,10 +314,10 @@ xml.FirstClassMailType(FIRST_CLASS_MAIL_TYPES[options[:first_class_mail_type].try(:to_sym)]) xml.ZipOrigination(strip_zip(origin_zip)) xml.ZipDestination(strip_zip(destination_zip)) xml.Pounds(0) xml.Ounces("%0.1f" % [package.ounces, 1].max) - xml.Container(CONTAINERS[package.options[:container]]) + xml.Container(CONTAINERS[package.options[:container]] || (package.cylinder? ? 'NONRECTANGULAR' : 'RECTANGULAR')) xml.Size(USPS.size_code_for(package)) xml.Width("%0.2f" % package.inches(:width)) xml.Length("%0.2f" % package.inches(:length)) xml.Height("%0.2f" % package.inches(:height)) xml.Girth("%0.2f" % package.inches(:girth))