Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Calendar) Event Reminders Overrides Option Broken #470

Closed
LaMarseillaise opened this issue Sep 16, 2016 · 10 comments
Closed

(Calendar) Event Reminders Overrides Option Broken #470

LaMarseillaise opened this issue Sep 16, 2016 · 10 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@LaMarseillaise
Copy link

LaMarseillaise commented Sep 16, 2016

The Reminders field does not populate correctly when I instantiate a Google::Apis::CalendarV3::Event object. This causes insert_event to fail when the :reminders option is passed, effectively preventing me from adding reminders to an event.

This is the example code I found in the API reference. There are several problems with it. I have been able to send requests successfully without reminders.

event = Google::Apis::CalendarV3::Event.new{
  summary: 'Google I/O 2015',
  location: '800 Howard St., San Francisco, CA 94103',
  description: 'A chance to hear more about Google\'s developer products.',
  start: {
    date_time: '2015-05-28T09:00:00-07:00',
    time_zone: 'America/Los_Angeles',
  },
  end: {
    date_time: '2015-05-28T17:00:00-07:00',
    time_zone: 'America/Los_Angeles',
  },
  recurrence: [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  attendees: [
    {email: 'lpage@example.com'},
    {email: 'sbrin@example.com'},
  ],
  reminders: {
    use_default: false,
    overrides: [
      {method' => 'email', 'minutes: 24 * 60},
      {method' => 'popup', 'minutes: 10},
    ],
  },
}

result = client.insert_event('primary', event)
puts "Event created: #{result.html_link}"

Also, there should not be a method named end.

@sqrrrl
Copy link
Contributor

sqrrrl commented Sep 16, 2016

Will have the sample updated. The reminders part likely should read:

  reminders: {
    use_default: false,
    overrides: [
      {method_prop: 'email', minutes: 24 * 60},
      {method_prop: 'popup', minutes: 10},
    ],
  },

@LaMarseillaise
Copy link
Author

I discovered, after reviewing the source, that :reminder_method will work as a replacement for :method. However, both the documentation and the source suggest that :method is perfectly valid when it is not.

@shohey1226
Copy link

I had the same issue and stop using reminder but change the default setting from Google calendar setting..

@ajtruckle
Copy link

I have just found that my event reminders that were set as popup do not show in Google Calendar on the pc things seem to have changed?

@sqrrrl sqrrrl added Priority: P2+ type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Mar 31, 2017
@nicholaskim94
Copy link

@sqrrrl The reminders property on Google::Apis::CalendarV3::Event does not seem to deserialize either. Think this is a Google::Apis::CalendarV3::EventReminders problem as I am failing the deserialize default_reminders on Google::Apis::CalendarV3::Events too.

{
 "kind": "calendar#events",
 "etag": "\"p33k8h1e1peit60g\"",
 "summary": "Hello Google",
 "description": "",
 "updated": "2017-04-15T04:09:06.641Z",
 "timeZone": "Asia/Seoul",
 "accessRole": "owner",
 "defaultReminders": [
  {
   "method": "popup",
   "minutes": 10
  }
 ],
 "nextSyncToken": "COiIhcHLpdMCEOiIhcHLpdMCGAU=",
 "items": [
  {
   "kind": "calendar#event",
   "etag": "\"2984458692589000\"",
   "id": "rl6jjmphq2c3uq74c9q5h866i0",
   "status": "confirmed",
   "htmlLink": "https://www.google.com/calendar/event?eid=cmw2amptcGhxMmMzdXE3NGM5cTVoODY2aTAgY2VtdTdiOTVkbHEzbDRhNWw2MHFhdmVyYWtAZw",
   "created": "2017-04-14T19:38:51.000Z",
   "updated": "2017-04-15T04:09:06.392Z",
   "summary": "Hi Linder",
   "creator": {
    "email": "hiddentrackteam@gmail.com"
   },
   "organizer": {
    "email": "cemu7b95dlq3l4a5l60qaverak@group.calendar.google.com",
    "displayName": "Hello Google",
    "self": true
   },
   "start": {
    "dateTime": "2017-05-09T10:00:00+09:00"
   },
   "end": {
    "dateTime": "2017-05-09T11:00:00+09:00"
   },
   "transparency": "transparent",
   "visibility": "public",
   "iCalUID": "rl6jjmphq2c3uq74c9q5h866i0@google.com",
   "sequence": 1,
   "reminders": {
    "useDefault": false,
    "overrides": [
     {
      "method": "popup",
      "minutes": 50
     },
     {
      "method": "popup",
      "minutes": 10
     }
    ]
   }
  }
 ]
}

serializes to

#<Google::Apis::CalendarV3::Events:0x007f8a00fd7618
 @access_role="reader",
 @default_reminders=[],
 @description="",
 @etag="\"p33k8h1e1peit60g\"",
 @items=
  [#<Google::Apis::CalendarV3::Event:0x007f8a00fcf440
    @created=Fri, 14 Apr 2017 19:38:51 +0000,
    @creator=
     #<Google::Apis::CalendarV3::Event::Creator:0x007f8a00fc33e8
      @email="hiddentrackteam@gmail.com">,
    @end=
     #<Google::Apis::CalendarV3::EventDateTime:0x007f8a00fc0a08
      @date_time=Tue, 09 May 2017 11:00:00 +0900>,
    @etag="\"2984458692784000\"",
    @html_link=
     "https://www.google.com/calendar/event?eid=cmw2amptcGhxMmMzdXE3NGM5cTVoODY2aTAgY2VtdTdiOTVkbHEzbDRhNWw2MHFhdmVyYWtAZw",
    @i_cal_uid="rl6jjmphq2c3uq74c9q5h866i0@google.com",
    @id="rl6jjmphq2c3uq74c9q5h866i0",
    @kind="calendar#event",
    @organizer=
     #<Google::Apis::CalendarV3::Event::Organizer:0x007f8a00fa73a0
      @display_name="Hello Google
",
      @email="cemu7b95dlq3l4a5l60qaverak@group.calendar.google.com",
      @self=true>,
    @reminders=
     #<Google::Apis::CalendarV3::Event::Reminders:0x007f8a00f9ecc8
      @use_default=true>,
    @sequence=1,
    @start=
     #<Google::Apis::CalendarV3::EventDateTime:0x007f8a00f97270
      @date_time=Tue, 09 May 2017 10:00:00 +0900>,
    @status="confirmed",
    @summary="Hi Linder",
    @transparency="transparent",
    @updated=Sat, 15 Apr 2017 04:09:06 +0000,
    @visibility="public">],
 @kind="calendar#events",
 @next_sync_token="COiIhcHLpdMCEOiIhcHLpdMCGAE=",
 @summary="Hello Google",
 @time_zone="Asia/Seoul",
 @updated=Sat, 15 Apr 2017 04:09:06 +0000>

@JustinBeckwith JustinBeckwith added priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. and removed priority: p2+ labels Jun 6, 2018
@dazuma dazuma self-assigned this Nov 4, 2019
@dazuma
Copy link
Member

dazuma commented Nov 4, 2019

Did some investigation here. The original report from @LaMarseillaise remains pertinent: the Ruby sample is completely wrong. (For starters, beyond the syntax issues, the Ruby client simply does not translate nested hashes in this way. It needs to be constructed object-by-object.) I will fix up that sample.

There appear to be several other reports piled on, but are either unrelated or cannot be reproduced. In particular, I tried reproducing @nicholaskim94 's deserialization issue but was unsuccessful. Executing the deserialization code used in the client:

Google::Apis::CalendarV3::Events::Representation.new(Google::Apis::CalendarV3::Events.new).from_json(input_string)

yields the correct result with the correct reminders. It is possible that something was fixed since that report.

I will get the Ruby sample fixed and close this issue.

@ajtruckle
Copy link

No wonder I forgot! My post was Feb 2017...!

@dazuma
Copy link
Member

dazuma commented Nov 4, 2019

Yes, really sorry about that. This repo was bounced around a few teams since then, and a bunch of the issues got neglected. I'm trying to go through and fix and close things now.

@ajtruckle
Copy link

I am not sure how to interface such code into my project. Or is this something you guys need to do?

@dazuma
Copy link
Member

dazuma commented Nov 4, 2019

Looks like I am not able to edit the sample directly. So I reported this upstream to the documentation team: https://issuetracker.google.com/issues/143895117 Please follow that issue for further updates.

For reference, the following corrected sample should work:

    event = Google::Apis::CalendarV3::Event.new(
      summary: 'Google I/O 2015',
      location: '800 Howard St., San Francisco, CA 94103',
      description: 'A chance to hear more about Google\'s developer products.',
      start: Google::Apis::CalendarV3::EventDateTime.new(
        date_time: '2015-05-28T09:00:00-07:00',
        time_zone: 'America/Los_Angeles'
      ),
      end: Google::Apis::CalendarV3::EventDateTime.new(
        date_time: '2015-05-28T17:00:00-07:00',
        time_zone: 'America/Los_Angeles',
      ),
      recurrence: [
        'RRULE:FREQ=DAILY;COUNT=2'
      ],
      attendees: [
        Google::Apis::CalendarV3::EventAttendee.new(
          email: 'lpage@example.com'
        ),
        Google::Apis::CalendarV3::EventAttendee.new(
          email: 'sbrin@example.com'
        )
      ],
      reminders: Google::Apis::CalendarV3::Event::Reminders.new(
        use_default: false,
        overrides: [
          Google::Apis::CalendarV3::EventReminder.new(
            reminder_method: 'email',
            minutes: 24 * 60
          ),
          Google::Apis::CalendarV3::EventReminder.new(
            reminder_method: 'popup',
            minutes: 10
          )
        ]
      )
    )

    result = client.insert_event('primary', event)
    puts "Event created: #{result.html_link}"

@ajtruckle I'm not sure what you're asking. You should be able to create a client object of type Google::Apis::CalendarV3::CalendarService, set the API key or auth credentials, and then call this or any other method as with the sample. Look at the AUTHENTICATION.md if you're not sure how to set up auth.

@dazuma dazuma closed this as completed Nov 4, 2019
@dazuma dazuma removed the 🚨 This issue needs some love. label Nov 4, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

8 participants