Skip to content

Instantly share code, notes, and snippets.

@grimrose
Created July 18, 2014 14:14
Show Gist options
  • Save grimrose/0da9b4402ac85fbfec37 to your computer and use it in GitHub Desktop.
Save grimrose/0da9b4402ac85fbfec37 to your computer and use it in GitHub Desktop.
Groovy + Retrofitで http://weather.livedoor.com/weather_hacks/webservice を試してみる
@Grab(group = 'com.squareup.retrofit', module = 'retrofit', version = '1.6.1')
import retrofit.RestAdapter
import retrofit.http.GET
import retrofit.http.Query
interface WeatherService {
@GET('/forecast/webservice/json/v1')
Map find(@Query('city') String city)
}
def result = new RestAdapter.Builder()
.setEndpoint('http://weather.livedoor.com')
.build()
.create(WeatherService)
.find('400040')
println result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment