Google CalendarList API颜色

时间:2013-10-03 20:46:14

标签: google-api-client google-api-ruby-client

我似乎无法获得用于添加要订阅并且对用户可见的日历的颜色设置。我正在设置foregroundColor和backgroundColor的值以及将colorRgbFormat设置为true,但无论我将颜色设置为什么,用户显示中的颜色总是呈蓝色。

calendarList = api.calendar_list.insert.request_schema.new({
'id' => <calendar id>,
'hidden' => false,
'selected' => true,
'colorRgbFormat' => true,
'backgroundColor' => '#ffff00,
'foregroundColor' => '#000000'
})
result = client.execute(
  :api_method => api.calendar_list.insert,
  :body_object => calendarList
)

1 个答案:

答案 0 :(得分:2)

今天我很擅长回答自己的问题。 color Rgb Format实际上是一个参数,因此调用应该是:

calendarList = api.calendar_list.insert.request_schema.new({
'id' => cal_id,
'hidden' => false,
'selected' => true,
'backgroundColor' => cal_color,
'foregroundColor' => '#000000'
})
result = client.execute(
  :api_method => api.calendar_list.insert,
  :body_object => calendarList,
  :parameters => {'colorRgbFormat' => true,}
  )