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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1774def1c5d0e09a3fb74a4d66b0f2c63c6c18fd97c02871690db6bfdac5c38c
4
- data.tar.gz: 35336afbc96f2517d96b993de9e73501b427843cc649b0b1217d621c7b9be8dc
3
+ metadata.gz: 13b83eaaed19ffb380a72fcbe992cb5c931c3c207103f482cad4b1d2bf743f28
4
+ data.tar.gz: 493b84f0f0270463508257045fd73aad2183646588c3254e25ac42191655a5e8
5
5
  SHA512:
6
- metadata.gz: 0b54fd7e6fb5572e2ae2341f8a6e8049174c3961cda8f4a01e18541f6dfc63cca2e91c4e96fc1a98788f490fcc23ebac33208accdfb55f6f1faa57d07c05f0e4
7
- data.tar.gz: 758cea3008922169f96395ba0540abad5154b224ffbf0b1a4435068db79a9b68031f3e733aa1e2c05189baf7950a4a90556345d9652b819b4b880bded8e84605
6
+ metadata.gz: afbfee51abe17ccdae50e3a32b6b59a351abf036b8abb524a591a99607416205763121ddb366c4703bc61c5e41af048f5364573b284c4cde688711cb8453a4db
7
+ data.tar.gz: 893b3113c9ad50908efccc2c28ad1dd5202f6c0f96d1f174ecad6ff0f2ecc5a157fdb6b638340a1bf594729dd72dab74320d1227f6f5453a5460f318012fba7a
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require:
3
+ plugins:
4
4
  - rubocop-rspec
5
5
 
6
6
  AllCops:
@@ -38,4 +38,4 @@ RSpec/MultipleExpectations:
38
38
  Max: 4
39
39
 
40
40
  RSpec/ExampleLength:
41
- Max: 10 # Adjust this value as needed
41
+ Max: 30 # Adjust this value as needed
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-02-22 02:13:57 UTC using RuboCop version 1.72.2.
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WeatherGovApi
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
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.3.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-02-28 00:00:00.000000000 Z
10
+ date: 2025-03-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: faraday