Class: WeatherForecasts::Client::SelectHourlyQuery

Inherits:
Query
  • Object
show all
Includes:
QueryUtilities
Defined in:
lib/weather_forecasts/client/query/select_hourly_query.rb

Constant Summary collapse

ENDPOINT =
'http://forecast.weather.gov/MapClick.php'

Constants inherited from Query

Query::FORECAST_ELEMENTS

Instance Attribute Summary

Attributes inherited from Query

#conditions, #select_attributes, #soap_client

Instance Method Summary collapse

Methods included from QueryUtilities

#build_coordinates, #transform_coordinate_list

Methods inherited from Query

#initialize, properties, property, selection_attributes, set_selection_attributes, #validate, #where

Constructor Details

This class inherits a constructor from WeatherForecasts::Client::Query

Instance Method Details

#build_messageObject



24
25
26
27
28
29
30
# File 'lib/weather_forecasts/client/query/select_hourly_query.rb', line 24

def build_message
  {
    :lat => conditions[:latitude],
    :lon => conditions[:longitude],
    :FcstType => 'digitalDWML'
  }
end

#executeObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/weather_forecasts/client/query/select_hourly_query.rb', line 13

def execute
  validate

  request = HTTPI::Request.new
  request.url = ENDPOINT
  request.query = build_message

  document = HTTPI.get(request)
  DWML.new( Nokogiri::XML(document.body) ).process
end