Method: ActiveShipping::USPS#find_country_code_case_insensitive
- Defined in:
- lib/active_shipping/carriers/usps.rb
#find_country_code_case_insensitive(name) ⇒ Object (protected)
672 673 674 675 676 677 678 679 680 |
# File 'lib/active_shipping/carriers/usps.rb', line 672 def find_country_code_case_insensitive(name) upcase_name = name.upcase.gsub(' ', ', ') if special = TRACKING_ODD_COUNTRY_NAMES[upcase_name] return special end country = ActiveUtils::Country::COUNTRIES.detect { |c| c[:name].upcase == upcase_name } raise ActiveShipping::Error, "No country found for #{name}" unless country country[:alpha2] end |