我正在尝试为登录用户创建草稿消息,但Missing draft message
在运行以下命令时不断收到错误消息
require 'google/api_client'
client = Google::APIClient.new
client.authorization.client_id = ENV['GOOGLE_CLIENT_ID']
client.authorization.client_secret = ENV['GOOGLE_CLIENT_SECRET']
client.authorization.grant_type = 'refresh_token'
client.authorization.refresh_token = User.last.refresh_token
token = client.authorization.fetch_access_token!
gmail = client.discovered_api('gmail', 'v1')
params = { 'userId' => 'me', 'draft' => { 'message' => {'raw' => 'test email' } } }
# { 'userId' => 'me', 'message' => {'raw' => 'test email' } }
result = client.execute(api_method: gmail.users.drafts.create, parameters: params)
此外,我尝试了参数的注释掉组合,但仍然没有运气。有任何想法吗?