add_to_calendar_links 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/add_to_calendar_links.rb +15 -6
- data/lib/add_to_calendar_links/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c1fc649c026fad801703de16f4acc9020828623b2cca79bc3b0994d1283b539
|
4
|
+
data.tar.gz: 8e982c9be9dae3e653f2db93e09e164ced68ffe4598d9a53881c34a1ea6a7cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3dc98e19a10ef18d984b3e71a4f378ce3e592373e86656b2a09d7aca47616ea2d9f1cc4df56858f3d8fda99092386e1c67fe76b672be38b3e03ecb508f9765
|
7
|
+
data.tar.gz: fe8ff7ed31d64ec73ed7af4afa81a3efdb26934f863190903f7b22cba79a954223846a03de81eb01a1694c9c4f836e1d18972a27d9058f602184f5eafb9bc690
|
@@ -12,8 +12,8 @@ module AddToCalendarLinks
|
|
12
12
|
class Error < StandardError; end
|
13
13
|
|
14
14
|
class URLs
|
15
|
-
attr_accessor :start_datetime, :end_datetime, :title, :timezone, :location, :url, :description, :add_url_to_description, :organizer, :strip_html, :sequence, :last_modified
|
16
|
-
def initialize(start_datetime:, end_datetime: nil, title:, timezone:, location: nil, url: nil, description: nil, add_url_to_description: true, organizer: nil, strip_html: false, sequence: nil, last_modified: Time.now.utc)
|
15
|
+
attr_accessor :start_datetime, :end_datetime, :title, :timezone, :location, :url, :description, :add_url_to_description, :organizer, :strip_html, :sequence, :last_modified, :uid
|
16
|
+
def initialize(start_datetime:, end_datetime: nil, title:, timezone:, location: nil, url: nil, description: nil, add_url_to_description: true, organizer: nil, strip_html: false, sequence: nil, last_modified: Time.now.utc, uid:)
|
17
17
|
@start_datetime = start_datetime
|
18
18
|
@end_datetime = end_datetime
|
19
19
|
@title = title
|
@@ -25,6 +25,7 @@ module AddToCalendarLinks
|
|
25
25
|
@organizer = URI.parse(organizer) if organizer
|
26
26
|
@strip_html = strip_html
|
27
27
|
@sequence = sequence
|
28
|
+
@uid = uid
|
28
29
|
@last_modified = last_modified
|
29
30
|
validate_attributes
|
30
31
|
end
|
@@ -120,8 +121,12 @@ module AddToCalendarLinks
|
|
120
121
|
end
|
121
122
|
end
|
122
123
|
params[:LOCATION] = strip_html_tags(location) if location
|
123
|
-
|
124
|
-
|
124
|
+
if uid
|
125
|
+
params[:UID] = uid
|
126
|
+
else
|
127
|
+
params[:UID] = "-#{urlc}" if url
|
128
|
+
params[:UID] = "-#{utc_datetime(start_datetime)}-#{title}" unless params[:UID] # set uid based on starttime and title only if url is unavailable
|
129
|
+
end
|
125
130
|
params[:ORGANIZER] = organizer if organizer
|
126
131
|
params[:SEQUENCE] = sequence if sequence
|
127
132
|
params["LAST-MODIFIED"] = format_date_google(last_modified) if last_modified
|
@@ -159,8 +164,12 @@ module AddToCalendarLinks
|
|
159
164
|
end
|
160
165
|
end
|
161
166
|
params[:LOCATION] = url_encode_ical(location) if location
|
162
|
-
|
163
|
-
|
167
|
+
if uid
|
168
|
+
params[:UID] = uid
|
169
|
+
else
|
170
|
+
params[:UID] = "-#{url_encode(url)}" if url
|
171
|
+
params[:UID] = "-#{utc_datetime(start_datetime)}-#{url_encode_ical(title)}" unless params[:UID] # set uid based on starttime and title only if url is unavailable
|
172
|
+
end
|
164
173
|
params[:ORGANIZER] = organizer if organizer
|
165
174
|
params[:SEQUENCE] = sequence if sequence
|
166
175
|
params["LAST-MODIFIED"] = format_date_google(last_modified) if last_modified
|