使用Google日历ruby API V3重复发生

时间:2012-01-07 23:13:08

标签: ruby google-api google-calendar-api

使用以下代码,我无法将任何定期事件推送到Google日历。但是,从事件中取消“重复”项目并且它可以正常工作。

我做错了什么?

  event = {
    'summary' => 'Appointment',
    'location' => 'Somewhere',
    'start' => {
       'dateTime' => '2011-06-03T10:00:00.000-07:00'
    },
    'end' => {
       'dateTime' => '2011-06-03T10:25:00.000-07:00'
    },
    'recurrence' => [
      "RRULE:FREQ=DAILY;COUNT=5"
    ]
  }

  result = @client.execute(:api_method => @service.events.insert,
                  :parameters => {'calendarId' => 'hg9a7o16bm6dj0tmuo481499mc@group.calendar.google.com'},
                  :body_object => event,
                  :headers => {'Content-Type' => 'application/json'})
  puts result.data.id.to_s

2 个答案:

答案 0 :(得分:1)

需要在单独的字段中设置时区

event = {
  'summary' => 'Appointment',
  'location' => 'Somewhere',
  'start' => {
     'dateTime' => '2011-06-03T10:00:00.000-07:00',
     'timeZone' => 'America/Montreal'
  },
  'end' => {
     'dateTime' => '2011-06-03T10:25:00.000-07:00',
     'timeZone' => 'America/Montreal'
  },
  'recurrence' => [
    "RRULE:FREQ=DAILY;COUNT=5"
  ]
}

答案 1 :(得分:0)

请尝试使用“RRULE:FREQ = WEEKLY; UNTIL = 20120701T160000Z”;

相关问题