add_to_calendar 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +25 -0
- data/Gemfile.lock +4 -4
- data/README.md +6 -4
- data/add_to_calendar.gemspec +1 -1
- data/lib/add_to_calendar/version.rb +1 -1
- data/lib/add_to_calendar.rb +68 -4
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1032e0d4e1d32a36159cb698a0fa81f0c43f16445876728329f1862a1be54215
|
4
|
+
data.tar.gz: 90fcded49ce3b3b7da0633b8576396bbd016cef3fd04bc6c09b5aa5971b6fc9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 131a9fa2f5597e902c075bb3d67da89a1113fa1b0422a43babcd2e7447fbc740a47b3a6ab944a001859967bde8ac6d48f2a03fe731d0bd4f051bde0344b45f01
|
7
|
+
data.tar.gz: 6e003cf5f607b768a220427e94b04c0ff4df5ede2db2da4b2af3358b3ee0872903f55f056c5a5e5237648f546cb344665b0612ea0f6979315395954b41587042
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Ruby Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main ]
|
6
|
+
pull_request:
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
ruby-version: ['2.7', '3.0', '3.1']
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby-version }}
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Install dependencies
|
23
|
+
run: bundle install
|
24
|
+
- name: Run tests
|
25
|
+
run: bundle exec rake test
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
add_to_calendar (0.
|
4
|
+
add_to_calendar (0.5.1)
|
5
5
|
tzinfo (>= 1.1, < 3)
|
6
6
|
tzinfo-data (~> 1.2020)
|
7
7
|
|
@@ -9,7 +9,7 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
coderay (1.1.3)
|
12
|
-
concurrent-ruby (1.
|
12
|
+
concurrent-ruby (1.3.3)
|
13
13
|
method_source (1.0.0)
|
14
14
|
minitest (5.18.0)
|
15
15
|
pry (0.14.2)
|
@@ -17,9 +17,9 @@ GEM
|
|
17
17
|
method_source (~> 1.0)
|
18
18
|
rake (13.0.1)
|
19
19
|
timecop (0.9.6)
|
20
|
-
tzinfo (2.0.
|
20
|
+
tzinfo (2.0.6)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
tzinfo-data (1.
|
22
|
+
tzinfo-data (1.2024.1)
|
23
23
|
tzinfo (>= 1.0.0)
|
24
24
|
|
25
25
|
PLATFORMS
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# AddToCalendar
|
2
2
|
|
3
|
-
A ruby gem to generate 'Add To Calendar' URLs for Android, Apple, Google, Office 365, Outlook, Outlook.com and Yahoo calendars.
|
3
|
+
A ruby gem to generate 'Add To Calendar' URLs for Android, Apple, Google, Hey, Office 365, Outlook, Outlook.com and Yahoo calendars.
|
4
4
|
|
5
5
|
If this gem brings you some value feel free to buy me a coffee :) [![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/P5P71PK9T)
|
6
6
|
|
@@ -41,12 +41,15 @@ Or install it yourself as:
|
|
41
41
|
@cal.yahoo_url
|
42
42
|
#=> "https://calendar.yahoo.com/?v=60&view=d&type=20&title=Christmas%20party%21&st=20201212T133000Z&dur=0100"
|
43
43
|
|
44
|
+
@cal.hey_url
|
45
|
+
#=> "https://app.hey.com/calendar/ical_events/new?ical_source=BEGIN%3AVCALENDAR%0AVERSION%3A2.0%0APRODID%3A-//AddToCalendar//RubyGem//EN%0ABEGIN%3AVEVENT%0ASUMMARY%3AHolly%27s%209th%20birthday%21%0ADTSTAMP%3A20240913T151029Z%0ADTSTART%3A20240906T123000Z%0ADTEND%3A20240906T133000Z%0AUID%3A-20240906T123000Z-Holly%27s%209th%20birthday%21%0AEND%3AVEVENT%0AEND%3AVCALENDAR"
|
46
|
+
|
44
47
|
@cal.office365_url
|
45
|
-
#=> "https://outlook.office.com/calendar/0/
|
48
|
+
#=> "https://outlook.office.com/calendar/0/action/compose?rru=addevent&subject=Christmas%20party%21&startdt=2020-12-12T13:30:00Z&enddt=2020-12-12T14:30:00Z"
|
46
49
|
|
47
50
|
# For outlook.com, different to Outlook the desktop application below
|
48
51
|
@cal.outlook_com_url
|
49
|
-
#=> "https://outlook.live.com/calendar/0/
|
52
|
+
#=> "https://outlook.live.com/calendar/0/action/compose?rru=addevent&subject=Christmas%20party%21&startdt=2020-12-12T13:30:00Z&enddt=2020-12-12T14:30:00Z"
|
50
53
|
|
51
54
|
# ical provides a data-uri which will download a properly formatted *.ics file (see 'Creating HTML links' section)
|
52
55
|
@cal.ical_url
|
@@ -112,7 +115,6 @@ cal = AddToCalendar::URLs.new(**event_attributes)
|
|
112
115
|
|
113
116
|
- IE11 and lower will not work for `ical_url`, `apple_url` and `outlook_url` (IE does not properly support [data-uri links](https://caniuse.com/#feat=datauri). See [#16](https://github.com/jaredlt/add_to_calendar/issues/16)).
|
114
117
|
- IE11 will also not work with `Yahoo`, but this is because Yahoo is deprecating IE 11 support and only offers a simplified interface which does not work with the add event URL.
|
115
|
-
- `Office 365` and `Outlook.com` do not work on mobile. This seems to be an issue on Microsoft's side. Their mobile web interface does not support the 'create event' URLs and the links do not open the apps if you have them installed.
|
116
118
|
|
117
119
|
### More details
|
118
120
|
|
data/add_to_calendar.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Jared Turner"]
|
9
9
|
spec.email = ["jaredlt01@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "Generate 'Add To Calendar' URLs for Android, Apple, Google, Office 365, Outlook, Outlook.com and Yahoo calendars"
|
11
|
+
spec.summary = "Generate 'Add To Calendar' URLs for Android, Apple, Google, Hey, Office 365, Outlook, Outlook.com and Yahoo calendars"
|
12
12
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
13
13
|
spec.homepage = "https://github.com/jaredlt/add_to_calendar"
|
14
14
|
spec.license = "MIT"
|
data/lib/add_to_calendar.rb
CHANGED
@@ -92,13 +92,66 @@ module AddToCalendar
|
|
92
92
|
return calendar_url
|
93
93
|
end
|
94
94
|
|
95
|
+
def hey_url
|
96
|
+
calendar_url = "https://app.hey.com/calendar/ical_events/new?ical_source=BEGIN%3AVCALENDAR%0AVERSION%3A2.0%0APRODID%3A-//AddToCalendar//RubyGem//EN%0ABEGIN%3AVEVENT"
|
97
|
+
|
98
|
+
params = {}
|
99
|
+
params[:SUMMARY] = url_encode(title)
|
100
|
+
params[:DTSTAMP] = Time.now.strftime("%Y%m%dT%H%M%SZ")
|
101
|
+
|
102
|
+
if all_day
|
103
|
+
one_day = 1 * 24 * 60 * 60
|
104
|
+
params["DTSTART%3BVALUE=DATE"] = format_date(start_datetime)
|
105
|
+
if end_datetime
|
106
|
+
params["DTEND%3BVALUE=DATE"] = format_date(end_datetime + one_day)
|
107
|
+
else
|
108
|
+
params["DTEND%3BVALUE=DATE"] = format_date(start_datetime + one_day)
|
109
|
+
end
|
110
|
+
else
|
111
|
+
params[:DTSTART] = utc_datetime(start_datetime)
|
112
|
+
if end_datetime
|
113
|
+
params[:DTEND] = utc_datetime(end_datetime)
|
114
|
+
else
|
115
|
+
params[:DTEND] = utc_datetime(start_datetime + 60*60) # 1 hour later
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
params[:URL] = url_encode(url) if url
|
120
|
+
params[:UID] = "-#{utc_datetime(start_datetime)}-#{url_encode(title)}"
|
121
|
+
params[:DESCRIPTION] = url_encode_hey(description) if description
|
122
|
+
if add_url_to_description && url
|
123
|
+
if params[:DESCRIPTION]
|
124
|
+
params[:DESCRIPTION] << "\n\n#{url_encode(url)}"
|
125
|
+
else
|
126
|
+
params[:DESCRIPTION] = url_encode(url)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
if organizer
|
130
|
+
params[:ORGANIZER] = url_encode("CN=\"#{organizer[:name]}\"%3Amailto%3A#{organizer[:email]}")
|
131
|
+
end
|
132
|
+
params[:LOCATION] = url_encode(location) if location
|
133
|
+
|
134
|
+
new_line = "%0A"
|
135
|
+
params.each do |key, value|
|
136
|
+
if key == :ORGANIZER
|
137
|
+
calendar_url << "#{new_line}#{key}%3B#{value}"
|
138
|
+
else
|
139
|
+
calendar_url << "#{new_line}#{key}%3A#{value}"
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
calendar_url << "%0AEND%3AVEVENT%0AEND%3AVCALENDAR"
|
144
|
+
|
145
|
+
return calendar_url
|
146
|
+
end
|
147
|
+
|
95
148
|
def office365_url
|
96
|
-
# Eg. https://outlook.
|
149
|
+
# Eg. https://outlook.office.com/calendar/0/action/compose?rru=addevent&subject=Holly%27s%208th%20Birthday%21&startdt=2020-05-12T12:30:00Z&enddt=2020-05-12T16:00:00Z&body=Come%20join%20us%20for%20lots%20of%20fun%20%26%20cake%21%0A%0Ahttps%3A%2F%2Fwww.example.com%2Fevent-details&location=Flat%204%2C%20The%20Edge%2C%2038%20Smith-Dorrien%20St%2C%20London%2C%20N1%207GU
|
97
150
|
microsoft("office365")
|
98
151
|
end
|
99
152
|
|
100
153
|
def outlook_com_url
|
101
|
-
# Eg. https://outlook.live.com/calendar/0/
|
154
|
+
# Eg. https://outlook.live.com/calendar/0/action/compose?rru=addevent&subject=Holly%27s%208th%20Birthday%21&startdt=2020-05-12T12:30:00Z&enddt=2020-05-12T16:00:00Z&body=Come%20join%20us%20for%20lots%20of%20fun%20%26%20cake%21%0A%0Ahttps%3A%2F%2Fwww.example.com%2Fevent-details&location=Flat%204%2C%20The%20Edge%2C%2038%20Smith-Dorrien%20St%2C%20London%2C%20N1%207GU
|
102
155
|
microsoft("outlook.com")
|
103
156
|
end
|
104
157
|
|
@@ -199,9 +252,9 @@ module AddToCalendar
|
|
199
252
|
def microsoft(service)
|
200
253
|
# Eg.
|
201
254
|
if service == "outlook.com"
|
202
|
-
calendar_url = "https://outlook.live.com/calendar/0/
|
255
|
+
calendar_url = "https://outlook.live.com/calendar/0/action/compose?rru=addevent"
|
203
256
|
elsif service == "office365"
|
204
|
-
calendar_url = "https://outlook.office.com/calendar/0/
|
257
|
+
calendar_url = "https://outlook.office.com/calendar/0/action/compose?rru=addevent"
|
205
258
|
else
|
206
259
|
raise MicrosoftServiceError, ":service must be 'outlook.com' or 'office365'. '#{service}' given"
|
207
260
|
end
|
@@ -326,6 +379,17 @@ module AddToCalendar
|
|
326
379
|
}.join("\\n")
|
327
380
|
end
|
328
381
|
|
382
|
+
def url_encode_hey(s)
|
383
|
+
string = s.dup # don't modify original input
|
384
|
+
string.split("\n").map { |e|
|
385
|
+
if e.empty?
|
386
|
+
e
|
387
|
+
else
|
388
|
+
url_encode(e)
|
389
|
+
end
|
390
|
+
}.join("\n")
|
391
|
+
end
|
392
|
+
|
329
393
|
def yahoo_param(key)
|
330
394
|
if key == :in_loc
|
331
395
|
key.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: add_to_calendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jared Turner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -122,6 +122,7 @@ extensions: []
|
|
122
122
|
extra_rdoc_files: []
|
123
123
|
files:
|
124
124
|
- ".github/FUNDING.yml"
|
125
|
+
- ".github/workflows/tests.yml"
|
125
126
|
- ".gitignore"
|
126
127
|
- ".travis.yml"
|
127
128
|
- Gemfile
|
@@ -156,9 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
157
|
- !ruby/object:Gem::Version
|
157
158
|
version: '0'
|
158
159
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.5.6
|
160
161
|
signing_key:
|
161
162
|
specification_version: 4
|
162
|
-
summary: Generate 'Add To Calendar' URLs for Android, Apple, Google, Office 365,
|
163
|
-
Outlook.com and Yahoo calendars
|
163
|
+
summary: Generate 'Add To Calendar' URLs for Android, Apple, Google, Hey, Office 365,
|
164
|
+
Outlook, Outlook.com and Yahoo calendars
|
164
165
|
test_files: []
|