lib/phony_rails.rb in phony_rails-0.12.8 vs lib/phony_rails.rb in phony_rails-0.12.9

- old
+ new

@@ -5,11 +5,11 @@ require 'phony_rails/version' module PhonyRails def self.country_number_for(country_code) - ISO3166::Country::Data[country_code.to_s.upcase].try(:[], 'country_code') + ISO3166::Country[country_code.to_s.upcase].try(:data).try(:[], 'country_code') end # This method requires a country_code attribute (eg. NL) and phone_number to be set. # Options: # :country_number => The country dial code (eg. 31 for NL). @@ -57,10 +57,10 @@ # Wrapper for Phony.plausible?. Takes the same options as #normalize_number. # NB: This method calls #normalize_number and passes _options_ directly to that method. def self.plausible_number?(number, options = {}) return false if number.nil? || number.blank? number = normalize_number(number, options) - country_number = options[:country_number] || country_number_for(options[:country_code]) || + country_number = options[:country_number] || country_number_for(options[:country_code]) || default_country_number = options[:default_country_number] || country_number_for(options[:default_country_code]) Phony.plausible? number, cc: country_number rescue false end