world_postal_codes 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6439f072ad42247fba54b4841fe545ae95374ec
4
- data.tar.gz: 00499e83e235604f3f337aed251fba2b0789f16e
3
+ metadata.gz: 288538377c418b4af26f417433be82aef04cc55c
4
+ data.tar.gz: e426a1041aa3fe9b3d91f17df63b3fc84f2000e3
5
5
  SHA512:
6
- metadata.gz: 987a355224c9a060ac047517eadde1713b063677b80990be3dd45ccc8ab82662d9d7f5e88858abaaa65eff4d76a21d1bda3529bfc5a995fd3436989ef5b814c1
7
- data.tar.gz: 6dc42935b1e8876adebda82da3439971d39f22cf49beab1d33cc83702a027209327173e9dfd4dce37228d0b760e22ef2d029392313e7dc88d3653a892e468384
6
+ metadata.gz: f6776165dd5e4de6f45d7d874d3f1a96defd2cdf4de296ef428584b0d5fa67f8f690b6f077a4f29596aa23c3bb37ba71ab785b8f9c839186f6ab23a19f57bc62
7
+ data.tar.gz: 44d744cc82c2c262b54bcae688a793b304f074939ebeace8fa759a9b444f4c53d2d241231e153b906e623efbd265ccd464bf1e477e94be9cd8863651aeaae75d
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # Postcodes
1
+ # WorldPostalCodes [![Gem Version](https://badge.fury.io/rb/world_postal_codes.svg)](https://badge.fury.io/rb/world_postal_codes)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/postcodes`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Simmple gemt to get city, state for given zip code. supported country is below
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ * Japan
6
6
 
7
7
  ## Installation
8
8
 
@@ -22,7 +22,21 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
25
+ ```
26
+ WorldPostalCodes.jp("00000")
27
+ # => {:prefecture=>"神奈川県", :prefecture_kana=>"カナガワケン", :city=>"相模原市南区", :city_kana=>"サガミハラシミナミク"}
28
+ ```
29
+
30
+ laoding master file
31
+ ```
32
+ # config/initializers/world_postal_codes.rb
33
+ WorldPostalCodes.load
34
+ ```
35
+
36
+ Uplaod master file
37
+ ```
38
+ bin/rake postal_codes:import_jp
39
+ ```
26
40
 
27
41
  ## Development
28
42
 
@@ -31,9 +45,13 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
31
45
  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).
32
46
 
33
47
  ## Contributing
48
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
49
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/postcodes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
50
+ Fork it
51
+ Create your feature branch (git checkout -b my-new-feature)
52
+ Commit your changes (git commit -am 'Add some feature')
53
+ Push to the branch (git push origin my-new-feature)
54
+ Create new Pull Request
37
55
 
38
56
  ## License
39
57
 
@@ -6,22 +6,5 @@ module WorldPostalCodes
6
6
  DATA_DIR = File.dirname(__FILE__) + '/../data/japan.yml'
7
7
  ZIP_URL = "http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip"
8
8
  extend WorldPostalCodes::Identify
9
-
10
- # class << self
11
- # def identify(code)
12
- # db[code] || {}
13
- # end
14
-
15
- # def db
16
- # @db ||= begin
17
- # YAML.load(File.open(DATA_DIR))
18
- # end
19
- # end
20
-
21
- # def load
22
- # db
23
- # end
24
- # end
25
-
26
9
  end
27
10
  require 'world_postal_codes/railtie' if defined?(Rails)
@@ -3,6 +3,9 @@ require "yaml"
3
3
  module WorldPostalCodes
4
4
  module Identify
5
5
  def jp(code)
6
+ code = code.tr('0-9', '0-9')
7
+ code = code.gsub(/-|ー/, "")
8
+
6
9
  db[code] || {}
7
10
  end
8
11
 
@@ -1,3 +1,3 @@
1
1
  module WorldPostalCodes
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: world_postal_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kawasaki-atsushi
@@ -130,4 +130,3 @@ signing_key:
130
130
  specification_version: 4
131
131
  summary: Simple gem to get city for a given Japan postal codes.
132
132
  test_files: []
133
- has_rdoc: