summaryrefslogtreecommitdiffstats
path: root/nws
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2022-05-15 23:17:46 -0400
committersiddharth <s@ricketyspace.net>2022-05-15 23:17:46 -0400
commit7b13bb91cd786277fdc67a0917cfa0dbd3776df0 (patch)
tree21f8c7f326e199c92457b24b2629aef8933b0da7 /nws
parentcb8506da1b23d50796bf14a16ffe44781bf36e32 (diff)
nws: update NWSPointProperties
ForecastLink -> Forecast ForecastHourlLink -> ForecastHourly
Diffstat (limited to 'nws')
-rw-r--r--nws/nws.go18
-rw-r--r--nws/nws_test.go8
2 files changed, 13 insertions, 13 deletions
diff --git a/nws/nws.go b/nws/nws.go
index 8091842..e58140b 100644
--- a/nws/nws.go
+++ b/nws/nws.go
@@ -13,11 +13,11 @@ import (
)
type NWSPointProperties struct {
- GridId string
- GridX int
- GridY int
- ForecastLink string `json:"forecast"`
- ForecastHourlyLink string `json:"forecastHourly"`
+ GridId string
+ GridX int
+ GridY int
+ Forecast string
+ ForecastHourly string
}
type NWSPoint struct {
@@ -65,11 +65,11 @@ func Points(lat, lng float32) (*NWSPoint, error) {
if err != nil {
return nil, fmt.Errorf("points: json decode: %v", err)
}
- if point.Properties.ForecastLink == "" {
- return nil, fmt.Errorf("points: json: %v", err)
+ if point.Properties.Forecast == "" {
+ return nil, fmt.Errorf("points: json: forecast empty")
}
- if point.Properties.ForecastHourlyLink == "" {
- return nil, fmt.Errorf("points: json: %v", err)
+ if point.Properties.ForecastHourly == "" {
+ return nil, fmt.Errorf("points: json: forecasthourly empty")
}
return point, nil
}
diff --git a/nws/nws_test.go b/nws/nws_test.go
index be1034d..97dd184 100644
--- a/nws/nws_test.go
+++ b/nws/nws_test.go
@@ -11,11 +11,11 @@ func TestPoints(t *testing.T) {
if err != nil {
t.Errorf("points: %v", err)
}
- if np.Properties.ForecastLink != "https://api.weather.gov/gridpoints/CLE/33,42/forecast" {
- t.Errorf("points: forcecast link: '%v'", np.Properties.ForecastLink)
+ if np.Properties.Forecast != "https://api.weather.gov/gridpoints/CLE/33,42/forecast" {
+ t.Errorf("points: forcecast link: '%v'", np.Properties.Forecast)
}
- if np.Properties.ForecastHourlyLink != "https://api.weather.gov/gridpoints/CLE/33,42/forecast/hourly" {
- t.Errorf("points: forcecast link: '%v'", np.Properties.ForecastHourlyLink)
+ if np.Properties.ForecastHourly != "https://api.weather.gov/gridpoints/CLE/33,42/forecast/hourly" {
+ t.Errorf("points: forcecast link: '%v'", np.Properties.ForecastHourly)
}
if np.Properties.GridId != "CLE" {
t.Errorf("points: gridid: %v", np.Properties.GridId)