Я проанализировал значения из вывода JSON нижеприведенной команды curl (благодаря stackoverflow),
1.), Но я вижу большие пробелы в выводе (Прикрепленное изображение для справки).Нужен вывод без лишних пробелов (см. Дополнительные пробелы в конце вывода, пожалуйста, обратитесь к изображению). Пожалуйста, помогите по этому поводу,
(Очень плохо знакомы с рубином извинения за основные вещи)
пробел после последней строки вывода
2.) Также требуется пробел после каждого значения.
ВЫБОР ОБРАЗЦА:
ID : 7j6rzn1r43zz , CREATED AT : 2017-04-03T12:08:03Z , LINK : http://stspg.io/5Es5 , ISSUE NAME : Intermittent Issue , DESCRIPTION : There is a minor performance degradation in our app for some customers in US, We are working on it , STATUS : identified ,DESCRIPTION : We have resolved the performance issue in our app, We are closely monitoring it. , STATUS : resolved
ID : g8tk0jtvgybt , CREATED AT : 2017-04-01T11:11:27Z , LINK : http://stspg.io/5EHd , ISSUE NAME : Intermittent Issue , DESCRIPTION : Currently we are facing delay in incoming emails as we have problem with our email service provider. We are working on it. , STATUS : investigating ,DESCRIPTION : The delay in incoming emails issue has been resolved now. Application is working fine. , STATUS : resolved
Ожидается
ID : 7j6rzn1r43zz , CREATED AT : 2017-04-03T12:08:03Z , LINK : http://stspg.io/5Es5 , ISSUE NAME : Intermittent Issue , DESCRIPTION : There is a minor performance degradation in our app for some customers in US, We are working on it , STATUS : identified ,DESCRIPTION : We have resolved the performance issue in our app, We are closely monitoring it. , STATUS : resolved
ID : g8tk0jtvgybt , CREATED AT : 2017-04-01T11:11:27Z , LINK : http://stspg.io/5EHd , ISSUE NAME : Intermittent Issue , DESCRIPTION : Currently we are facing delay in incoming emails as we have problem with our email service provider. We are working on it. , STATUS : investigating ,DESCRIPTION : The delay in incoming emails issue has been resolved now. Application is working fine. , STATUS : resolved
Завиток:
def incidents
value = `curl https://api.statuspage.io/v1/pages/incidents.json -H "Authorization: OAuth a8ef"`
data_hash = JSON.parse(value).map {|h| puts "ID : #{h["id"]} , CREATED AT : #{h["created_at"]} , LINK : #{h["shortlink"]} , ISSUE NAME : #{h["name"]} , DESCRIPTION : #{h["incident_updates"][1]["body"]} , STATUS : #{h["incident_updates"][1]["status"]} ,DESCRIPTION : #{h["incident_updates"][0]["body"]} , STATUS : #{h["incident_updates"][0]["status"]}"}
puts data_hash
end