Skip to content

Commit

Permalink
Merge pull request #104 from monfresh/fix-countries-issue
Browse files Browse the repository at this point in the history
Replace Data with Setup.data (Countries gem v0.11.5).
  • Loading branch information
Joost Hietbrink committed Jul 11, 2015
2 parents 9a8b2ad + 702f927 commit cd2afab
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/.idea/
.ruby-gemset
.ruby-version
coverage/*
11 changes: 7 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
phony_rails (0.12.8)
activesupport (>= 3.0)
countries (~> 0.8, >= 0.8.2)
countries (~> 0.11, >= 0.11.5)
phony (~> 2.12)

GEM
Expand All @@ -29,10 +29,10 @@ GEM
timers (~> 4.0.0)
coderay (1.1.0)
connection_pool (2.2.0)
countries (0.11.4)
countries (0.11.5)
currencies (~> 0.4.2)
i18n_data (~> 0.7.0)
coveralls (0.8.1)
coveralls (0.8.2)
json (~> 1.8)
rest-client (>= 1.6.8, < 2)
simplecov (~> 0.10.0)
Expand Down Expand Up @@ -127,7 +127,7 @@ GEM
simplecov-html (0.10.0)
slop (3.6.0)
sqlite3 (1.3.10)
term-ansicolor (1.3.1)
term-ansicolor (1.3.2)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
Expand Down Expand Up @@ -155,3 +155,6 @@ DEPENDENCIES
rake
rspec
sqlite3

BUNDLED WITH
1.10.5
4 changes: 2 additions & 2 deletions lib/phony_rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module PhonyRails

def self.country_number_for(country_code)
ISO3166::Country::Data[country_code.to_s.upcase].try(:[], 'country_code')
ISO3166::Country::Setup.data[country_code.to_s.upcase].try(:[], 'country_code')
end

# This method requires a country_code attribute (eg. NL) and phone_number to be set.
Expand Down Expand Up @@ -59,7 +59,7 @@ def self.country_code_from_number(number)
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
Expand Down
2 changes: 1 addition & 1 deletion phony_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |gem|
gem.post_install_message = "It now ads a '+' to the normalized number when it starts with a country number!"

gem.add_dependency "phony", '~> 2.12'
gem.add_dependency "countries", '~> 0.8', '>= 0.8.2'
gem.add_dependency "countries", '~> 0.11', '>= 0.11.5'
gem.add_dependency "activesupport", ">= 3.0"
gem.add_development_dependency "activerecord", ">= 3.0"
gem.add_development_dependency "mongoid", ">= 3.0"
Expand Down

0 comments on commit cd2afab

Please sign in to comment.