Class: GeoNamesAPI::Country
- Inherits:
-
ListEndpoint
- Object
- Entity
- Base
- ListEndpoint
- GeoNamesAPI::Country
- Defined in:
- lib/geonames_api/country.rb
Constant Summary collapse
- METHOD =
"countryInfoJSON"
- 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)
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
Methods inherited from ListEndpoint
endpoint_returns_list?, #next_page, #to_page
Methods inherited from Base
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
#postal_code_csv ⇒ Object
18 19 20 |
# File 'lib/geonames_api/country.rb', line 18 def postal_code_csv CSV.parse(postal_code_export, headers: true, col_sep: "\t", header_converters: :symbol, encoding: "ISO8859-1") end |
#postal_code_export ⇒ Object
12 13 14 15 16 |
# File 'lib/geonames_api/country.rb', line 12 def postal_code_export download_archive extract_file create_csv end |