0.0
A long-lived project that still receives updates
Validate, format, and get the corresponding Brazilian state for a given CEP without making network requests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.0
 Project Readme

Gem Version

CodigoPostal

Validate, format, and get the corresponding Brazilian state for a given CEP without making network requests.

Installation

Add this line to your application's Gemfile:

gem 'codigo_postal'

And then execute:

$ bundle install

Usage

cep = CodigoPostal.new(1001000)
puts cep.state_code # => 'SP'
puts cep.state_name # => 'São Paulo'
puts cep.to_s # => '01001-000'

You can also compare two CodigoPostal instances using the == operator:

cep1 = CodigoPostal.new(4094050)
cep2 = CodigoPostal.new("04.094-050")
puts cep1 == cep2 # => true

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/felipedmesquita/codigo-postal. Run tests using tldr

tldr

License

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