Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
140 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,5 @@ group :test do | |
gem "capybara" | ||
gem "selenium-webdriver" | ||
end | ||
|
||
gem "icalendar", "~> 2.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
class Event < ApplicationRecord | ||
def self.create_from_ics(file_path) | ||
file = File.open(file_path) | ||
calendars = Icalendar::Calendar.parse(file) | ||
event = calendars.first.events.first | ||
Event.create( | ||
starts_at: event.dtstart, | ||
ends_at: event.dtend, | ||
location: event.location, | ||
summary: event.summary.strip, | ||
description: event.description, | ||
url: event.url | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//Meetup//RemoteApi//EN | ||
CALSCALE:GREGORIAN | ||
METHOD:PUBLISH | ||
X-ORIGINAL-URL:https://www.meetup.com/englishspeakingyoganiceantibes/even | ||
ts/299417408/ical/Sunday+morning+yoga+in+Antibes+.ics | ||
X-WR-CALNAME:Events - Sunday morning yoga in Antibes .ics | ||
X-MS-OLK-FORCEINSPECTOROPEN:TRUE | ||
BEGIN:VTIMEZONE | ||
TZID:Europe/Paris | ||
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Paris | ||
X-LIC-LOCATION:Europe/Paris | ||
BEGIN:DAYLIGHT | ||
TZOFFSETFROM:+0100 | ||
TZOFFSETTO:+0200 | ||
TZNAME:CEST | ||
DTSTART:19700329T020000 | ||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU | ||
END:DAYLIGHT | ||
BEGIN:STANDARD | ||
TZOFFSETFROM:+0200 | ||
TZOFFSETTO:+0100 | ||
TZNAME:CET | ||
DTSTART:19701025T030000 | ||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU | ||
END:STANDARD | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
DTSTAMP:20240302T205200Z | ||
DTSTART;TZID=Europe/Paris:20240303T103000 | ||
DTEND;TZID=Europe/Paris:20240303T113000 | ||
STATUS:CONFIRMED | ||
SUMMARY:Sunday morning yoga in Antibes | ||
DESCRIPTION:English Yoga | Nice/Antibes/Monaco\nSunday\, March 3 at 10:30 | ||
AM\n\nJoin us for some yoga on Sunday morning in Antibes! 🌞✨Accessible | ||
to all levels of experience 🙏🏻Price: 15€\n\nhttps://www.meetup.com/en | ||
glishspeakingyoganiceantibes/events/299417408/ | ||
CLASS:PUBLIC | ||
CREATED:20240225T133601Z | ||
GEO:43.70;7.26 | ||
LOCATION:Plage de la Gravette\, Antibes (Small beach behind Port Vauban\, | ||
Antibes\, France) | ||
URL:https://www.meetup.com/englishspeakingyoganiceantibes/events/29941740 | ||
8/ | ||
LAST-MODIFIED:20240225T133630Z | ||
UID:event_299417408@meetup.com | ||
END:VEVENT | ||
END:VCALENDAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//Meetup//RemoteApi//EN | ||
CALSCALE:GREGORIAN | ||
METHOD:PUBLISH | ||
X-ORIGINAL-URL:https://www.meetup.com/nice-runners/events/299443075/ical/ | ||
Wednesday+5+km+or+more.ics | ||
X-WR-CALNAME:Events - Wednesday 5 km or more.ics | ||
X-MS-OLK-FORCEINSPECTOROPEN:TRUE | ||
BEGIN:VTIMEZONE | ||
TZID:Europe/Paris | ||
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Paris | ||
X-LIC-LOCATION:Europe/Paris | ||
BEGIN:DAYLIGHT | ||
TZOFFSETFROM:+0100 | ||
TZOFFSETTO:+0200 | ||
TZNAME:CEST | ||
DTSTART:19700329T020000 | ||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU | ||
END:DAYLIGHT | ||
BEGIN:STANDARD | ||
TZOFFSETFROM:+0200 | ||
TZOFFSETTO:+0100 | ||
TZNAME:CET | ||
DTSTART:19701025T030000 | ||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU | ||
END:STANDARD | ||
END:VTIMEZONE | ||
BEGIN:VEVENT | ||
DTSTAMP:20240302T205210Z | ||
DTSTART;TZID=Europe/Paris:20240304T193000 | ||
DTEND;TZID=Europe/Paris:20240304T210000 | ||
STATUS:CONFIRMED | ||
SUMMARY:Wednesday 5 km or more | ||
DESCRIPTION:Nice Runners\nMonday\, March 4 at 7:30 PM\n\nwe meet and run | ||
5 to 10 km. in the group there are different speeds and different levels | ||
of preparation and everyone makes the distance they feel. in ...\n\nhtt | ||
ps://www.meetup.com/nice-runners/events/299443075/ | ||
CLASS:PUBLIC | ||
CREATED:20240226T173204Z | ||
GEO:43.70;7.26 | ||
LOCATION:Ma Nolan's Irish Pub at - Vieux\, Nice (2 Rue Saint François De | ||
Paule (Cours Saleya)\, Nice\, France) | ||
URL:https://www.meetup.com/nice-runners/events/299443075/ | ||
LAST-MODIFIED:20240226T173204Z | ||
UID:event_jlvnktygcfbgb@meetup.com | ||
END:VEVENT | ||
END:VCALENDAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
require "test_helper" | ||
|
||
class EventTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
test "create_from_ics" do | ||
file_path = "test/fixtures/files/Sunday+morning+yoga+in+Antibes+.ics" | ||
event = Event.create_from_ics(file_path) | ||
assert_equal "Sunday morning yoga in Antibes", event.summary | ||
end | ||
end |