-
Notifications
You must be signed in to change notification settings - Fork 42
External services
zverok edited this page Apr 12, 2016
·
2 revisions
Currently, there are 3 external services (except of Wikipedia and Wikidata) mashed into Reality:
- OpenWeatherMap for "current weather" feature;
- GeoNames for "timezone at this coordinates" feature.
- Quandl for "economic indicators" feature.
All of them, unlike Wikipedia/Wikidata API, require free access key for usage. So, in your own code, you'll see something like this:
argentina.capital.coord.weather
# KeyError: Expected keys.open_weather_map to exist in config. It is OpenWeatherMap APPID. Can be obtained here: http://openweathermap.org/appid
argentina.capital.coord.timezone
# KeyError: Expected keys.geonames to exist in config. It is GeoNames username. Can be received from http://www.geonames.org/login
For experiments you can use (but not abuse) Reality demo config, like this:
Reality.configure(:demo)
argentina.capital.coord.weather
# => #<Reality::Weather(21°C, Clear)>
argentina.capital.coord.timezone
# => #<TZInfo::DataTimezone: America/Argentina/Buenos_Aires>
argentina.economy.inflation
# => #<Reality::Measure(16 %)>
For more extensive data usage, you should use Reality#configure
with
your own config (see config/demo.yml
for sample of this).
Note that reality
binary is configured with :demo
by default.
Eventually, Reality, following its pretentious name, plans to interconnect multiple open data sources (all of them!) into easily navigable and usable graph of Ruby objects. Or something like that.
Next (possible) big targets are:
- OpenStreetMap, for things like:
E('Berlin').route_to('Paris').cities.map(&:population)
E('Buenos Aires').street('9 de Julio Avenue').venues.each(&:describe)
- WorldBank data, with Reality being "easy" access point to multiple economic and social indicators;
- Also to consider: Wiktionary, NASA datasets, OpenExchangeRates, ....
- Intro
- Applications
- Links and mentions
- Tutorial:
- Tips & tricks
- Advanced topics
- Molybdenum?..