weather_gov_api 0.3.0 → 0.4.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/.rubocop.yml +2 -2
- data/.rubocop_todo.yml +11 -1
- data/README.md +3 -2
- data/lib/weather_gov_api/client.rb +13 -0
- data/lib/weather_gov_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13b83eaaed19ffb380a72fcbe992cb5c931c3c207103f482cad4b1d2bf743f28
|
4
|
+
data.tar.gz: 493b84f0f0270463508257045fd73aad2183646588c3254e25ac42191655a5e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afbfee51abe17ccdae50e3a32b6b59a351abf036b8abb524a591a99607416205763121ddb366c4703bc61c5e41af048f5364573b284c4cde688711cb8453a4db
|
7
|
+
data.tar.gz: 893b3113c9ad50908efccc2c28ad1dd5202f6c0f96d1f174ecad6ff0f2ecc5a157fdb6b638340a1bf594729dd72dab74320d1227f6f5453a5460f318012fba7a
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2025-
|
3
|
+
# on 2025-03-17 20:00:04 UTC using RuboCop version 1.72.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 7
|
10
|
+
# Configuration parameters: Max, CountAsOne.
|
11
|
+
RSpec/ExampleLength:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/weather_gov_api/client_spec.rb'
|
14
|
+
|
15
|
+
# Offense count: 2
|
16
|
+
# Configuration parameters: AllowSubject.
|
17
|
+
RSpec/MultipleMemoizedHelpers:
|
18
|
+
Max: 7
|
data/README.md
CHANGED
@@ -39,6 +39,8 @@ Fetches a list of nearby weather observation stations.
|
|
39
39
|
### current_weather(latitude:, longitude:)
|
40
40
|
Fetches the current weather conditions from the closest observation station.
|
41
41
|
|
42
|
+
### forecast(latitude:, longitude:)
|
43
|
+
Fetches the seven day forecast which will include a daytieme and nightime forecast.
|
42
44
|
|
43
45
|
## Development
|
44
46
|
|
@@ -68,13 +70,12 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Jeffre
|
|
68
70
|
|
69
71
|
## TODO
|
70
72
|
|
71
|
-
- [ ] Implement forecast retrieval functionality
|
72
73
|
- [ ] Add validation to limit latitude and longitude to 4 decimal places (weather.gov API requirement)
|
73
|
-
- [ ] Improve error handling to properly surface weather.gov API error messages
|
74
74
|
- [ ] Implement rate limiting strategies:
|
75
75
|
- [ ] Local rate limiting
|
76
76
|
- [ ] Distributed rate limiting (Redis/DB-based)
|
77
77
|
- [ ] Add caching support for API responses
|
78
|
+
- [ ] Memoize calls that might happen more than once (like points)
|
78
79
|
- [ ] Automate CHANGELOG.md updates during release process
|
79
80
|
|
80
81
|
## License
|
@@ -49,6 +49,19 @@ module WeatherGovApi
|
|
49
49
|
raise WeatherGovApi::ApiError.new(message: "API request failed: #{e.message}")
|
50
50
|
end
|
51
51
|
|
52
|
+
def forecast(latitude:, longitude:)
|
53
|
+
grid_data = points(latitude: latitude, longitude: longitude).data["properties"]
|
54
|
+
grid_id = grid_data["gridId"]
|
55
|
+
grid_x = grid_data["gridX"]
|
56
|
+
grid_y = grid_data["gridY"]
|
57
|
+
|
58
|
+
response = connection.get("/gridpoints/#{grid_id}/#{grid_x},#{grid_y}/forecast")
|
59
|
+
raise_api_error(response) unless response.success?
|
60
|
+
Response.new(response)
|
61
|
+
rescue Faraday::Error => e
|
62
|
+
raise WeatherGovApi::ApiError.new(message: "API request failed: #{e.message}")
|
63
|
+
end
|
64
|
+
|
52
65
|
private
|
53
66
|
|
54
67
|
def observation_stations_path(url)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weather_gov_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JeffreyMPrice
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-23 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: faraday
|