Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kasramp committed Feb 22, 2019
1 parent 22378c1 commit 527acd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

Expand Down Expand Up @@ -54,7 +53,7 @@ public CurrentWeatherAPIController(Weather weather) {
* */
@ApiOperation(value = "Get current weather condition based on latitude and longitude", response = CurrentWeatherCondition.class, tags = "Get weather by latitude, longitude")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Successfully retrieve weather condition"), @ApiResponse(code = 400, message = "Failed to get weather condition")})
@RequestMapping(value = {"v1/weather/current", "/current"}, method = RequestMethod.GET, produces = "application/json")
@GetMapping(value = {"v1/weather/current", "/current"}, produces = "application/json")
public ResponseEntity<CurrentWeatherCondition> getCurrent(@RequestParam(value = "lat") String latitude, @RequestParam(value = "lon") String longitude,
@RequestParam(value = "fahrenheit", required = false, defaultValue = "false") boolean fahrenheit,
HttpServletRequest request) {
Expand All @@ -69,7 +68,7 @@ public ResponseEntity<CurrentWeatherCondition> getCurrent(@RequestParam(value =

@ApiOperation(value = "Get current weather condition based on requester IP address", response = CurrentWeatherCondition.class, tags = "Get weather by requester IP address")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Successfully retrieve weather condition"), @ApiResponse(code = 400, message = "Failed to get weather condition")})
@RequestMapping(value = {"v1/weather/currentbyip"}, method = RequestMethod.GET, produces = "application/json")
@GetMapping(value = {"v1/weather/currentbyip"}, produces = "application/json")
public ResponseEntity<CurrentWeatherCondition> getCurrentByIp(@RequestParam(value = "fahrenheit",
required = false, defaultValue = "false") boolean fahrenheit, HttpServletRequest request) {

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/madadipouya/eris/rest/Redirect.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.madadipouya.eris.rest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

Expand Down Expand Up @@ -29,12 +28,12 @@ public class Redirect {

private static final String DOC_URL = "://eris.madadipouya.com";

@RequestMapping(value = "/", method = RequestMethod.GET)
@GetMapping(value = "/")
public ModelAndView redirectToDocPage(HttpServletRequest request) {
return new ModelAndView("redirect:" + request.getScheme() + DOC_URL);
}

@RequestMapping(value = "/apidocs", method = RequestMethod.GET)
@GetMapping(value = "/apidocs")
public ModelAndView redirectToApiPage() {
return new ModelAndView("redirect:/swagger-ui.html");
}
Expand Down

0 comments on commit 527acd8

Please sign in to comment.