@@ -32,13 +32,13 @@ def read(source_url)
3232 private
3333
3434 # Modifies the given URL to the ics export.
35- # Loops into each Ical event to process it.
36- # Note: One .ics file can have multiple Ical events.
35+ # Loops into each event to process it.
36+ # Note: One .ics file can have multiple events.
3737 def process_url ( url )
3838 export_url = to_export ( url )
3939 raise 'Not an indico link' if export_url . nil?
4040
41- content = open_url ( export_url , token : @token , raise : true ) . set_encoding ( 'utf-8' )
41+ content = open_url ( export_url , raise : true , token : @token ) . set_encoding ( 'utf-8' )
4242 events = Icalendar ::Event . parse ( content )
4343 raise 'Not found' if events . nil? || events . empty?
4444
@@ -51,8 +51,6 @@ def process_url(url)
5151
5252 # 1. If the path already ends with '/events.ics', return as-is.
5353 # 2. If the host includes 'indico', ensures the path ends with '/events.ics'.
54- # 3. Otherwise, append '?ical=true' query param if not already present.
55- #
5654 # This method never mutates the original URL string.
5755 # Returns the updated URL string or nil if input is blank.
5856 def to_export ( url )
@@ -65,8 +63,6 @@ def to_export(url)
6563 uri . to_s
6664 elsif indico_page? ( uri )
6765 ensure_events_ics_path ( uri )
68- else
69- nil
7066 end
7167 end
7268
@@ -93,14 +89,6 @@ def ensure_events_ics_path(uri)
9389 uri . to_s
9490 end
9591
96- # Ensures the URL has '?ical=true' in its query params
97- def ensure_ical_query ( uri )
98- query = URI . decode_www_form ( uri . query . to_s ) . to_h
99- query [ 'ical' ] = 'true' unless query [ 'ical' ] == 'true'
100- uri . query = URI . encode_www_form ( query )
101- uri . to_s
102- end
103-
10492 # Builds the OpenStruct event and adds it in event.
10593 def process_calevent ( calevent )
10694 event_to_add = OpenStruct . new . tap do |event |
@@ -110,7 +98,7 @@ def process_calevent(calevent)
11098 end
11199 add_event ( event_to_add )
112100 rescue StandardError => e
113- @messages << "Process iCalendar failed with: #{ e . message } "
101+ @messages << "process_calevent failed with: #{ e . message } "
114102 end
115103
116104 # Assigns to event: url, title, description, keywords.
0 commit comments