Sha256: 920876c205b6ab8cb848ac24a12fe766b8185460f87afedf411ebeb6420a6d4d

Contents?: true

Size: 451 Bytes

Versions: 7

Compression:

Stored size: 451 Bytes

Contents

module GeoNamesAPI
  class NearbyPostalCode < ListEndpoint

    #radius in km
    METHOD = "findNearbyPostalCodesJSON"
    FIND_PARAMS = %w(postalcode country radius maxRows)

    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
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
geonames_api-0.1.6 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.5 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.4 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.3 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.2 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.1 lib/geonames_api/nearby_postal_code.rb
geonames_api-0.1.0 lib/geonames_api/nearby_postal_code.rb