open-weather-ruby-client 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +24 -1
- data/lib/open_weather/client.rb +1 -0
- data/lib/open_weather/endpoints/five_day_forecast.rb +12 -0
- data/lib/open_weather/endpoints.rb +1 -0
- data/lib/open_weather/models/forecast/five_day/five_day.rb +24 -0
- data/lib/open_weather/models/forecast/five_day/forecast.rb +35 -0
- data/lib/open_weather/models/forecast/five_day.rb +4 -0
- data/lib/open_weather/models/forecast/thirty_day/forecast.rb +1 -1
- data/lib/open_weather/models/forecast.rb +1 -0
- data/lib/open_weather/models/wind.rb +1 -0
- data/lib/open_weather/version.rb +1 -1
- metadata +25 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ae98694e49ce5daa921935652931c2ef63892907641f17634cab2b16f044283
|
|
4
|
+
data.tar.gz: d318548404776897b45598a4ee1b0bf7c6b2cbda28c39758df96aece5c2c447b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27f5329a0d98d2e5db78bad49e5724b0358827c98478cc83f4e5ddf87e7fefdcd3028e26753402e338f4616c836a05c17aecf4a9d8f05fa211d5f903d606e96c
|
|
7
|
+
data.tar.gz: a5e387ce420b0c24f51e5ba8168e7d8a5c29aaa74543af82565aa320dc0873165e99fb01b2cfb587fc5427544b5ff2dfa6edd0f11bae6ebb44097d698acaaf3f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
### 0.7.0 (8/23/2026)
|
|
2
|
+
|
|
3
|
+
* [#49](https://github.com/dblock/open-weather-ruby-client/pull/49): Migrate Danger to use the `danger-pr-comment` reusable workflow - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent).
|
|
4
|
+
* [#49](https://github.com/dblock/open-weather-ruby-client/pull/49): Upgrade danger-changelog to 0.8.0 and danger-toc to 0.2.0 - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent).
|
|
5
|
+
* [#46](https://github.com/dblock/open-weather-ruby-client/pull/46): Added support for the five day forecast API - [@mgm702](https://github.com/mgm702).
|
|
6
|
+
* [#48](https://github.com/dblock/open-weather-ruby-client/pull/48): Modernized CI: dropped EOL Ruby 2.7/3.0, added Ruby 3.3/3.4 to the test matrix, bumped `actions/checkout` to v7, and fixed the Tests badge link in the README - [@dblock](https://github.com/dblock), [@Copilot](https://github.com/apps/copilot-swe-agent).
|
|
7
|
+
|
|
1
8
|
### 0.6.0 (2024/10/19)
|
|
2
9
|
|
|
3
10
|
* [#40](https://github.com/dblock/open-weather-ruby-client/pull/40): Fixing rubocop violations and improved .rubocop.yml - [@troya2](https://github.com/troya2).
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@ OpenWeather Ruby Client
|
|
|
2
2
|
=======================
|
|
3
3
|
|
|
4
4
|
[](https://badge.fury.io/rb/open-weather-ruby-client)
|
|
5
|
-
[](https://github.com/dblock/open-weather-ruby-client/actions)
|
|
5
|
+
[](https://github.com/dblock/open-weather-ruby-client/actions/workflows/test.yml)
|
|
6
6
|
|
|
7
7
|
A Ruby client for the [OpenWeather API v2.5 and v3.0](https://openweathermap.org/api).
|
|
8
8
|
|
|
@@ -22,6 +22,7 @@ Unlike other clients, including [open-weather](https://github.com/coderhs/ruby_o
|
|
|
22
22
|
- [Historical Weather](#historical-weather)
|
|
23
23
|
- [Hourly Forecast (Pro)](#hourly-forecast-pro)
|
|
24
24
|
- [30 Day Forecast (Pro)](#30-day-forecast-pro)
|
|
25
|
+
- [5 Day Forecast](#5-day-forecast)
|
|
25
26
|
- [Stations](#stations)
|
|
26
27
|
- [Register a Station](#register-a-station)
|
|
27
28
|
- [List Stations](#list-stations)
|
|
@@ -266,6 +267,28 @@ data.list.first.rain # => double or nil - Precipitation volume, mm. Please note
|
|
|
266
267
|
data.list.first.snow # => double or nil - Snow volume, mm. Please note that only mm as units of measurement are available for this parameter
|
|
267
268
|
```
|
|
268
269
|
|
|
270
|
+
### 5 Day Forecast
|
|
271
|
+
|
|
272
|
+
The [5 Day Forecast API](https://openweathermap.org/forecast5) provides weather forecast for 5 days with data every 3 hours by geographic coordinates.
|
|
273
|
+
|
|
274
|
+
```ruby
|
|
275
|
+
data = client.client.five_day_forecast(lat: 33.5312, lon: -111.9426, appid: "<your api key>") # => OpenWeather::Models::Forecast::FiveDay
|
|
276
|
+
|
|
277
|
+
data.cnt # => 40 (number of entries)
|
|
278
|
+
data.list.first # => OpenWeather::Models::Forecast::FiveDay::Forecast
|
|
279
|
+
data.list.first.dt # => Time
|
|
280
|
+
data.list.first.main # => OpenWeather::Models::Main
|
|
281
|
+
data.list.first.weather # => Array[OpenWeather::Models::Weather]
|
|
282
|
+
data.list.first.clouds # => OpenWeather::Models::Clouds or nil
|
|
283
|
+
data.list.first.wind # => OpenWeather::Models::Wind or nil
|
|
284
|
+
data.list.first.visibility # => 10000
|
|
285
|
+
data.list.first.pop # => 0.1 (probability of precipitation from 0.0 to 1.0 (0% to 100%))
|
|
286
|
+
data.list.first.rain # => OpenWeather::Models::Rain or nil
|
|
287
|
+
data.list.first.snow # => OpenWeather::Models::Snow or nil
|
|
288
|
+
data.list.first.sys # => OpenWeather::Models::Sys or nil
|
|
289
|
+
data.list.first.dt_txt # => String (Time of data forecasted, ISO, UTC)
|
|
290
|
+
```
|
|
291
|
+
|
|
269
292
|
### Stations
|
|
270
293
|
|
|
271
294
|
The [Stations API](https://openweathermap.org/stations) lets your manage personal weather stations and measurements.
|
data/lib/open_weather/client.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenWeather
|
|
4
|
+
module Endpoints
|
|
5
|
+
module FiveDayForecast
|
|
6
|
+
def five_day_forecast(lat, lon = nil, options = {})
|
|
7
|
+
options = lat.is_a?(Hash) ? options.merge(lat) : options.merge(lat: lat, lon: lon)
|
|
8
|
+
OpenWeather::Models::Forecast::FiveDay::FiveDay.new(get('2.5/forecast', options), options)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenWeather
|
|
4
|
+
module Models
|
|
5
|
+
module Forecast
|
|
6
|
+
module FiveDay
|
|
7
|
+
class FiveDay < Model
|
|
8
|
+
include Enumerable
|
|
9
|
+
|
|
10
|
+
property 'cod'
|
|
11
|
+
property 'message'
|
|
12
|
+
property 'cnt'
|
|
13
|
+
property 'list'
|
|
14
|
+
|
|
15
|
+
def initialize(args = nil, options = {})
|
|
16
|
+
super args, options
|
|
17
|
+
|
|
18
|
+
self.list = list.map { |forecast| Forecast.new(forecast, options) } if list
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenWeather
|
|
4
|
+
module Models
|
|
5
|
+
module Forecast
|
|
6
|
+
module FiveDay
|
|
7
|
+
class Forecast < Model
|
|
8
|
+
property 'dt', transform_with: ->(v) { Time.at(v).utc } # time of data forcasted, UTC
|
|
9
|
+
property 'main' # Main weather data
|
|
10
|
+
property 'weather' # Array of OpenWeather::Models::Weather
|
|
11
|
+
property 'clouds' # Cloudiness data
|
|
12
|
+
property 'wind' # Wind data
|
|
13
|
+
property 'visibility' # Visibility, meter
|
|
14
|
+
property 'pop' # Probability of precipitation
|
|
15
|
+
property 'rain' # Rain data
|
|
16
|
+
property 'snow' # Snow data
|
|
17
|
+
property 'sys' # System data
|
|
18
|
+
property 'dt_txt' # Date and time of calculation, UTC
|
|
19
|
+
|
|
20
|
+
def initialize(args = nil, options = {})
|
|
21
|
+
super args, options
|
|
22
|
+
|
|
23
|
+
self.main = OpenWeather::Models::Main.new(main, options) if main
|
|
24
|
+
self.weather = weather.map { |w| OpenWeather::Models::Weather.new(w, options) } if weather
|
|
25
|
+
self.clouds = OpenWeather::Models::Clouds.new(clouds, options) if clouds
|
|
26
|
+
self.wind = OpenWeather::Models::Wind.new(wind, options) if wind
|
|
27
|
+
self.rain = OpenWeather::Models::Rain.new(rain, options) if rain
|
|
28
|
+
self.snow = OpenWeather::Models::Snow.new(snow, options) if snow
|
|
29
|
+
self.sys = OpenWeather::Models::Sys.new(sys, options) if sys
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -8,7 +8,7 @@ module OpenWeather
|
|
|
8
8
|
property 'dt', transform_with: ->(v) { Time.at(v).utc } # time of data forcasted, UTC
|
|
9
9
|
property 'sunrise', transform_with: ->(v) { Time.at(v).utc } # Sunrise time, UTC
|
|
10
10
|
property 'sunset', transform_with: ->(v) { Time.at(v).utc } # Sunset time, UTC
|
|
11
|
-
property 'temp' # Array of OpenWeather::Models::Forecast::
|
|
11
|
+
property 'temp' # Array of OpenWeather::Models::Forecast::ThirtyDay::Temp
|
|
12
12
|
property 'feels_like' # OpenWeather::Models::OneCall::FeelsLike
|
|
13
13
|
property 'pressure' # Atmospheric pressure on the sea level, hPa
|
|
14
14
|
property 'humidity' # Humidity, % (e.g. integer 24 means 24% cloudiness)
|
data/lib/open_weather/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: open-weather-ruby-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Doubrovkine
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -72,28 +71,42 @@ dependencies:
|
|
|
72
71
|
requirements:
|
|
73
72
|
- - "~>"
|
|
74
73
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 0.
|
|
74
|
+
version: 0.8.0
|
|
76
75
|
type: :development
|
|
77
76
|
prerelease: false
|
|
78
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
78
|
requirements:
|
|
80
79
|
- - "~>"
|
|
81
80
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 0.
|
|
81
|
+
version: 0.8.0
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: danger-pr-comment
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
83
96
|
- !ruby/object:Gem::Dependency
|
|
84
97
|
name: danger-toc
|
|
85
98
|
requirement: !ruby/object:Gem::Requirement
|
|
86
99
|
requirements:
|
|
87
100
|
- - "~>"
|
|
88
101
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0.
|
|
102
|
+
version: 0.2.0
|
|
90
103
|
type: :development
|
|
91
104
|
prerelease: false
|
|
92
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
106
|
requirements:
|
|
94
107
|
- - "~>"
|
|
95
108
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0.
|
|
109
|
+
version: 0.2.0
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
|
98
111
|
name: dotenv
|
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -192,7 +205,6 @@ dependencies:
|
|
|
192
205
|
- - ">="
|
|
193
206
|
- !ruby/object:Gem::Version
|
|
194
207
|
version: '0'
|
|
195
|
-
description:
|
|
196
208
|
email: dblock@dblock.org
|
|
197
209
|
executables: []
|
|
198
210
|
extensions: []
|
|
@@ -207,6 +219,7 @@ files:
|
|
|
207
219
|
- lib/open_weather/connection.rb
|
|
208
220
|
- lib/open_weather/endpoints.rb
|
|
209
221
|
- lib/open_weather/endpoints/current.rb
|
|
222
|
+
- lib/open_weather/endpoints/five_day_forecast.rb
|
|
210
223
|
- lib/open_weather/endpoints/hourly.rb
|
|
211
224
|
- lib/open_weather/endpoints/one_call.rb
|
|
212
225
|
- lib/open_weather/endpoints/stations.rb
|
|
@@ -221,6 +234,9 @@ files:
|
|
|
221
234
|
- lib/open_weather/models/coord.rb
|
|
222
235
|
- lib/open_weather/models/forecast.rb
|
|
223
236
|
- lib/open_weather/models/forecast/city.rb
|
|
237
|
+
- lib/open_weather/models/forecast/five_day.rb
|
|
238
|
+
- lib/open_weather/models/forecast/five_day/five_day.rb
|
|
239
|
+
- lib/open_weather/models/forecast/five_day/forecast.rb
|
|
224
240
|
- lib/open_weather/models/forecast/forecast.rb
|
|
225
241
|
- lib/open_weather/models/forecast/hourly.rb
|
|
226
242
|
- lib/open_weather/models/forecast/thirty_day.rb
|
|
@@ -260,7 +276,6 @@ homepage: http://github.com/dblock/open-weather-ruby-client
|
|
|
260
276
|
licenses:
|
|
261
277
|
- MIT
|
|
262
278
|
metadata: {}
|
|
263
|
-
post_install_message:
|
|
264
279
|
rdoc_options: []
|
|
265
280
|
require_paths:
|
|
266
281
|
- lib
|
|
@@ -275,8 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
275
290
|
- !ruby/object:Gem::Version
|
|
276
291
|
version: 1.3.6
|
|
277
292
|
requirements: []
|
|
278
|
-
rubygems_version:
|
|
279
|
-
signing_key:
|
|
293
|
+
rubygems_version: 4.0.16
|
|
280
294
|
specification_version: 4
|
|
281
295
|
summary: OpenWeather API Ruby client.
|
|
282
296
|
test_files: []
|