Class: SemanticCrawler::GeoNames::Country
- Inherits:
-
Object
- Object
- SemanticCrawler::GeoNames::Country
- Defined in:
- lib/semantic_crawler/geo_names/country.rb
Overview
Represents Food and Agriculture information about one country.
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
The input latitude.
-
#longitude ⇒ Object
readonly
The input longitude.
Instance Method Summary collapse
-
#get_country_code ⇒ Object
Returns an ISO 3166-1 alpha-2 country code.
-
#get_country_name ⇒ Object
Returns the name of the country.
-
#get_factbook_country ⇒ SemanticCrawler::Factbook::Country
A Factbook country object.
-
#get_fao_country ⇒ SemanticCrawler::Fao::Country
A Food and Agriculture country object.
-
#get_freebase_country ⇒ SemanticCrawler::Freebase::Country
A Freebase country object.
-
#get_wikipedia_articles ⇒ Object
Returns a Wikipedia object that contains a link to the article, summary and many more fields.
-
#initialize(new_latitude, new_longitude) ⇒ Country
constructor
A new instance of Country.
Constructor Details
#initialize(new_latitude, new_longitude) ⇒ Country
Returns a new instance of Country.
14 15 16 17 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 14 def initialize(new_latitude, new_longitude) @latitude = new_latitude @longitude = new_longitude end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
The input latitude
8 9 10 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 8 def latitude @latitude end |
#longitude ⇒ Object (readonly)
The input longitude
12 13 14 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 12 def longitude @longitude end |
Instance Method Details
#get_country_code ⇒ Object
Returns an ISO 3166-1 alpha-2 country code
20 21 22 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 20 def get_country_code Geonames::WebService.country_code @latitude, @longitude end |
#get_country_name ⇒ Object
Returns the name of the country
25 26 27 28 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 25 def get_country_name subdivision = Geonames::WebService.country_subdivision @latitude, @longitude subdivision.country_name end |
#get_factbook_country ⇒ SemanticCrawler::Factbook::Country
Returns A Factbook country object.
37 38 39 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 37 def get_factbook_country SemanticCrawler::Factbook::Country.new get_country_name end |
#get_fao_country ⇒ SemanticCrawler::Fao::Country
Returns A Food and Agriculture country object.
42 43 44 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 42 def get_fao_country SemanticCrawler::Fao::Country.new get_country_name end |
#get_freebase_country ⇒ SemanticCrawler::Freebase::Country
Returns A Freebase country object.
47 48 49 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 47 def get_freebase_country SemanticCrawler::Freebase::Country.new get_country_name end |
#get_wikipedia_articles ⇒ Object
Returns a Wikipedia object that contains a link to the article, summary and many more fields.
32 33 34 |
# File 'lib/semantic_crawler/geo_names/country.rb', line 32 def get_wikipedia_articles Geonames::WebService.find_nearby_wikipedia :lat => @latitude, :long => @longitude end |