geocoder-olleh 0.4.0 → 0.5.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: 7e596f1a0805cfe1fc9ffad2b98d31693c6205ba
4
- data.tar.gz: 6acdf55e19dffe26ce29d6a342950e8db5ce307c
3
+ metadata.gz: f2154ddf53b0d61be0c86b044d3a896a0c597dcc
4
+ data.tar.gz: ce0c3c8f77e3eeff1ac2dfeaf4f5fe1a9a1854e3
5
5
  SHA512:
6
- metadata.gz: 0a15ff93b1961338481600f3ed5a3ef3000b7a3c9ad0c1bb2162cef2742f32fabd644820e450ad66ed978dee8d6e88e034be776308cc39dc47c05fc5ba69dd53
7
- data.tar.gz: c171b5992c2c78c9bdd5b34e186ce3601f5fe885f231178e1962705ca30cb7f2edddecbf325e0960995d30e0161ecd3dc1248f64f2746b9f0aa263640236fda8
6
+ metadata.gz: d532ae2d59e4b6b3ff055a198be6f514fd69e7fe9329e0c92d8ca9fba468a109cad1265ae0f0eb46b6c2d3e9b5045fcdb5dfd11ee639194edb67d91f382c09f6
7
+ data.tar.gz: b5190f571557579777b4a300a6135204842b8cce73adcc6047892900cddd6228b8c8e31fcfd8cea6d7e7a75321cf881efcc7bfc250dbf5d669afcabc7b226e44
data/README.md CHANGED
@@ -6,7 +6,7 @@ that adds support for Olleh.
6
6
 
7
7
  #### Olleh (`:olleh`)
8
8
 
9
- * **API key**: Basic auth (set `Geocoder.configure(:basic_auth => {:user => app_id, :password => app_key})`)
9
+ * **API key**: API Key
10
10
  * **Quota**: Dependant on service plan
11
11
  * **Region**: South Korea
12
12
  * **SSL support**: no
@@ -7,8 +7,8 @@ require 'geocoder/olleh/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "geocoder-olleh"
9
9
  spec.version = Geocoder::Olleh::VERSION
10
- spec.authors = ["Jaigouk Kim"]
11
- spec.email = ["ping@jaigouk.kim"]
10
+ spec.authors = ["Jaigouk Kim", "Matthew Rudy Jacobs", "Peter Wong"]
11
+ spec.email = ["ping@jaigouk.kim", "matthewrudyjacobs@gmail.com", "luiges90@gmail.com"]
12
12
 
13
13
  spec.summary = %q{geocoding with Olleh map api}
14
14
  spec.description = %q{Provides object geocoding}
@@ -139,9 +139,7 @@ module Geocoder::Lookup
139
139
  def results(query)
140
140
  data = fetch_data(query)
141
141
  return [] unless data
142
- return [] if blank?(data["payload"])
143
- return [] if data["error"]
144
- doc = JSON.parse(URI.decode(data["payload"]))
142
+ doc = data
145
143
  if doc['ERRCD'] != nil && doc['ERRCD'] != 0
146
144
  Geocoder.log(:warn, "Olleh API error: #{doc['ERRCD']} (#{doc['ERRMS'] if doc['ERRMS']}).")
147
145
  return []
@@ -189,23 +187,23 @@ module Geocoder::Lookup
189
187
  end
190
188
 
191
189
  def base_url(query)
192
- host = "#{protocol}://openapi.kt.com"
190
+ host = "#{protocol}://api.ollehmap.com:10082"
193
191
  path =
194
192
  case Olleh.check_query_type(query)
195
193
  when "addr_local_search"
196
- "/maps/search/km2_LocalSearch?params="
194
+ "/ocsp/v2/search/km2_LocalSearch.json?"
197
195
  when "route_search"
198
- "/maps/etc/RouteSearch?params="
196
+ "/giop/rest/etc/RouteSearch.json?"
199
197
  when "reverse_geocoding"
200
- "/maps/geocode/GetAddrByGeocode?params="
198
+ "/giop/rest/geocode/Rgeocode.json?"
201
199
  when "convert_coord"
202
- "/maps/etc/ConvertCoord?params="
200
+ "/giop/rest/etc/ConvertCoord.json?"
203
201
  when "addr_step_search"
204
- "/maps/search/AddrStepSearch?params="
202
+ "/ocsp/v1/search/AddrStepSearch.json?"
205
203
  when "addr_nearest_position_search"
206
- "/maps/search/AddrNearestPosSearch?params="
204
+ "/ocsp/v2/search/km2_AddrNearestPosSearch.json?"
207
205
  else #geocoding
208
- "/maps/geocode/GetGeocodeByAddr?params="
206
+ "/giop/rest/geocode/Geocode.json?"
209
207
  end
210
208
  host + path
211
209
  end
@@ -228,7 +226,7 @@ module Geocoder::Lookup
228
226
  # s: "AN" means it will return old / new style addresses.
229
227
  #
230
228
  hash = {
231
- query: URI.encode(query.text),
229
+ query: query.sanitized_text,
232
230
  option: "1",
233
231
  s: "AN",
234
232
  places: query.options[:places],
@@ -270,36 +268,27 @@ module Geocoder::Lookup
270
268
  }
271
269
  when "addr_nearest_position_search"
272
270
  hash = {
273
- px: query.options[:px],
274
- py: query.options[:py],
275
- radius: query.options[:radius]
271
+ PX: query.options[:px],
272
+ PY: query.options[:py],
273
+ RADIUS: query.options[:radius]
276
274
  }
277
275
  else # geocoding
278
276
  hash = {
279
- addr: URI.encode(query.sanitized_text),
280
- addrcdtype: Olleh.addrcdtype[query.options[:addrcdtype]]
277
+ addr: query.sanitized_text,
278
+ addrcdtype: Olleh.addrcdtype[query.options[:addrcdtype]] || 0
281
279
  }
282
280
  end
283
281
 
284
- hash.merge!(timestamp: now)
285
- JSON.generate(hash)
286
- end
287
-
288
- def now
289
- Time.now.strftime("%Y%m%d%H%M%S%L")
282
+ hash.merge!(key: configuration.api_key)
283
+ hash
290
284
  end
291
285
 
292
286
  def url_query_string(query)
293
- URI.encode(
294
- query_url_params(query)
295
- ).gsub(':','%3A').gsub(',','%2C').gsub('https%3A', 'https:')
287
+ URI.encode_www_form(query_url_params(query))
296
288
  end
297
289
 
298
- ##
299
- # Need to delete timestamp from cache_key to hit cache
300
- #
301
290
  def cache_key(query)
302
- Geocoder.config[:cache_prefix] + query_url(query).split('timestamp')[0]
291
+ Geocoder.config[:cache_prefix] + query_url(query)
303
292
  end
304
293
  end
305
294
  end
@@ -1,5 +1,5 @@
1
1
  module Geocoder
2
2
  module Olleh
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocoder-olleh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaigouk Kim
8
+ - Matthew Rudy Jacobs
9
+ - Peter Wong
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
13
+ date: 2017-05-23 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: geocoder
@@ -55,6 +57,8 @@ dependencies:
55
57
  description: Provides object geocoding
56
58
  email:
57
59
  - ping@jaigouk.kim
60
+ - matthewrudyjacobs@gmail.com
61
+ - luiges90@gmail.com
58
62
  executables: []
59
63
  extensions: []
60
64
  extra_rdoc_files: []
@@ -96,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
100
  version: '0'
97
101
  requirements: []
98
102
  rubyforge_project:
99
- rubygems_version: 2.5.1
103
+ rubygems_version: 2.6.10
100
104
  signing_key:
101
105
  specification_version: 4
102
106
  summary: geocoding with Olleh map api