エラー
[1] pry(#)> response
=> {"error"=>
{"message"=>
"There were errors processing your request: Invalid 'toDate':'202012041817'. 'toDate' must be a minimum of 10 seconds prior to the request time.",
"sent"=>"2020-12-04T09:17:45+00:00",
"transactionId"=>"002a2da700477f27"}}
概要
APIへのリクエスト時間を日本時間にする (現在、9時間の時差 UTC)
(1の実装完了後)
tweet.rb 内 set_period_params
のdate_to
をago(0.years)
に修正 (現在、ago(9.hours)
にて指定実装内容
1年前から現在までのツイートを取得しようとした場合、下記"sent"の時間が9時間時差のためAPIの返り値がエラーとなる。 (日本時間では、"toDate"の18時17分に実行しています)
エラー [1] pry(#)> response => {"error"=> {"message"=> "There were errors processing your request: Invalid 'toDate':'202012041817'. 'toDate' must be a minimum of 10 seconds prior to the request time.", "sent"=>"2020-12-04T09:17:45+00:00", "transactionId"=>"002a2da700477f27"}}
現象確認方法
tweet.rb
内twitter_search_data
response
がAPIからの戻り値のため、response取得後にbinding.pryを挿入その他情報
Railsタイムゾーンまとめ
上記サイトを元に、
config/application.rb
追記しましたが、テーブル内の時刻が日本時間になったのみ、sentは変わらず。