Skip to content

Library for checking in which category a german phone number falls in regards to Bundesnetzagentur classes

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt
Notifications You must be signed in to change notification settings

jethroo/german_phone_number_classifier

Repository files navigation

Rspec & Coverage

German Phone Number Classifier

Library for checking in which category a german phone number falls in regards to Bundesnetzagentur classes.

Ruby Version

This gem is developed for ruby versions '>= 2.7.0'.

Usage

Add the gem to your Gemfile:

gem 'german_phone_number_classifier', '1.0.0.pre'

and run bundle install.

The module comes with 2 class methods as public interface.

.classify

This method is for identifying the a telephone number as part of the german phone number system and will put it in a category identified as symbol:

irb(main):001:0> GermanPhoneNumberClassifier.classify('+4930120849110')
=> :landline
irb(main):002:0> GermanPhoneNumberClassifier.classify('+4830120849110')
=> :non_german_phone_number
irb(main):003:0> GermanPhoneNumberClassifier.classify('+4915012345678')
=> :mobile

Following categories are defined:

.landline_location

Furthermore the gem offers a utility function to get the location from prefix mappings for german phone numbers which are :landline. All others numbers will get nil returned.

irb(main):002:0> GermanPhoneNumberClassifier.landline_location('+4930120849110')
=> "Berlin"

Development

Test can be run with rspec: bundle exec rspec and rubocop: bundle exec rubocop

Contributing

  1. Fork it (https://github.com/jethroo/german_phone_number_classifier/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Notes:

  • Contributions without tests won't be accepted.
  • Please don't update the gem version.

License

see here

Authors/Contributors

About

Library for checking in which category a german phone number falls in regards to Bundesnetzagentur classes

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published