Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kufu/jpostcode-rb
📮 A Ruby implementation of Japan postcode
https://github.com/kufu/jpostcode-rb
hacktoberfest
Last synced: about 5 hours ago
JSON representation
📮 A Ruby implementation of Japan postcode
- Host: GitHub
- URL: https://github.com/kufu/jpostcode-rb
- Owner: kufu
- License: mit
- Created: 2017-02-12T07:36:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T01:26:40.000Z (5 months ago)
- Last Synced: 2024-05-29T15:20:02.181Z (5 months ago)
- Topics: hacktoberfest
- Language: Ruby
- Homepage: https://github.com/kufu/jpostcode-rb
- Size: 731 KB
- Stars: 23
- Watchers: 58
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Jpostcode [![CircleCI](https://circleci.com/gh/kufu/jpostcode-rb.svg?style=svg)](https://circleci.com/gh/kufu/jpostcode-rb)
A Ruby implementation for Japan postcode.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'jpostcode'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install jpostcode
## Usage
Basic one:
```ruby
address = Jpostcode.find('154-0011')
address.prefecture # 東京都
address.prefecture_kana # トウキョウト
address.prefecture_code # 13
address.city # 世田谷区
address.city_kana # セタガヤク
address.town # 上馬
address.town_kana # カミウマ
address.zip_code # 1540011
```When the code covers multiple addresses:
```ruby
addresses = Jpostcode.find('0110951')
addresses.class # Array
addresses.each do |address|
puts address.town
end# => 土崎港相染町
# => 土崎港古川町
```Office postcodes are also available:
```ruby
address = Jpostcode.find('113-8654')
address.prefecture # 東京都
address.prefecture_kana # トウキョウト
address.prefecture_code # 13
address.city # 文京区
address.city_kana # ブンキョウク
address.town # 本郷
address.town_kana # ホンゴウ
address.street # 7丁目3−1
address.office_name # 東京大学 本部事務組織
address.office_name_kana # トウキヨウダイガク ホンブジムソシキ
address.zip_code # 1138654
```## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
### Update Submodule
This gem depends on `kufu/jpostcode-data`.
After updating `kufu/jpostcode-data`, run `git submodule foreach git pull origin master` in order to pull the data.## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kufu/jpostcode-rb.
## Code of Conduct
Everyone interacting in the Jpostcode project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kufu/jpostcode-rb/blob/master/CODE_OF_CONDUCT.md).
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).