Class: GeoNamesAPI::NearbyPostalCode

Inherits:
ListEndpoint show all
Defined in:
lib/geonames_api/nearby_postal_code.rb

Constant Summary collapse

METHOD =

radius in km

"findNearbyPostalCodesJSON"
FIND_PARAMS =
%w(postalcode country radius maxRows)

Instance Attribute Summary

Attributes inherited from Entity

#request_params

Class Method Summary collapse

Methods inherited from ListEndpoint

endpoint_returns_list?, #next_page, #to_page

Methods inherited from Base

all, find, where

Methods inherited from Entity

#create_attribute, #initialize, #marshal_dump, #marshal_load, #parse_attr, #parse_response, #set_default_type

Constructor Details

This class inherits a constructor from GeoNamesAPI::Entity

Class Method Details

.find_all_by_lat_lng(lat, lng, radius = 10, maxRows = 5) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/geonames_api/nearby_postal_code.rb', line 8

def self.find_all_by_lat_lng(lat, lng, radius=10, maxRows=5)
  where({
    'lat' => lat,
    'lng' => lng,
    'radius' => radius,
    'maxRows' => maxRows
  }).collect { |response| PostalCode.new(response) if response }.compact
end