Module: MetofficeDatapoint::Api::TextMethods

Included in:
Client
Defined in:
lib/metoffice_datapoint/api/text_methods.rb

Overview

Public: Wrapper class around the Met Office DataPoint API endpoints

Instance Method Summary collapse

Instance Method Details

#mountain_area_capabilitiesObject

Public: Returns the forecast creation dates, valid from and to dates, and the general risk for each mountain area.

Returns a Hash.



85
86
87
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 85

def mountain_area_capabilities
  query('txt/wxfcs/mountainarea/json/capabilities')
end

#mountain_area_forecast(location_id) ⇒ Object

Public: Returns a mountain area forecast covering the four day period after its issue date. API is updated at least once a day but may be updated more often.

location_id - An Integer corresponding to a mountain area.

Returns a Hash.



95
96
97
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 95

def mountain_area_forecast(location_id)
  query("txt/wxfcs/mountainarea/json/#{location_id}")
end

#mountain_area_sitelistObject

Public: Returns a list of locations the mountain area forecast data feed provides data for. You can use this to find the ID of the site that you are interested in.

Returns a Hash.



77
78
79
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 77

def mountain_area_sitelist
  query('txt/wxfcs/mountainarea/json/sitelist')
end

#nationalparks_capabilitiesObject

Public: Returns when the data for each of the National Park forecasts was updated. You can use this to check when the forecasts have updated rather than fetching the National Park forecasts repeatedly.

Returns a Hash.



35
36
37
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 35

def nationalparks_capabilities
  query('txt/wxfcs/nationalpark/json/capabilities')
end

#nationalparks_forecasts(location_id = 'all') ⇒ Object

Public: Returns a text forecast for a National Park. API is updated twice daily, early morning and early afternoon.

Returns a Hash.



43
44
45
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 43

def nationalparks_forecasts(location_id='all')
  query("txt/wxfcs/nationalpark/json/#{location_id}")
end

#nationalparks_sitelistObject

Public: Returns a list of locations the National Park forecast data feed provides data for. You can use this to find the ID of the site that you are interested in.

Returns a Hash.



27
28
29
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 27

def nationalparks_sitelist
  query('txt/wxfcs/nationalpark/json/sitelist')
end

#regional_capabilitiesObject

Public: Returns when the regional forecast was updated. You can use this to check when the forecasts have updated rather than fetching the regional forecasts repeatedly.

Returns a Hash.



59
60
61
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 59

def regional_capabilities
  query('txt/wxfcs/regionalforecast/json/capabilities')
end

#regional_forecast(location_id) ⇒ Object

Public: Returns regional forecast text. API is updated twice daily, AM and PM, normally early morning and early afternoon.

location_id - An Integer corresponding to a region.

Returns a Hash.



69
70
71
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 69

def regional_forecast(location_id)
  query("txt/wxfcs/regionalforecast/json/#{location_id}")
end

#regional_sitelistObject

Public: Returns a list of locations the regional forecast data feed provides data for. You can use this to find the ID of the site that you are interested in.

Returns a Hash.



51
52
53
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 51

def regional_sitelist
  query('txt/wxfcs/regionalforecast/json/sitelist')
end

#ukextremes_latest_observationsObject

Public: Returns the regional observed extremes of weather across the UK for the day of issue. API is updated daily.

Returns a Hash.



19
20
21
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 19

def ukextremes_latest_observations
  query('txt/wxobs/ukextremes/json/latest')
end

#ukextremes_observations_capabilitiesObject

Public: Returns when the regional extremes observations data feed was last updated, and the period it covers.

Returns a Hash.



11
12
13
# File 'lib/metoffice_datapoint/api/text_methods.rb', line 11

def ukextremes_observations_capabilities
  query('txt/wxobs/ukextremes/json/capabilities')
end