Class: GeoNamesAPI::PostalCode

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

Constant Summary collapse

METHOD =
"postalCodeLookupJSON"
FIND_PARAMS =
%w(postalcode country)

Instance Attribute Summary

Attributes inherited from Entity

#request_params

Instance 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

Instance Method Details

#cityObject



7
8
9
# File 'lib/geonames_api/postal_code.rb', line 7

def city
  place_name
end

#nearby_codes(radius = 10, maxRows = 5) ⇒ Object



19
20
21
# File 'lib/geonames_api/postal_code.rb', line 19

def nearby_codes(radius=10, maxRows=5)
  NearbyPostalCode.all(postalcode, country_code, radius, maxRows)
end

#stateObject



11
12
13
# File 'lib/geonames_api/postal_code.rb', line 11

def state
  admin_name1
end

#state_shortObject



15
16
17
# File 'lib/geonames_api/postal_code.rb', line 15

def state_short
  admin_code1
end