Class: Naver::Map

Inherits:
Client show all
Defined in:
lib/naver/map.rb

Overview

Naver Map API

Class Method Summary collapse

Methods inherited from Client

#connection, connection, connection=, parse

Class Method Details

.geocode(params = {}) ⇒ Object

주소 -> 좌표 변환

Parameters:

  • params (Hash) (defaults to: {})

    Params for the search


7
8
9
# File 'lib/naver/map.rb', line 7

def geocode(params = {})
  parse(JSON.parse(connection.get("/v1/map/geocode", params).body)["result"]["items"])
end

.reverse_geocode(params = {}) ⇒ Object

좌표 -> 주소 변환

Parameters:

  • params (Hash) (defaults to: {})

    Params for the search


13
14
15
16
# File 'lib/naver/map.rb', line 13

def reverse_geocode(params = {})
  params = { query: "#{params[:lat]}, #{params[:lng]}" }
  parse(JSON.parse(connection.get("/v1/map/reversegeocode", params).body)["result"]["items"])
end