【发布时间】:2017-05-01 17:39:20
【问题描述】:
没有人遇到过这种情况?
我可以获取电子邮件消息对象 (Google::Apis::GmailV1::Message),但其他消息属性仅返回 Nil。只有id,thread_id好像是返回的。
SCOPE = Google::Apis::GmailV1::AUTH_GMAIL_MODIFY
service = Google::Apis::GmailV1::GmailService.new
service.client_options.application_name = APPLICATION_NAME
service.authorization = authorize
user_msgs = service.list_user_messages('me',
{:include_spam_trash => false, :label_ids => ['INBOX'], :q => "is:unread"})
user_msgs.messages.each do |msg|
puts "CLASS: #{msg.class}" # Google::Apis::GmailV1::Message
puts "MESSAGE ID: #{msg.id}" # WORKS I get the email ID
msg_part = msg.payload
puts "MSGPART: #{msg_part.class}" # NIL !!!, All other attributes are also NIL
end
所以基本上我确实收到了带有正确 ID 的电子邮件,但仅此而已,GmailV1::Message 类的所有方法或属性都是 Nil。我还尝试将 SCOPE 更改为 MODIFY 并且结果相同。
只返回 Nil 的属性:
还注意到在他们的文档中链接的 github 项目在某些地方会打开一个 404 页面。
【问题讨论】:
标签: google-api rubygems gmail google-api-client