area_code_validator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3451881fd13882c503bb07c7b00396d76ccb2e01
4
- data.tar.gz: 9af20f49875b7e040dffc8d5c58694246aa73fd6
3
+ metadata.gz: 57fe582d083784329e37ea9dcbabd74387dc10ab
4
+ data.tar.gz: 24d85ff4d861f1a84a18fb5824d2ab650f5feb1f
5
5
  SHA512:
6
- metadata.gz: 990c1e377757babb08366dd14c7ff1bce26900456cd7aff2915871a2541e8ebdd0966f741cf35be4ac08c82b12c5070a1db11f71195a2ffc0a24be9e6d8e6dcb
7
- data.tar.gz: f0f36fc8147beac1be835bfc5c361f44cea36cf65f174ac0b04229451492372270d31768e36a928f4c16bbd03166aedd2d6a38ef396d9afaf6f5999f4d72ef55
6
+ metadata.gz: e5eec02a1fd6a3966c0a9527f594a911028a046e65c6c7afdbb46a4ab9ddf5d52a6660d1f2c6cb85244a27c534ffab4131bec525ae5b6a5cf98c9da8b4a2c8ef
7
+ data.tar.gz: 1130a83dea93c8447dbd01ef34b51f91e429efa09ffa179c1011ac83c3533e08b9fc318cdd3967e8b38a73913d52da726c1fd21975d331464ca7b8c628d5d5e3
@@ -1,3 +1,3 @@
1
1
  module AreaCodeValidator
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  require 'area_code_validator/version'
2
- require 'config/config'
2
+ require 'config/area_code_config'
3
3
  # TODO: create validator
4
4
  # require 'extensions/area_code_invalid_validator' if defined?(Rails)
5
5
 
@@ -14,13 +14,13 @@ module AreaCodeValidator
14
14
  area_code_state = area_code_state.to_s.upcase.gsub(/(\W|\d|_)*/, '')
15
15
 
16
16
  # Stop here and return true if the state does not exist
17
- return true if !Config::STATES.include?(area_code_state) and !Config::STATES.values.include?(area_code_state)
17
+ return true if !AreaCodeConfig::STATES.include?(area_code_state) and !AreaCodeConfig::STATES.values.include?(area_code_state)
18
18
 
19
19
  # Find the state abbreviation key we need to access our hash of arrays of area codes.
20
20
  key = get_abbreviation_key(area_code_state)
21
21
 
22
22
  # If the area code is in our list return false else return true
23
- return false if Config::AREA_CODES[key].include?(area_code)
23
+ return false if AreaCodeConfig::AREA_CODES[key].include?(area_code)
24
24
  true
25
25
  end
26
26
 
@@ -30,7 +30,7 @@ module AreaCodeValidator
30
30
  # If the area_code_state is greater than 2 then it is a full state name and we need to find the corresponding abbreviation for that state.
31
31
  key = ''
32
32
  if area_code_state.length > 2
33
- Config::STATES.each do |k, v|
33
+ AreaCodeConfig::STATES.each do |k, v|
34
34
  key = k if v == area_code_state
35
35
  end
36
36
  else
@@ -1,5 +1,5 @@
1
1
  module AreaCodeValidator
2
- class Config
2
+ class AreaCodeConfig
3
3
  # Constant frozen hash of states and abbreviations
4
4
  STATES = {
5
5
  'AL' => 'ALABAMA',
@@ -112,4 +112,4 @@ module AreaCodeValidator
112
112
  'WI' => ['262', '414', '608', '715', '920'],
113
113
  'WY' => ['307'] }.freeze
114
114
  end
115
- end
115
+ end
@@ -31,12 +31,12 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  should 'handle a state abbreviation with non-word characters' do
34
- state = '12}3 F (** __)L @ 5674``' # FL
34
+ state = '12}3 F (** __)L @ 5674``' # FL
35
35
  assert !AreaCodeValidator.invalid?(Helper::VALID_AREA_CODES['FL'].first, state)
36
36
  end
37
37
 
38
38
  should 'handle a full state name with non-word characters' do
39
- state = '12_3 F (** )L o # R ^ I !!!! DA @ 907' # FLORIDA
39
+ state = '12_3 F (** )L o # R ^ I !!!! DA @ 907' # FLORIDA
40
40
  assert !AreaCodeValidator.invalid?(Helper::VALID_AREA_CODES['FL'].first, state)
41
41
  end
42
42
 
@@ -55,11 +55,11 @@ class AreaCodeValidatorTest < Test::Unit::TestCase
55
55
  end
56
56
 
57
57
  context '#get_abbreviation_key' do
58
- AreaCodeValidator::Config::STATES.each do |state_abbreviation, state_name|
58
+ AreaCodeValidator::AreaCodeConfig::STATES.each do |state_abbreviation, state_name|
59
59
  should "return the correct state abbreviation #{state_abbreviation}" do
60
60
  assert_equal state_abbreviation, AreaCodeValidator.get_abbreviation_key(state_name)
61
61
  end
62
62
  end
63
63
  end
64
64
  end
65
- end
65
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: area_code_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Medeiros
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-08 00:00:00.000000000 Z
11
+ date: 2013-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -68,7 +68,7 @@ files:
68
68
  - area_code_validator.gemspec
69
69
  - lib/area_code_validator.rb
70
70
  - lib/area_code_validator/version.rb
71
- - lib/config/config.rb
71
+ - lib/config/area_code_config.rb
72
72
  - lib/extensions/area_code_invalid_validator.rb
73
73
  - test/test_area_code_validator.rb
74
74
  - test/test_helper.rb