class Nominatim::Reverse

Attributes

criteria[R]

Public Class Methods

new() click to toggle source
# File lib/nominatim/reverse.rb, line 5
def initialize
  @criteria = {}
end

Public Instance Methods

address_details(bool) click to toggle source

Include a breakdown of the address into elements.

@param bool [true, false] @return [Nominatim::Reverse]

# File lib/nominatim/reverse.rb, line 38
def address_details(bool)
  @criteria[:addressdetails] = bool ? 1 : 0
  self
end
fetch() click to toggle source

Returns search result or nil if no results received.

# File lib/nominatim/reverse.rb, line 10
def fetch
  body = get(Nominatim.config.reverse_url, @criteria).body
  return nil if body.empty?
  Nominatim::Place.new(body)
end
lat(lat) click to toggle source

Latitude string to search for.

@param lat [String] Latitude @return [Nominatim::Reverse]

# File lib/nominatim/reverse.rb, line 20
def lat(lat)
  @criteria[:lat] = lat
  self
end
lon(lon) click to toggle source

Longitude string to search for.

@param lon [String] Longitude @return [Nominatim::Reverse]

# File lib/nominatim/reverse.rb, line 29
def lon(lon)
  @criteria[:lon] = lon
  self
end