geocoder-olleh 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3106f1f1023396f24cf1c43863d6f46fdba421f
4
- data.tar.gz: 0b038e9aeafe6c6b74688dce24076a624ddaf751
3
+ metadata.gz: ed52247a3bb4d999c891c3338c437a9957f1e1a0
4
+ data.tar.gz: 64f9a1d5615bfdb20bb2ebee3e58c3186cb4576b
5
5
  SHA512:
6
- metadata.gz: 7b403277915f10c6603088afd8ee4c7c881b3dccce670217c2bb37555786d0d857949540de44e29e06bf42a43eed4a2dd0ce0fe354385b87642d270e8ae714d7
7
- data.tar.gz: 88b31eab6433c41eaed3d03c4d31468e9c2607b84496fe024d793d188a2d5c7c4ccca9c3ea4ccfb2eea714cd1edfecdc0304fefa59a4371a7812154c0b0c4d14
6
+ metadata.gz: bfb5a48b1600df4f4ddcd1d0e0bd530ff61b33fa2c860f02548f7e991bfdeb6a3eedd607da212271161bdfde3e5c8ef813815623e6118c6f6cbbb2985689f18a
7
+ data.tar.gz: 777e017630613477530ed7190e263fe9458d4805fb717422eebfdbf62f5baa006e8383b7c99082fc5c976044772119ce8c290af219d414a67609e7e128cfe049
data/Gemfile CHANGED
@@ -3,12 +3,14 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in geocoder-olleh.gemspec
4
4
  gem 'geocoder'
5
5
  group :development, :test do
6
- gem 'test-unit' # needed for Ruby >=2.2.0
6
+ gem 'test-unit' # needed for Ruby >=2.2.0
7
7
  gem 'guard'
8
8
  gem 'guard-test'
9
9
  gem 'coveralls'
10
10
  gem 'pry'
11
11
  gem 'pry-remote'
12
12
  gem 'pry-nav'
13
+ gem 'vcr'
14
+ gem 'webmock'
13
15
  end
14
16
  gemspec
@@ -100,21 +100,27 @@ module Geocoder::Lookup
100
100
  end
101
101
 
102
102
  def self.check_query_type(query)
103
- if !query.options.empty? && query.options.include?(:priority)
104
- query.options[:query_type] || query.options[:query_type] = "route_search"
105
- elsif query.reverse_geocode? && query.options.include?(:include_jibun)
106
- query.options[:query_type] || query.options[:query_type] = "reverse_geocoding"
107
- elsif !query.options.empty? && query.options.include?(:coord_in)
108
- query.options[:query_type] || query.options[:query_type] = "convert_coord"
109
- elsif !query.options.empty? && query.options.include?(:l_code)
110
- query.options[:query_type] || query.options[:query_type] = "addr_step_search"
111
- elsif !query.options.empty? && query.options.include?(:radius)
112
- query.options[:query_type] || query.options[:query_type] = "addr_nearest_position_search"
103
+
104
+ options = query.options
105
+ return options[:query_type] if options[:query_type]
106
+
107
+ query_type = case
108
+ when options.include?(:priority)
109
+ 'route_search'
110
+ when query.reverse_geocode? && options.include?(:include_jibun)
111
+ 'reverse_geocoding'
112
+ when options.include?(:coord_in)
113
+ 'convert_coord'
114
+ when options.include?(:l_code)
115
+ 'addr_step_search'
116
+ when options.include?(:radius)
117
+ 'addr_nearest_position_search'
113
118
  else
114
- query.options[:query_type] || query.options[:query_type] = "geocoding"
119
+ 'geocoding'
115
120
  end
116
- end
117
121
 
122
+ options[:query_type] = query_type
123
+ end
118
124
 
119
125
  private # ----------------------------------------------
120
126
 
@@ -129,7 +135,10 @@ module Geocoder::Lookup
129
135
  end
130
136
 
131
137
  case Olleh.check_query_type(query)
132
- when "geocoding" || "reverse_geocoding"
138
+ when "geocoding"
139
+ return [] if doc['RESDATA']['COUNT'] == 0
140
+ return doc['RESDATA']["ADDRS"]
141
+ when "reverse_geocoding"
133
142
  return [] if doc['RESDATA']['COUNT'] == 0
134
143
  return doc['RESDATA']["ADDRS"]
135
144
  when "route_search"
@@ -158,12 +167,11 @@ module Geocoder::Lookup
158
167
  "https://openapi.kt.com/maps/search/AddrStepSearch?params="
159
168
  when "addr_nearest_position_search"
160
169
  "https://openapi.kt.com/maps/search/AddrNearestPosSearch?params="
161
- else
170
+ else #geocoding
162
171
  "https://openapi.kt.com/maps/geocode/GetGeocodeByAddr?params="
163
172
  end
164
173
  end
165
174
 
166
-
167
175
  def query_url_params(query)
168
176
  case Olleh.check_query_type(query)
169
177
  when "route_search"
@@ -238,4 +246,4 @@ module Geocoder::Lookup
238
246
  Geocoder.config[:cache_prefix] + query_url(query).split('timestamp')[0]
239
247
  end
240
248
  end
241
- end
249
+ end
@@ -1,5 +1,5 @@
1
1
  module Geocoder
2
2
  module Olleh
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocoder-olleh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaigouk Kim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-12 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler