Skip to content

Commit

Permalink
Merge pull request #57 from jimmykuo/master
Browse files Browse the repository at this point in the history
Fixed uv uses corrupted URL. include Current UV & Historical UV.
  • Loading branch information
briandowns authored Jul 27, 2017
2 parents 591c7ea + 4a44254 commit 2e58ed2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Gain access to OpenWeatherMap icons and condition codes.
### Data Available in Multiple Measurement Systems

- Fahrenheit (OpenWeatherMap API - imperial)
- Celcius (OpenWeatherMap API - metric)
- Celsius (OpenWeatherMap API - metric)
- Kelvin (OpenWeatherMap API - internal)

### UV Index Data
Expand Down Expand Up @@ -198,7 +198,7 @@ func main() {
}
```

### (Not working yet... OpenweatherMap Working out bugs) Historical UV conditions
### Historical UV conditions

```Go
func main() {
Expand Down
2 changes: 1 addition & 1 deletion openweathermap.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var (
forecastBase = "http://api.openweathermap.org/data/2.5/forecast/daily?appid=%s&%s&mode=json&units=%s&lang=%s&cnt=%d"
historyURL = "http://api.openweathermap.org/data/2.5/history/%s"
pollutionURL = "http://api.openweathermap.org/pollution/v1/co/"
uvURL = "http://api.owm.io/air/1.0/uvi/"
uvURL = "http://api.openweathermap.org/data/2.5/"
dataPostURL = "http://openweathermap.org/data/post"
)

Expand Down
4 changes: 2 additions & 2 deletions uv.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewUV(options ...Option) (*UV, error) {

// Current gets the current UV data for the given coordinates
func (u *UV) Current(coord *Coordinates) error {
response, err := u.client.Get(fmt.Sprintf("%scurrent?lat=%f&lon=%f&appid=%s", uvURL, coord.Latitude, coord.Longitude, u.Key))
response, err := u.client.Get(fmt.Sprintf("%suvi?lat=%f&lon=%f&appid=%s", uvURL, coord.Latitude, coord.Longitude, u.Key))
if err != nil {
return err
}
Expand All @@ -59,7 +59,7 @@ func (u *UV) Current(coord *Coordinates) error {

// Historical gets the historical UV data for the coordinates and times
func (u *UV) Historical(coord *Coordinates, start, end time.Time) error {
response, err := u.client.Get(fmt.Sprintf("%slist?lat=%f&lon=%f&from=%d&to=%d&appid=%s", uvURL, coord.Latitude, coord.Longitude, start, end, u.Key))
response, err := u.client.Get(fmt.Sprintf("%shistory?lat=%f&lon=%f&start=%d&end=%d&appid=%s", uvURL, coord.Latitude, coord.Longitude, start.Unix(), end.Unix(), u.Key))
if err != nil {
return err
}
Expand Down

0 comments on commit 2e58ed2

Please sign in to comment.