add_to_calendar 0.4.0 → 0.5.0

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: 2c0a0f2f9901bd47c14f386ec09c72207eeebf34e04e592473c57e2b00bc3d18
4
- data.tar.gz: f2cb5bf74e64fb36e47d293e8a525b784018280851a16b08817eb716c4453393
3
+ metadata.gz: 066bd5d8dca47c52812bd31e3025bebc8dc2cb26a0401565b069d9b14cce5b6f
4
+ data.tar.gz: ed67f1f5d08cb1a318948a4c4315aa9aa23dcebda93a03899e715fe60deb0f48
5
5
  SHA512:
6
- metadata.gz: ab6dee17a03164fce02ce552f522b4fdda9414328063355611e39784e89b8d85cad3a800d9c3360d5128d2187cbaa9094596451fb2dce702c3acd91faead4024
7
- data.tar.gz: 66eb54a91cba9b7adcf625e25a89ea1c64018b36e045130ba3a01a1cc317c55072fc42607903eee88103eecd102022610fb7e1b9315d284922d46eedfb6c0ce9
6
+ metadata.gz: e0bdd471038f1e8deaadab3382de66287df61abf6f747a9a4567a5ed231776e38d683b57ed429a2865364d29f435ffd6d3c7cfd1499c7ac5290b785af1b0ce0b
7
+ data.tar.gz: d5cb5db508ceb12c74b68e492b36393bd46c0ec4c844854bf90346ddec0a9338e0961b864f0d682f8c78b150aa6c79b85c6b26cb1952e52fbf1610c9213c894d
@@ -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.0)
4
+ add_to_calendar (0.5.0)
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.1.10)
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.5)
20
+ tzinfo (2.0.6)
21
21
  concurrent-ruby (~> 1.0)
22
- tzinfo-data (1.2020.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,6 +41,9 @@ 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
48
  #=> "https://outlook.office.com/calendar/0/deeplink/compose?path=/calendar/action/compose&rru=addevent&subject=Christmas%20party%21&startdt=2020-12-12T13:30:00Z&enddt=2020-12-12T14:30:00Z"
46
49
 
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module AddToCalendar
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -92,6 +92,59 @@ 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
149
  # Eg. https://outlook.live.com/calendar/0/deeplink/compose?path=/calendar/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")
@@ -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.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Turner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-30 00:00:00.000000000 Z
11
+ date: 2024-09-18 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,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
157
  - !ruby/object:Gem::Version
157
158
  version: '0'
158
159
  requirements: []
159
- rubygems_version: 3.2.32
160
+ rubygems_version: 3.5.6
160
161
  signing_key:
161
162
  specification_version: 4
162
163
  summary: Generate 'Add To Calendar' URLs for Android, Apple, Google, Office 365, Outlook,