korean_zipcode_finder 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.mkd CHANGED
@@ -1,3 +1,11 @@
1
+ 0.1.3
2
+ =====================
3
+
4
+ * conv to iconv, jruby 호환 https://github.com/bayja/korean_zipcode_finder/issues/2
5
+ * original address에서 산00~00 형식 빼고 address_01에 표시
6
+ * original address에서 서울 성북구 성북동 145-(48~156)와 같은 복잡한 번지수 제거 후 표시
7
+
8
+
1
9
  0.1.2
2
10
  =====================
3
11
 
@@ -15,15 +15,14 @@ module KoreanZipcodeFinder
15
15
  Struct.new("KoreanZipcodeFinder", "zipcode", "zipcode_01", "zipcode_02", "address", "original_address")
16
16
 
17
17
  def self.find_zipcode(dong_name)
18
- iconv = Iconv.new("euc-kr", "utf-8//IGNORE")
19
- keyword = iconv.conv(dong_name.strip)
18
+ keyword = Iconv.new("euc-kr", "utf-8//IGNORE").iconv(dong_name.strip)
20
19
 
21
20
  response = Net::HTTP.post_form URI.parse(Configuration::URL), {'regkey' => api_key, 'target' => 'post', 'query' => keyword}
22
21
  nodes = Nokogiri::XML(response.body).css("item")
23
22
 
24
23
  nodes.map do |node|
25
24
  original_address = node.css("address").text
26
- address = original_address.strip.sub(/\s(\d+)(~?)(\d+)(동|)\z/, "")
25
+ address = original_address.strip.sub(/\s(산|)(\d+)(~?)(\d+)(동|)\z/, "").sub(/\s(\d+)(-?)\((\d+)(~?)(\d+)\)\z/, "")
27
26
  zipcode = node.css("postcd").text
28
27
  zipcode_01 = zipcode[0..2]
29
28
  zipcode_02 = zipcode[-3..-1]
@@ -1,3 +1,3 @@
1
1
  module KoreanZipcodeFinder
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: korean_zipcode_finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-30 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri