add_to_calendar_links 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2497b47a154707baecaf96e5a06c8bf247a3a4927bac368fe9102d64ab53c139
4
- data.tar.gz: 03d063b6c2083d55d09e7ba710616d5de6337dbf8ba4f0e16c133147ea190607
3
+ metadata.gz: 7c1fc649c026fad801703de16f4acc9020828623b2cca79bc3b0994d1283b539
4
+ data.tar.gz: 8e982c9be9dae3e653f2db93e09e164ced68ffe4598d9a53881c34a1ea6a7cef
5
5
  SHA512:
6
- metadata.gz: 045fb5416365467b8b557c981d27a754826750a0efce2d2dbc00ab348b5bdba7e4e37449611fdc828772be5c13bd639b8f78d045ac937f14981345c0d589d9e4
7
- data.tar.gz: c64b76d1d4fa90e10c3e0227e413064330b9adbcf2d0e38a09360a110310fef2a85ae015ff0d723a1e79dae63fd8cb8374d43167db490fa783204e0941ee3386
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
- params[:UID] = "-#{url}" if url
124
- params[:UID] = "-#{utc_datetime(start_datetime)}-#{title}" unless params[:UID] # set uid based on starttime and title only if url is unavailable
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
- params[:UID] = "-#{url_encode(url)}" if url
163
- 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
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AddToCalendarLinks
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: add_to_calendar_links
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Turner