コードを書きましたが、うまくいきません。コードは次のとおりです。
#Parse and print the Tweet if the response code was 200
tweets = nil
if response.code == '200' then
tweets = JSON.parse(response.body)
require 'csv'
CSV.open("trial.csv", "ab") do |csv|
csv << ["text", "created_at", "name", 'id']
csv << ["tweets"]
end
end
ツイートを CSV テキスト ファイルに保存するには、このコードをどのように変更すればよいでしょうか?