phony 2.18.9 → 2.18.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/phony/countries.rb +11 -6
- data/spec/functional/plausibility_spec.rb +5 -0
- data/spec/lib/phony/countries_spec.rb +2 -0
- data/spec/lib/phony/country_codes_spec.rb +4 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 65cd9d252c032ff5116a79fa6e5b670f7d482d16534c43d2369c951aeaa01003
         | 
| 4 | 
            +
              data.tar.gz: b1be2f32723b945d1854ea7b613e3121b95c5870e4704b3f0c42833f9c524271
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e12dd75c0642fb9b50527957dbeb470fbc831e732f4e54b1a8ceafe05970db355ed0d4b4097f43bbb7ea98ca99d28aea382b10c51a345bf94976df981666c9e4
         | 
| 7 | 
            +
              data.tar.gz: 40d2961f1b3fec24505c376deb4252253af59c71eeda0c6b1bb35b4f5bce41a7c8ea99ad4a233e40974bc7cce6f2ae8dd403febf3f09006b4c69fb045635c3a9
         | 
    
        data/lib/phony/countries.rb
    CHANGED
    
    | @@ -386,14 +386,19 @@ Phony.define do | |
| 386 386 | 
             
              country '233', fixed(2) >> split(3,4)
         | 
| 387 387 |  | 
| 388 388 | 
             
              # Nigeria
         | 
| 389 | 
            -
              #  | 
| 389 | 
            +
              # 3 4 split for mobile and 1 digit NDC, 3 2 or 3 3 otherwise
         | 
| 390 | 
            +
              # Many local numbers with no splitting
         | 
| 390 391 | 
             
              #
         | 
| 391 | 
            -
              # mobile telephony number allocation taken from: | 
| 392 | 
            +
              # mobile telephony number allocation taken from:
         | 
| 393 | 
            +
              # https://www.ncc.gov.ng/technical-regulation/standards/numbering and
         | 
| 394 | 
            +
              # https://www.itu.int/oth/T020200009C/en
         | 
| 392 395 | 
             
              country '234',
         | 
| 393 | 
            -
                match(/^([7-9]0\d)\d+$/) | 
| 394 | 
            -
                match(/^(81\d)\d+$/) | 
| 395 | 
            -
                one_of('1', '2' | 
| 396 | 
            -
                 | 
| 396 | 
            +
                match(/^([7-9]0\d)\d+$/)            >> split(3,4)    | # Mobile
         | 
| 397 | 
            +
                match(/^(81\d)\d+$/)                >> split(3,4)    | # Mobile
         | 
| 398 | 
            +
                one_of('1', '2')                    >> split(3,3..4) | # Lagos, Ibadan
         | 
| 399 | 
            +
                one_of('9')                         >> split(3,4)    | # Abuja
         | 
| 400 | 
            +
                one_of((30..79).map(&:to_s))        >> split(3,2..3) | # 2-digit NDC
         | 
| 401 | 
            +
                one_of(%w(82 83 84 85 86 87 88 89)) >> split(3,3)      # 2-digit NDC
         | 
| 397 402 |  | 
| 398 403 | 
             
              country '235', none >> split(4,4) # Chad http://www.wtng.info/wtng-235-td.html
         | 
| 399 404 | 
             
              country '236', none >> split(4,4) # Central African Republic http://www.wtng.info/wtng-236-cf.html
         | 
| @@ -355,6 +355,11 @@ describe 'plausibility' do | |
| 355 355 | 
             
                  end
         | 
| 356 356 | 
             
                  it_is_correct_for 'Nicaragua', :samples => '+505 12 345 678'
         | 
| 357 357 | 
             
                  it_is_correct_for 'Niger', :samples => '+227  1234 5678'
         | 
| 358 | 
            +
                  it_is_correct_for 'Nigeria', :samples => ['+234 807 059 1111',
         | 
| 359 | 
            +
                                                          '+234 811 234 5678',
         | 
| 360 | 
            +
                                                          '+234 64 830 00',
         | 
| 361 | 
            +
                                                          '+234 1 280 444',
         | 
| 362 | 
            +
                                                          '+234 85 123 456']
         | 
| 358 363 | 
             
                  it_is_correct_for 'Niue', :samples => '+683  3791'
         | 
| 359 364 | 
             
                  it_is_correct_for 'Oman', :samples => ['+968 24 423 123',
         | 
| 360 365 | 
             
                                                         '+968 25 423 123']
         | 
| @@ -1103,6 +1103,8 @@ describe 'country descriptions' do | |
| 1103 1103 | 
             
                describe 'Nigeria' do
         | 
| 1104 1104 | 
             
                  it_splits '23411231234', %w(234 1 123 1234) # Lagos
         | 
| 1105 1105 |  | 
| 1106 | 
            +
                  it_splits '23445123456', %w(234 45 123 456) # Ogoja
         | 
| 1107 | 
            +
             | 
| 1106 1108 | 
             
                  # mobile numbers
         | 
| 1107 1109 | 
             
                  it_splits '2347007661234', %w(234 700 766 1234)
         | 
| 1108 1110 | 
             
                  it_splits '2347017661234', %w(234 701 766 1234)
         | 
| @@ -147,9 +147,12 @@ describe Phony::CountryCodes do | |
| 147 147 | 
             
                  it "should format luxembourgian numbers" do
         | 
| 148 148 | 
             
                    @countries.formatted('35227855', :format => :international).should eql '+352 27 85 5'
         | 
| 149 149 | 
             
                  end
         | 
| 150 | 
            -
                  it "should format nigerian numbers" do
         | 
| 150 | 
            +
                  it "should format nigerian lagosian numbers" do
         | 
| 151 151 | 
             
                    @countries.formatted('23414480000', :format => :international).should eql '+234 1 448 0000'
         | 
| 152 152 | 
             
                  end
         | 
| 153 | 
            +
                  it "should format nigerian beninese numbers" do
         | 
| 154 | 
            +
                    @countries.formatted('23452123456', :format => :international).should eql '+234 52 123 456'
         | 
| 155 | 
            +
                  end
         | 
| 153 156 | 
             
                  it "should format nigerian mobile numbers" do
         | 
| 154 157 | 
             
                    @countries.formatted('2347061234567', :format => :international).should eql '+234 706 123 4567'
         | 
| 155 158 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: phony
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.18. | 
| 4 | 
            +
              version: 2.18.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Florian Hanke
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019-11- | 
| 11 | 
            +
            date: 2019-11-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: 'Fast international phone number (E164 standard) normalizing, splitting
         | 
| 14 14 | 
             
              and formatting. Lots of formatting options: International (+.., 00..), national
         |