lib/geonames_api/country.rb in geonames_api-0.0.6 vs lib/geonames_api/country.rb in geonames_api-0.1.0

- old
+ new

@@ -1,10 +1,10 @@ module GeoNamesAPI - class Country < GeoNamesAPI::Object + class Country < ListEndpoint METHOD = "countryInfoJSON" - ID = "country" + FIND_PARAMS = %w(country) EXPORT_BASE_URL = "http://download.geonames.org/export/zip/" EXPORT_HEADERS = %W(country_code postal_code place_name admin_name1 admin_code1 admin_name2 admin_code2 admin_name3 admin_code3 latitude longitude accuracy) def postal_code_export @@ -16,16 +16,16 @@ csv << f.read if f.name =~ /\A#{country_code}/ end end csv end - + def postal_code_csv CSV.parse(postal_code_export, headers: true, col_sep: "\t", header_converters: :symbol, encoding: "ISO8859-1") end - + def postal_code_export_url EXPORT_BASE_URL + country_code + ".zip" end - + end -end \ No newline at end of file +end