Skip to content

Commit

Permalink
Fix Location and USPS carrier to not expect an Array from country.cod…
Browse files Browse the repository at this point in the history
…e because it now returns a CountryCode object directly
  • Loading branch information
Soleone committed Dec 16, 2010
1 parent 9c9b3f4 commit d547685
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/active_shipping/shipping/carriers/usps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion lib/active_shipping/shipping/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d547685

Please sign in to comment.