jaredlt / add_to_calendar

A ruby gem to generate 'Add To Calendar' URLs for Android, Apple, Google, Office 365, Outlook, Outlook.com and Yahoo calendars
MIT License
85 stars 14 forks source link

Adding organizer. #45

Open holden opened 11 months ago

holden commented 11 months ago

What about allowing the addition of organizer and/or other optional fields that ICS allows and most of them use.

It currently doesn't allow any options not specified eg unknown keyword: :organizer

CleanShot 2023-10-05 at 12 17 26@2x

jaredlt commented 11 months ago

@holden thanks for the feature request. It doesn't look like organizer is supported for the web calendars (Google, Outlook, Yahoo) but I could explore adding it to ICS.

Can you share the steps you took to get that screenshot to appear? It looks like the Google Calendar event component you get in an email but I can't seem to get it to appear at the moment. Did you download the generated ICS and then attach it to an email?

holden commented 11 months ago

Yes, exactly. I downloaded the ICS file @cal.ical_url and sent it to myself as an email to test how it would appear. As I want to use this in a couple of different ways including sending out email reminders and well as clicking from a website.

Your solution seemed to be the only one focused on both!

I pulled organizer from what I saw on the icalendar page: https://github.com/icalendar/icalendar#example

Thanks,

jaredlt commented 11 months ago

Gotcha, thank you for the detail. I may have some time on Friday to have a look at this. Will keep you updated.

As an aside, I have no idea why I didn't use the icalendar gem to generate the ICS files... I should really move over to it.

holden commented 11 months ago

Yeah, actually when I first came across your gem I figured icalendar would be a dependency. ;-)

jaredlt commented 11 months ago

@holden could you test the following 3 ICS files for me? (could you send them to yourself and verify what shows for the Gmail preview?)

ics-tests.zip

For Organizer, it looks like you can provider an email and a name. According to https://icalendar.org/validator.html all 3 are valid ICS files (and they produce the same formatting as the icalendar gem examples) but when I send them to Gmail only the one with both name and email displays the event preview component (the other two don't show the preview at all for me).

If it's the same for you then I'll just require that if you're adding an Organizer then you must add both Name and Email, but I wanted to check if you get the same results first.

holden commented 11 months ago

Weirdly email or name alone doesn't do anything in Gmail.

But Name and Email together work. CleanShot 2023-10-13 at 16 58 18

jaredlt commented 10 months ago

Sorry for the delay here! I have this working locally and will push it up for a new release shortly.

holden commented 10 months ago

No problem. That would be great! Thanks

jaredlt commented 10 months ago

@holden I've just released v0.4.0 - can you test it out and let me know if any issues?

You provide the organizer attribute like so:

    organizer: { 
      name: "First Last",
      email: "email@example.com"
    }