From d54768597335491586c6a5c06e95cff87d1d1246 Mon Sep 17 00:00:00 2001 From: Dennis Theisen Date: Thu, 16 Dec 2010 17:53:00 -0500 Subject: [PATCH] Fix Location and USPS carrier to not expect an Array from country.code because it now returns a CountryCode object directly --- lib/active_shipping/shipping/carriers/usps.rb | 2 +- lib/active_shipping/shipping/location.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/active_shipping/shipping/carriers/usps.rb b/lib/active_shipping/shipping/carriers/usps.rb index caf91e670..12f99a123 100644 --- a/lib/active_shipping/shipping/carriers/usps.rb +++ b/lib/active_shipping/shipping/carriers/usps.rb @@ -242,7 +242,7 @@ def build_us_rate_request(packages, origin_zip, destination_zip, options={}) # package.options[:mail_type] -- one of [:package, :postcard, :matter_for_the_blind, :envelope]. # Defaults to :package. def build_world_rate_request(packages, destination_country) - country = COUNTRY_NAME_CONVERSIONS[destination_country.code(:alpha2).first.value] || destination_country.name + country = COUNTRY_NAME_CONVERSIONS[destination_country.code(:alpha2).value] || destination_country.name request = XmlNode.new('IntlRateRequest', :USERID => @options[:login]) do |rate_request| packages.each_index do |id| p = packages[id] diff --git a/lib/active_shipping/shipping/location.rb b/lib/active_shipping/shipping/location.rb index 2d056600b..e0ec297f6 100644 --- a/lib/active_shipping/shipping/location.rb +++ b/lib/active_shipping/shipping/location.rb @@ -70,7 +70,7 @@ def self.from(object, options={}) end def country_code(format = :alpha2) - @country.nil? ? nil : @country.code(format).first.value + @country.nil? ? nil : @country.code(format).value end def residential?; (@address_type == 'residential') end