Sha256: 163026a471666dcfac09fcea2c087147885b1564eeea245ec94be517250c6442
Contents?: true
Size: 852 Bytes
Versions: 3
Compression:
Stored size: 852 Bytes
Contents
module Reality using Refinements module DataSources class Worldbank def get(id) if id.include?(':') iso, indicator = id.split(':') internal.countries[iso].indicator(indicator)['data'].first(3) else internal.countries[id].get['data'].first.tap(&m(:post_process)).merge(indicators_for(id)) end end private def internal @internal ||= API.new end def post_process(row) row['coord'] = Geo::Coord.new(row.delete('latitude'), row.delete('longitude')) end def indicators_for(iso) indicators.map { |i| "#<Link[#{iso}:#{i}]>" } end def indicators pp internal.dictionaries.indicators.list['data']['id'] exit #@indicators ||= end end end end require_relative 'worldbank/api'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reality-0.1.0.alpha3 | lib/reality/describers/worldbank.rb |
reality-0.1.0.alpha2 | lib/reality/describers/worldbank.rb |
reality-0.1.0.alpha | lib/reality/describers/worldbank.rb |