zip_code 0.1.3 → 0.1.4
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 +4 -4
- data/README.md +6 -2
- data/lib/zip_code/version.rb +1 -1
- data/lib/zip_code.rb +5 -5
- data/zip_code.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc349504a99aea1126fd0a161979fe0d289fd1d
|
4
|
+
data.tar.gz: e7a0cf66fdda29f80384435983336b77cc2b0993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30b2e9f3ec34f13846232b388fa93834632f27f85764a80876000f16db0ad39cf51b450db7777f69847247c575e56bbc43979bada49f98df332a6470dcf59d43
|
7
|
+
data.tar.gz: 9691710c8752ee5e46a8d215c2f8d289a114b846735818452fe0f48386892c02f47f00446b86adb06236828e7a6c4dad3ddd3148180782efcd7758a2253a6ea0
|
data/README.md
CHANGED
@@ -22,10 +22,14 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
zip_code = ZipCode.find('河北省', '邢台市')
|
27
|
+
puts zip_code # => "054000"
|
26
28
|
|
29
|
+
zip_code = ZipCode.find('河北省', '邢台市', '柏乡县')
|
30
|
+
puts zip_code # => "055450"
|
31
|
+
```
|
27
32
|
## Development
|
28
|
-
|
29
33
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
34
|
|
31
35
|
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).
|
data/lib/zip_code/version.rb
CHANGED
data/lib/zip_code.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require "zip_code/mapping"
|
2
2
|
|
3
3
|
module ZipCode
|
4
|
-
def self.find
|
5
|
-
return '' if ZipCode::MAPPING[
|
6
|
-
return '' if ZipCode::MAPPING[
|
7
|
-
return ZipCode::MAPPING[
|
8
|
-
return ZipCode::MAPPING[
|
4
|
+
def self.find province, city, district = ''
|
5
|
+
return '' if ZipCode::MAPPING[province].nil?
|
6
|
+
return '' if ZipCode::MAPPING[province][city].nil?
|
7
|
+
return ZipCode::MAPPING[province][city].first[1] if district.empty?
|
8
|
+
return ZipCode::MAPPING[province][city][district] || ''
|
9
9
|
end
|
10
10
|
end
|
data/zip_code.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Write a short summary, because Rubygems requires one.}
|
13
13
|
spec.description = %q{Write a longer description or delete this line.}
|
14
|
-
spec.homepage = ""
|
14
|
+
spec.homepage = "https://github.com/kevin521024/zip_code"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- keivn
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- lib/zip_code/mapping.rb
|
59
59
|
- lib/zip_code/version.rb
|
60
60
|
- zip_code.gemspec
|
61
|
-
homepage:
|
61
|
+
homepage: https://github.com/kevin521024/zip_code
|
62
62
|
licenses:
|
63
63
|
- MIT
|
64
64
|
metadata:
|