-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Conversation
Add hey_url to integrate with hey calendar from 37 signals. hey.com
Update add_to_calendar.rb
Fix hey url generation
Hey Calendar fix
There was a problem hiding this 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!
lib/add_to_calendar.rb
Outdated
@@ -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" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
@davidos16 thank you for working on this! Love the feature and I’ll be happy to merge it. Two things:
|
|
||
def hey_url | ||
calendar_url = "https://app.hey.com/calendar/ical_events/new?ical_source=BEGIN%3AVCALENDAR%0ABEGIN%3AVEVENT" | ||
|
There was a problem hiding this comment.
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.
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. |
There was a problem hiding this 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!
if add_url_to_description && url | ||
if params[:DESCRIPTION] | ||
params[:DESCRIPTION] << "\\n\\n#{url_encode(url)}" | ||
else | ||
params[:DESCRIPTION] = url_encode(url) | ||
end | ||
end |
There was a problem hiding this comment.
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
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" |
There was a problem hiding this comment.
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 :)
VERSION = "0.4.1" | |
VERSION = "0.5.0" |
I couldn't update this PR so I created a new one here which resolves all the issues around encoding, same day events and the tests. #52 |
Closing as resolved by #52. v0.5.0 is released with Hey Calendar support. Thank you for taking on the initiative! |
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.