cal-invite 0.1.2 → 0.1.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/CACHING.md +148 -0
- data/CHANGELOG.md +8 -0
- data/README.md +148 -17
- data/lib/cal_invite/caching.rb +74 -0
- data/lib/cal_invite/configuration.rb +39 -3
- data/lib/cal_invite/event.rb +76 -67
- data/lib/cal_invite/providers/base_provider.rb +55 -57
- data/lib/cal_invite/providers/google.rb +5 -1
- data/lib/cal_invite/providers/ical.rb +46 -13
- data/lib/cal_invite/providers/ics.rb +41 -18
- data/lib/cal_invite/providers/ics_content.rb +111 -0
- data/lib/cal_invite/providers/office365.rb +7 -7
- data/lib/cal_invite/providers/outlook.rb +8 -5
- data/lib/cal_invite/providers/yahoo.rb +7 -4
- data/lib/cal_invite/providers.rb +4 -2
- data/lib/cal_invite/version.rb +1 -1
- data/lib/cal_invite.rb +6 -0
- metadata +20 -3
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# lib/cal_invite/providers/outlook.rb
|
4
3
|
module CalInvite
|
5
4
|
module Providers
|
6
5
|
class Outlook < BaseProvider
|
@@ -21,9 +20,8 @@ module CalInvite
|
|
21
20
|
allday: 'true'
|
22
21
|
}
|
23
22
|
|
24
|
-
# Use current date if no start_time specified
|
25
23
|
start_date = event.start_time || Time.now
|
26
|
-
end_date = event.end_time || (start_date + 86400)
|
24
|
+
end_date = event.end_time || (start_date + 86400)
|
27
25
|
|
28
26
|
params[:startdt] = format_date(start_date)
|
29
27
|
params[:enddt] = format_date(end_date)
|
@@ -53,11 +51,16 @@ module CalInvite
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def format_time(time)
|
56
|
-
|
54
|
+
# Always use UTC format, timezone is handled by the calendar
|
55
|
+
time.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
|
57
56
|
end
|
58
57
|
|
59
58
|
def add_optional_params(params)
|
60
|
-
|
59
|
+
description_parts = []
|
60
|
+
description_parts << format_description if format_description
|
61
|
+
description_parts << "Virtual Meeting URL: #{format_url}" if format_url
|
62
|
+
params[:body] = url_encode(description_parts.join("\n\n")) if description_parts.any?
|
63
|
+
|
61
64
|
params[:location] = url_encode(format_location) if format_location
|
62
65
|
|
63
66
|
if attendees = attendees_list
|
@@ -42,6 +42,10 @@ module CalInvite
|
|
42
42
|
raise ArgumentError, "Start time is required" unless event.start_time
|
43
43
|
raise ArgumentError, "End time is required" unless event.end_time
|
44
44
|
|
45
|
+
description_parts = []
|
46
|
+
description_parts << format_description if format_description
|
47
|
+
description_parts << "Virtual Meeting URL: #{format_url}" if format_url
|
48
|
+
|
45
49
|
params = {
|
46
50
|
v: 60,
|
47
51
|
view: 'd',
|
@@ -49,7 +53,7 @@ module CalInvite
|
|
49
53
|
title: event.title,
|
50
54
|
st: format_time(event.start_time),
|
51
55
|
et: format_time(event.end_time),
|
52
|
-
desc:
|
56
|
+
desc: description_parts.join("\n\n"),
|
53
57
|
in_loc: format_location,
|
54
58
|
crnd: event.timezone
|
55
59
|
}
|
@@ -58,8 +62,6 @@ module CalInvite
|
|
58
62
|
end
|
59
63
|
|
60
64
|
def generate_multi_day_event
|
61
|
-
# Yahoo doesn't support multi-day events in a single URL
|
62
|
-
# Return multiple URLs, one for each session
|
63
65
|
sessions = event.multi_day_sessions.map do |session|
|
64
66
|
params = {
|
65
67
|
v: 60,
|
@@ -84,7 +86,8 @@ module CalInvite
|
|
84
86
|
end
|
85
87
|
|
86
88
|
def format_time(time)
|
87
|
-
|
89
|
+
# Always use UTC format for the URL, timezone is passed separately
|
90
|
+
time.utc.strftime("%Y%m%dT%H%M%SZ")
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
data/lib/cal_invite/providers.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# lib/cal_invite/providers.rb
|
4
|
+
require_relative 'providers/base_provider'
|
5
|
+
|
4
6
|
module CalInvite
|
5
7
|
module Providers
|
6
8
|
SUPPORTED_PROVIDERS = %i[google ical outlook yahoo ics office365].freeze
|
7
9
|
|
8
|
-
autoload :BaseProvider, 'cal_invite/providers/base_provider'
|
9
10
|
autoload :Google, 'cal_invite/providers/google'
|
10
11
|
autoload :Ical, 'cal_invite/providers/ical'
|
11
12
|
autoload :Outlook, 'cal_invite/providers/outlook'
|
12
13
|
autoload :Office365, 'cal_invite/providers/office365'
|
13
14
|
autoload :Yahoo, 'cal_invite/providers/yahoo'
|
15
|
+
autoload :IcsContent, 'cal_invite/providers/ics_content'
|
16
|
+
autoload :IcsDownload, 'cal_invite/providers/ics_content'
|
14
17
|
autoload :Ics, 'cal_invite/providers/ics'
|
15
|
-
|
16
18
|
end
|
17
19
|
end
|
data/lib/cal_invite/version.rb
CHANGED
data/lib/cal_invite.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# lib/cal_invite.rb
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/core_ext'
|
2
4
|
require 'securerandom'
|
3
5
|
require 'time'
|
4
6
|
require 'uri'
|
5
7
|
|
6
8
|
require 'cal_invite/version'
|
7
9
|
require 'cal_invite/configuration'
|
10
|
+
require 'cal_invite/caching'
|
8
11
|
require 'cal_invite/event'
|
9
12
|
require 'cal_invite/providers'
|
10
13
|
|
@@ -22,5 +25,8 @@ module CalInvite
|
|
22
25
|
def reset_configuration!
|
23
26
|
self.configuration = Configuration.new
|
24
27
|
end
|
28
|
+
|
29
|
+
# Include caching methods at the module level
|
30
|
+
include Caching
|
25
31
|
end
|
26
32
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cal-invite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephane Paquet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
13
27
|
description: CalInvite provides a simple way to generate calendar invite URLs for
|
14
28
|
various providers (Google, Outlook, Yahoo) and ICS files
|
15
29
|
email:
|
@@ -19,6 +33,7 @@ extensions: []
|
|
19
33
|
extra_rdoc_files: []
|
20
34
|
files:
|
21
35
|
- ".rubocop.yml"
|
36
|
+
- CACHING.md
|
22
37
|
- CHANGELOG.md
|
23
38
|
- CODE_OF_CONDUCT.md
|
24
39
|
- LICENSE.txt
|
@@ -28,6 +43,7 @@ files:
|
|
28
43
|
- gemfiles/Gemfile.rails7
|
29
44
|
- gemfiles/Gemfile.rails8
|
30
45
|
- lib/cal_invite.rb
|
46
|
+
- lib/cal_invite/caching.rb
|
31
47
|
- lib/cal_invite/configuration.rb
|
32
48
|
- lib/cal_invite/event.rb
|
33
49
|
- lib/cal_invite/providers.rb
|
@@ -35,6 +51,7 @@ files:
|
|
35
51
|
- lib/cal_invite/providers/google.rb
|
36
52
|
- lib/cal_invite/providers/ical.rb
|
37
53
|
- lib/cal_invite/providers/ics.rb
|
54
|
+
- lib/cal_invite/providers/ics_content.rb
|
38
55
|
- lib/cal_invite/providers/office365.rb
|
39
56
|
- lib/cal_invite/providers/outlook.rb
|
40
57
|
- lib/cal_invite/providers/yahoo.rb
|