Sha256: fae569fe3da5639ad8a5a4b3cec2b56995c6f510be801a3970a0516e241e33fa

Contents?: true

Size: 780 Bytes

Versions: 8

Compression:

Stored size: 780 Bytes

Contents

module Barometer
  module Query
    module Service
      class WeatherId
        class Api < Utils::Api
          def url
            'http://wxdata.weather.com/wxdata/search/search'
          end

          def params
            { where: format_query }
          end

          def unwrap_nodes
            ['search']
          end

          private

          # filter out words that weather.com has trouble geo-locating
          # mostly these are icao related
          #
          def format_query
            output = query.q.dup
            words_to_remove = %w(international airport municipal)
            words_to_remove.each do |word|
              output.gsub!(/#{word}/i, "")
            end
            output
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
barometer-0.9.7 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.6 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.5 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.4 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.3 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.2 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.1 lib/barometer/query/services/apis/weather_id.rb
barometer-0.9.0 lib/barometer/query/services/apis/weather_id.rb