geocoder-olleh 0.4.0 → 0.5.0
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 +1 -1
- data/geocoder-olleh.gemspec +2 -2
- data/lib/geocoder/lookups/olleh.rb +19 -30
- data/lib/geocoder/olleh/version.rb +1 -1
- metadata +7 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f2154ddf53b0d61be0c86b044d3a896a0c597dcc
         | 
| 4 | 
            +
              data.tar.gz: ce0c3c8f77e3eeff1ac2dfeaf4f5fe1a9a1854e3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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**:  | 
| 9 | 
            +
            * **API key**: API Key
         | 
| 10 10 | 
             
            * **Quota**: Dependant on service plan
         | 
| 11 11 | 
             
            * **Region**: South Korea
         | 
| 12 12 | 
             
            * **SSL support**: no
         | 
    
        data/geocoder-olleh.gemspec
    CHANGED
    
    | @@ -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 | 
            -
                   | 
| 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}:// | 
| 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 | 
            -
                      "/ | 
| 194 | 
            +
                      "/ocsp/v2/search/km2_LocalSearch.json?"
         | 
| 197 195 | 
             
                    when "route_search"
         | 
| 198 | 
            -
                      "/ | 
| 196 | 
            +
                      "/giop/rest/etc/RouteSearch.json?"
         | 
| 199 197 | 
             
                    when "reverse_geocoding"
         | 
| 200 | 
            -
                      "/ | 
| 198 | 
            +
                      "/giop/rest/geocode/Rgeocode.json?"
         | 
| 201 199 | 
             
                    when "convert_coord"
         | 
| 202 | 
            -
                      "/ | 
| 200 | 
            +
                      "/giop/rest/etc/ConvertCoord.json?"
         | 
| 203 201 | 
             
                    when "addr_step_search"
         | 
| 204 | 
            -
                      "/ | 
| 202 | 
            +
                      "/ocsp/v1/search/AddrStepSearch.json?"
         | 
| 205 203 | 
             
                    when "addr_nearest_position_search"
         | 
| 206 | 
            -
                      "/ | 
| 204 | 
            +
                      "/ocsp/v2/search/km2_AddrNearestPosSearch.json?"
         | 
| 207 205 | 
             
                    else #geocoding
         | 
| 208 | 
            -
                      "/ | 
| 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:  | 
| 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 | 
            -
                       | 
| 274 | 
            -
                       | 
| 275 | 
            -
                       | 
| 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:  | 
| 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!( | 
| 285 | 
            -
                   | 
| 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. | 
| 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) | 
| 291 | 
            +
                  Geocoder.config[:cache_prefix] + query_url(query)
         | 
| 303 292 | 
             
                end
         | 
| 304 293 | 
             
              end
         | 
| 305 294 | 
             
            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 | 
            +
              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:  | 
| 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. | 
| 103 | 
            +
            rubygems_version: 2.6.10
         | 
| 100 104 | 
             
            signing_key: 
         | 
| 101 105 | 
             
            specification_version: 4
         | 
| 102 106 | 
             
            summary: geocoding with Olleh map api
         |