Google日历API事件忙/闲/阻止数据 [英] Google Calendar API Event Free/Busy/Blocking Data

查看:114
本文介绍了Google日历API事件忙/闲/阻止数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Google日历API,并试图找出如何判断日历是否应该被视为阻止时间的事件。例如,对于很多美国人来说,哥伦布日是一整天的事件(假日),对他们的工作日没有影响,但出现在日历上。我已经在其他地方阅读过,告诉日历上的事件是否阻止的方法是使用其透明度字段(每个这篇文章。但是,当我使用日历活动并来回切换时,活动本身在日历上始终保持透明状态。



我的问题是这样的:有没有办法通过查看事件资源来判断事件是否阻塞日历上的时间,或者这些信息应该从忙/闲查询中派生出来吗? 所以,事实证明,当使用Ruby Google API客户端,当事件被用户标记为可用时,透明度字段仅包含在事件资源中。根据文档,默认值为不透明。据推测,当透明度字段不存在于事件资源中时,则日历上的事件应被视为不透明或阻塞。在API客户端的结果请求体中,这应该产生一个零值而不是透明值。不是最干净的事情,但我认为它的作品。


I've been working with the Google Calendar API and am trying to figure out how to tell if an event a calendar should be considered an event that blocks time. For example, "Columbus Day" is an all day event (holiday) for many people in the US that has no effect on their workday, yet appears on a calendar. I've read in other places that the way to tell if an event is blocking on a calendar is by using its transparency field per This Post. However, when I play with my calendar events and toggle them back and forth, the event itself always remains "transparent" on the calendar.

My question is this: Is there a way to tell if an event blocks time on a calendar by looking at the event resource, or is this information something that should be derived from a free/busy query?

解决方案

So as it turns out, when using the Ruby Google API Client, the transparency field is only included in the event resource when the event is marked "available" by the user. The default value is "opaque" according to the documentation. Presumably, when the transparency field is not present in the event resource, then the event should be considered "opaque" or "blocking" on the calendar. In the resulting request body in the API client, this should yield a nil value instead of a "transparent" value. Not the cleanest thing around, but I think it works.

这篇关于Google日历API事件忙/闲/阻止数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆