спасибо, однако я сделал это неправильный путь я think..had изменить его и удалить @ так что теперь
w_api=Wunderground.new("MY_API_KEY")
но did'nt дать любой выход, так что я добавил
@W=w_api.forecast_for("WA","Spokane")
Почему я должен удалить @ ?.
с точки зрения я назвал @w
<td><%= @w %></td>
теперь я получаю результат
{
"response"=>{
"version"=>"0.1",
"termsofService"=>"http://www.wunderground.com/weather/api/d/terms.html",
"features"=>{
"forecast"=>1
}
},
"forecast"=>{
"txt_forecast"=>{
"date"=>"8:27 AM PST",
"forecastday"=>[
{
"period"=>0,
"icon"=>"partlycloudy",
"icon_url"=>"http://icons.wxug.com/i/c/k/partlycloudy.gif",
"title"=>"Thursday",
"fcttext"=>"A mix of clouds and sun. High 51F. Winds SSW at 5 to 10 mph.",
"fcttext_metric"=>"A mix of clouds and sun. High near 10C. Winds SSW at 10 to 15 km/h.",
"pop"=>"0"
},
{
"period"=>1,
"icon"=>"nt_clear",
"icon_url"=>"http://icons.wxug.com/i/c/k/nt_clear.gif",
"title"=>"Thursday Night",
"fcttext"=>"Mostly clear. Low 27F. Winds light and variable.",
"fcttext_metric"=>"Mostly clear. Low -2C. Winds light and variable.",
"pop"=>"0"
},
однако, когда я перейти непосредственно на страницу JSON API я получаю:
{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"forecast": 1
}
}
,
"forecast":{
"txt_forecast": {
"date":"4:28 AM PST",
"forecastday": [
{
разница равна => и нет массива []
- это первый список объектов и второй массив? как извлечь значения? thx!