Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vinibrsl/viacep
🇧🇷 Dependency-less zipcode/CEP lookup gem for Brazilian addresses
https://github.com/vinibrsl/viacep
brasil cep gem ruby viacep zipcode-lookup-gem
Last synced: 11 days ago
JSON representation
🇧🇷 Dependency-less zipcode/CEP lookup gem for Brazilian addresses
- Host: GitHub
- URL: https://github.com/vinibrsl/viacep
- Owner: vinibrsl
- License: mit
- Created: 2018-04-21T13:23:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-30T08:58:11.000Z (about 1 year ago)
- Last Synced: 2024-04-23T20:54:42.406Z (7 months ago)
- Topics: brasil, cep, gem, ruby, viacep, zipcode-lookup-gem
- Language: Ruby
- Homepage:
- Size: 45.9 KB
- Stars: 17
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# viacep ![Tests](https://github.com/vnbrs/viacep/workflows/Tests/badge.svg) [![GitHub license](https://img.shields.io/github/license/vnbrs/burocracia.cr.svg)](https://github.com/vnbrs/burocracia.cr/blob/master/LICENSE)
> Dependency-less zipcode lookup gem for Brazilian addresses with an easy-to-use API and useful features such as timeout.## Installing
You can easily install viacep through [RubyGems](https://rubygems.org/gems/viacep/):
```shell
gem install viacep
=> Rock on! 🚀
```or add the following to your Gemfile:
```shell
gem "viacep"
```## Usage
```ruby
require 'viacep'# with unformatted zipcodes... =)
ViaCep::Address.new('80210130')
=> ## with formatted zipcodes... =)
ViaCep::Address.new('13035-680')
=> ## or even an nonexistent zipcode... =(
ViaCep::Address.new('12345678')
=> exception thrown: ViaCep::ApiRequestError# and specifying a timeout in seconds... =)
ViaCep::Address.new('80210130', timeout: 0.2)
=> exception thrown: Timeout::Error (execution expired)
```## Docs
The documentation is available on [RubyDoc](https://www.rubydoc.info/gems/viacep). Starting on [`ViaCep::Address`](https://www.rubydoc.info/gems/viacep/ViaCep/Address) might be a good start.## Contributing
1. Create a fork (https://github.com/vnbrs/viacep/fork)
2. Create a branch (git checkout -b my-new-feature)
3. Make a commit (git commit -am 'Add some feature')
4. Push your code (git push origin my-new-feature)
5. Create a Pull Request
6. Thanks! 🤙🏼