【问题标题】:Gmail: Ruby gem google-api-client broken?Gmail:Ruby gem google-api-client 坏了?
【发布时间】: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 的属性:

  • internal_date
  • label_ids
  • payload
  • raw
  • size_estimate
  • sn-p
  • 还注意到在他们的文档中链接的 github 项目在某些地方会打开一个 404 页面。

    【问题讨论】:

      标签: google-api rubygems gmail google-api-client


      【解决方案1】:

      可能是由于 Google 现在强制开发者首先审核公开可用的应用程序:https://developers.google.com/gmail/api/auth/about-auth(请参阅带有星号的蓝色框中的通知)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多