Sha256: 78ad765d022f6b099c6fb19ae8aa8f7477a942a7256692153687777f2b4ac011

Contents?: true

Size: 398 Bytes

Versions: 2

Compression:

Stored size: 398 Bytes

Contents

class FetchIndicator
  def initialize(indicator)
    @indicator = indicator
  end

  def todo(country)
    id = country["id"]
    http = EventMachine::HttpRequest.new(indicator_url(id), :connect_timeout => 2, :inactivity_timeout => 3)
    http.get
  end

  private
  def indicator_url(country_id)
    "http://api.worldbank.org/countries/#{country_id}/indicators/#@indicator?format=json" 
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-dextras-0.4.0 doc/samples/worldbank/fetch_indicator.rb
em-dextras-0.3.0 doc/samples/worldbank/fetch_indicator.rb