Sha256: b100fe289e438dbf00cb03dbf6c51f3496f9d0222daf095abff3fe26924de8d8

Contents?: true

Size: 413 Bytes

Versions: 1

Compression:

Stored size: 413 Bytes

Contents

require "vatsim_metar/version"
require 'curb'

class String
  def metar
    VatsimMetar.metar(self)
  end
end

module VatsimMetar
  def self.metar(icao)
    # metar = Curl::Easy.perform("http://metar.vatsim.net/#{icao}").body_str
    c = Curl::Easy.new("http://metar.vatsim.net/#{icao}")
    c.timeout = 5
    metar = c.perform.body_str
  rescue Curl::Err::TimeoutError
    metar = "METAR timeout"    
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vatsim_metar-0.2.0 lib/vatsim_metar.rb