0.0
No commit activity in last 3 years
No release in over 3 years
In this version, this toolkit allows the generation, validation and formating of CPF's and CNPJ's. For now, the use is exclusive to Brazil.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.15
~> 10.0
~> 3.0
 Project Readme

TookeUtils

Build Status Gem Version Gem

Welcome to TookeUtils!

In this version, this toolkit allows the generation, validation and formating of CPF's and CNPJ's. For now, the use is exclusive to Brazil.

Installation

Add this line to your application's Gemfile:

gem 'tooke_utils'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tooke_utils

Usage

Generate a valid CPF:

$ cpf = TookeUtils::CPF.generate        # Generates a valid CPF like "267.573.018-14"

Check if 'cpf' is valid:

$ cpf = "267.573.018-14"                

$ TookeUtils::CPF.is_valid? cpf         # True

Apply a valid mask to cpf:

$ cpf = "26757301814"                   

$ TookeUtils::CPF.mask cpf              # Results in "267.573.018-14"

Generate a valid CNPJ:

$ cnpj = TookeUtils::CNPJ.generate      # Generates a valid CNPJ like "41.737.186/0001-43"

Check if 'cnpj' is valid:

$ cnpj = "41737186000143"               

$ TookeUtils::CNPJ.is_valid? cnpj       # True

Apply a valid mask to cnpj:

$ cnpj = "41737186000143"               

$ TookeUtils::CNPJ.mask cnpj            # Results in "41.737.186/0001-43"

Future Implementations

  • ZipCode validation (Brazil)
  • Get 'Address', 'City' and 'State' using ZipCode (WebService)
  • GoogleMaps Integration (API)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/renatokano/tooke_utils.

License

The gem is available as open source under the terms of the MIT License.