Module: OpenWeather::SeveralCitiesClassMethods
- Included in:
- Current
- Defined in:
- lib/open_weather/api.rb
Instance Method Summary collapse
-
#circle_zone(lat, lon, count, options = {}) ⇒ Object
Circle zone (lat, lon and count of cities to return) Usage: OpenWeather::Current.circle_zone(55.5, 37.5, 10).
-
#cities(ids, options = {}) ⇒ Object
City Ids, an array of integer values.
-
#rectangle_zone(top_left_lat, top_left_lon, bottom_right_lat, bottom_right_lon, map_zoom, options = {}) ⇒ Object
Bounding box (lat and lon of top left and bottom right points, map zoom) Usage: OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10).
Instance Method Details
#circle_zone(lat, lon, count, options = {}) ⇒ Object
Circle zone (lat, lon and count of cities to return) Usage: OpenWeather::Current.circle_zone(55.5, 37.5, 10)
44 45 46 47 |
# File 'lib/open_weather/api.rb', line 44 def circle_zone(lat, lon, count, = {}) url = 'http://api.openweathermap.org/data/2.5/find' new(.merge(lat: lat, lon: lon, cnt: count)).retrieve url end |
#cities(ids, options = {}) ⇒ Object
City Ids, an array of integer values. Eg, [2172797, 524901] Usage: OpenWeather::Current.cities([2172797, 524901])
25 26 27 28 29 |
# File 'lib/open_weather/api.rb', line 25 def cities(ids, = {}) url = 'http://api.openweathermap.org/data/2.5/group' ids = encode_array ids new(.merge(id: ids)).retrieve url end |
#rectangle_zone(top_left_lat, top_left_lon, bottom_right_lat, bottom_right_lon, map_zoom, options = {}) ⇒ Object
Bounding box (lat and lon of top left and bottom right points, map zoom) Usage: OpenWeather::Current.rectangle_zone(12, 32, 15, 37, 10)
33 34 35 36 37 38 39 40 |
# File 'lib/open_weather/api.rb', line 33 def rectangle_zone(top_left_lat, top_left_lon, bottom_right_lat, bottom_right_lon, map_zoom, = {}) url = 'http://api.openweathermap.org/data/2.5/box/city' bbox = encode_array [top_left_lat, top_left_lon, bottom_right_lat, bottom_right_lon, map_zoom] new(.merge(bbox: bbox)).retrieve url end |