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

Add Hey Calendar Support #47

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Conversation

davidos16
Copy link

Updated to include integrating with Hey, (Hey.com), an email and calendar service from the 37 Signals team. This fits in with the rest of the export functionality allowing you to specify a "hey_url" to export the event.

Add hey_url to integrate with hey calendar from 37 signals. 
hey.com
Fix hey url generation
Hey Calendar fix
Copy link

@jorgemanrubia jorgemanrubia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @davidos16!

@@ -27,6 +27,30 @@ def initialize(start_datetime:, end_datetime: nil, title:, timezone:, location:

validate_attributes
end

def hey_url
calendar_url = "https://app.hey.com/calendar/ical_events/new?ical_source=BEGIN%3AVCALENDAR%0AVERSION%3A2.0%0APRODID%3A-%2F%2FBasecamp%2F%2FBC3%2F%2FEN%0ACALSCALE%3AGREGORIAN%0A%0ABEGIN%3AVEVENT"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRODID probably shouldn't be "Basecamp", but the product where this link is added to. It's Basecamp in the example link I sent you because it's a link extracted from Basecamp.

end

calendar_url << "%0AEND%3AVEVENT%0AEND%3AVCALENDAR"
return calendar_url

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To build the URL with the query, you could build the ical source as regular text and then do:

query = URI.encode_www_form(ical_source: ical_source)
"https://app.hey.com/calendar/ical_events/new?#{query}"

So that you don't have to care about escaping characters and such.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jorgemanrubia I'm having issues using the URI.encode_www_form. Tried to get some hints but I'm unfortunately can't get it to print the params out separated with %0A. Any hint you can give me around how you do in BC?

@jaredlt
Copy link
Owner

jaredlt commented May 8, 2024

@davidos16 thank you for working on this! Love the feature and I’ll be happy to merge it. Two things:

  • Would you mind adding a few tests? Just to confirm things are working as expected and so I don’t break anything in the future :)
  • I’m on holiday at the moment, happily without my laptop! Hope you don’t mind, but I’ll come back to this, give it a proper review and move it forward in 1-2 weeks (bit vague, sorry. Just depends how busy I am once I return from holiday)


def hey_url
calendar_url = "https://app.hey.com/calendar/ical_events/new?ical_source=BEGIN%3AVCALENDAR%0ABEGIN%3AVEVENT"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgemanrubia Ty! moved too fast, updated the initial calendar URL moving out the prodid.

@davidos16
Copy link
Author

@davidos16 thank you for working on this! Love the feature and I’ll be happy to merge it. Two things:

  • Would you mind adding a few tests? Just to confirm things are working as expected and so I don’t break anything in the future :)
  • I’m on holiday at the moment, happily without my laptop! Hope you don’t mind, but I’ll come back to this, give it a proper review and move it forward in 1-2 weeks (bit vague, sorry. Just depends how busy I am once I return from holiday)

No rush, and ty!

Hoping to get my first open source pr, so please lmk any updates or tips to be better in the future.

Still fixing a few tests, fyi.

Copy link
Owner

@jaredlt jaredlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidos16 I'm really sorry I haven't got back to you on this. I've been dealing with some family stuff and haven't had the time.

Left a couple of tiny comments. Some other thoughts:

  • I don't have access to Hey Calendar so I wanted to confirm if you have tested this manually and all is working well? Including a bunch of variations eg.
    • with/without end date
    • url shows in description
    • all day works as expected
    • adding organizer doesn't break anything
    • probably some other scenarios you have in the test cases
  • A bunch of the tests are failing but I think that's because of daylight savings (and the way I've implemented all the tests, which you've just copied 🙃 ). I really need to refactor all the tests to work on fixed dates but that's outside the scope of this PR.

I unfortunately won't have a lot of time in the next week or two but hopefully after that I can properly can back to things and we can work to get this merged!

Comment on lines +60 to +66
if add_url_to_description && url
if params[:DESCRIPTION]
params[:DESCRIPTION] << "\\n\\n#{url_encode(url)}"
else
params[:DESCRIPTION] = url_encode(url)
end
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just aligning this with the rest of the indentation

Suggested change
if add_url_to_description && url
if params[:DESCRIPTION]
params[:DESCRIPTION] << "\\n\\n#{url_encode(url)}"
else
params[:DESCRIPTION] = url_encode(url)
end
end
if add_url_to_description && url
if params[:DESCRIPTION]
params[:DESCRIPTION] << "\\n\\n#{url_encode(url)}"
else
params[:DESCRIPTION] = url_encode(url)
end
end

@@ -1,3 +1,3 @@
module AddToCalendar
VERSION = "0.4.0"
VERSION = "0.4.1"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a new feature worthy of a minor version bump :)

Suggested change
VERSION = "0.4.1"
VERSION = "0.5.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants