Class: Nominatim::Reverse
Instance Attribute Summary collapse
-
#criteria ⇒ Object
readonly
Returns the value of attribute criteria.
Instance Method Summary collapse
-
#address_details(bool) ⇒ Nominatim::Reverse
Include a breakdown of the address into elements.
-
#fetch ⇒ Object
Returns search result or nil if no results received.
-
#initialize ⇒ Reverse
constructor
A new instance of Reverse.
-
#lat(lat) ⇒ Nominatim::Reverse
Latitude string to search for.
-
#lon(lon) ⇒ Nominatim::Reverse
Longitude string to search for.
Methods inherited from Client
Constructor Details
#initialize ⇒ Reverse
Returns a new instance of Reverse.
5 6 7 |
# File 'lib/nominatim/reverse.rb', line 5 def initialize @criteria = {} end |
Instance Attribute Details
#criteria ⇒ Object (readonly)
Returns the value of attribute criteria.
3 4 5 |
# File 'lib/nominatim/reverse.rb', line 3 def criteria @criteria end |
Instance Method Details
#address_details(bool) ⇒ Nominatim::Reverse
Include a breakdown of the address into elements.
38 39 40 41 |
# File 'lib/nominatim/reverse.rb', line 38 def address_details(bool) @criteria[:addressdetails] = bool ? 1 : 0 self end |
#fetch ⇒ Object
Returns search result or nil if no results received.
10 11 12 13 14 |
# 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) ⇒ Nominatim::Reverse
Latitude string to search for.
20 21 22 23 |
# File 'lib/nominatim/reverse.rb', line 20 def lat(lat) @criteria[:lat] = lat self end |
#lon(lon) ⇒ Nominatim::Reverse
Longitude string to search for.
29 30 31 32 |
# File 'lib/nominatim/reverse.rb', line 29 def lon(lon) @criteria[:lon] = lon self end |