Skip to content

Commit

Permalink
Merge pull request #45 from observerly/feature/routes/GetTwilight
Browse files Browse the repository at this point in the history
feat: Added GetTwilight(c *gin.Context) version 2.0.0.
  • Loading branch information
michealroberts authored Mar 2, 2023
2 parents 212d13a + 83b5aef commit 00f0873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ func main() {
// Transit Properties API
r.GET("/api/v1/transit", transit.GetTransitDeprecatedV1)

// Transit Properties API version 2 (^14.02.2023):
// Transit Properties API version 2 (^02.03.2023):
r.GET("/api/v2/transit", transit.GetTransit)

// Twilight (Crepusculum) Properties API
r.GET("/api/v1/twilight", twilight.GetTwilight)

// Twilight (Crepusculum) Properties API version 2 (^02.03.2023):
r.GET("/api/v2/twilight", twilight.GetTwilight)

// Listen on port
log.Fatal(r.Run(*port))
}
4 changes: 2 additions & 2 deletions pkg/twilight/twilight_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func SetupTwilightRouter() *gin.Engine {
// Create gin router
r := gin.Default()

r.GET("/api/v1/twilight", GetTwilight)
r.GET("/api/v2/twilight", GetTwilight)

return r
}
Expand All @@ -40,7 +40,7 @@ func performRequest(r http.Handler, method, path string) *httptest.ResponseRecor
}

// Perform a GET request with that handler.
var w = performRequest(r, "GET", "/api/v1/twilight?datetime=2021-05-14T00:00:00.000Z&longitude=-155.468094&latitude=19.798484")
var w = performRequest(r, "GET", "/api/v2/twilight?datetime=2021-05-14T00:00:00.000Z&longitude=-155.468094&latitude=19.798484")

func TestTwilightRouteStatusCode(t *testing.T) {
// Assert we encoded correctly, the request gives a 200:
Expand Down

0 comments on commit 00f0873

Please sign in to comment.