class SemanticCrawler::GeoNames::Country

Represents Food and Agriculture information about one country.

Attributes

latitude[R]

@attribute [r] The input latitude

longitude[R]

@attribute [r] The input longitude

Public Class Methods

new(new_latitude, new_longitude) click to toggle source
# File lib/semantic_crawler/geo_names/country.rb, line 14
def initialize(new_latitude, new_longitude)
    @latitude = new_latitude
    @longitude = new_longitude
end

Public Instance Methods

get_country_code() click to toggle source

Returns an ISO 3166-1 alpha-2 country code

# File lib/semantic_crawler/geo_names/country.rb, line 20
def get_country_code
    Geonames::WebService.country_code @latitude, @longitude
end
get_country_name() click to toggle source

Returns the name of the country

# 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() click to toggle source

@return [SemanticCrawler::Factbook::Country] A Factbook country object

# 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() click to toggle source

@return [SemanticCrawler::Fao::Country] A Food and Agriculture country object

# 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() click to toggle source

@return [SemanticCrawler::Freebase::Country] A Freebase country object

# 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() click to toggle source

Returns a Wikipedia object that contains a link to the article, summary and many more fields.

# File lib/semantic_crawler/geo_names/country.rb, line 32
def get_wikipedia_articles
    Geonames::WebService.find_nearby_wikipedia :lat => @latitude, :long => @longitude
end