omnievent-google 0.1.0.pre4 → 0.1.0.pre8
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/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/omnievent/google/version.rb +1 -1
- data/lib/omnievent/strategies/google.rb +63 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c27cea477531aef1fc66a13555b4b0edae51a40900ad67f39e589908bf1dd3b9
|
|
4
|
+
data.tar.gz: 4daa816ca5235d338dfd6da7ef9c1b40f9837ee583dfeab589554e441e61b664
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1345db0b10103218aff0070bd72bf86ca81cc9a4912b023eadec0dc5a9135e20f5e2cea5c8f9ee9ee8d0b17a38523e5e5f0257df4ce8e0eef80d8c07fa09d69
|
|
7
|
+
data.tar.gz: 40138bf32bd1fc2dbc7e65cd6ddb6331f3b3377bd1f15d9a8d519572b3619c1c39b7b7c8d60cddf89cb586292aa3d4775ca9ebc1b0fb74cce5c9273a7070b31c
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -12,6 +12,12 @@ module OmniEvent
|
|
|
12
12
|
option :name, "google"
|
|
13
13
|
|
|
14
14
|
API_VERSION = "v3"
|
|
15
|
+
STATUS_MAP = {
|
|
16
|
+
"needsAction" => "invited",
|
|
17
|
+
"accepted" => "confirmed",
|
|
18
|
+
"declined" => "declined",
|
|
19
|
+
"tentative" => "tentative"
|
|
20
|
+
}.freeze
|
|
15
21
|
|
|
16
22
|
def raw_events
|
|
17
23
|
response = perform_request(path: path_with_params(request_path, list_params))
|
|
@@ -103,10 +109,16 @@ module OmniEvent
|
|
|
103
109
|
updated_at: format_time(raw_event["updated"])
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
associated_data = {
|
|
113
|
+
registrations: get_registrations(raw_event),
|
|
114
|
+
virtual_location: get_virtual_location(raw_event)
|
|
115
|
+
}
|
|
116
|
+
|
|
106
117
|
OmniEvent::EventHash.new(
|
|
107
118
|
provider: name,
|
|
108
119
|
data: data,
|
|
109
|
-
metadata: metadata
|
|
120
|
+
metadata: metadata,
|
|
121
|
+
associated_data: associated_data
|
|
110
122
|
)
|
|
111
123
|
end
|
|
112
124
|
|
|
@@ -119,6 +131,9 @@ module OmniEvent
|
|
|
119
131
|
body["start"] = format_omnievent_datetime_for_google(options.event.data.start_time)
|
|
120
132
|
end
|
|
121
133
|
body["end"] = format_omnievent_datetime_for_google(options.event.data.end_time) if options.event.data.end_time
|
|
134
|
+
if options.event.associated_data&.registrations
|
|
135
|
+
body["attendees"] = convert_registrations_to_attendees(options.event.associated_data.registrations)
|
|
136
|
+
end
|
|
122
137
|
body
|
|
123
138
|
end
|
|
124
139
|
end
|
|
@@ -166,6 +181,53 @@ module OmniEvent
|
|
|
166
181
|
params
|
|
167
182
|
end
|
|
168
183
|
end
|
|
184
|
+
|
|
185
|
+
def convert_registrations_to_attendees(registrations)
|
|
186
|
+
return nil unless registrations
|
|
187
|
+
|
|
188
|
+
registrations.map do |registration|
|
|
189
|
+
result = {}
|
|
190
|
+
result[:id] = registration[:uid] if registration[:uid]
|
|
191
|
+
result[:displayName] = registration[:name] if registration[:name]
|
|
192
|
+
result[:email] = registration[:email] if registration[:email]
|
|
193
|
+
result[:responseStatus] = STATUS_MAP.key(registration[:status].to_s) if registration[:status]
|
|
194
|
+
result
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def get_registrations(raw_event)
|
|
199
|
+
return [] unless raw_event && raw_event["attendees"]
|
|
200
|
+
|
|
201
|
+
raw_event["attendees"].map do |attendee|
|
|
202
|
+
{
|
|
203
|
+
uid: attendee["id"],
|
|
204
|
+
name: attendee["displayName"],
|
|
205
|
+
email: attendee["email"],
|
|
206
|
+
status: STATUS_MAP[attendee["responseStatus"].to_s]
|
|
207
|
+
}
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
def get_virtual_location(raw_event)
|
|
212
|
+
video_url = if raw_event["hangoutLink"]
|
|
213
|
+
raw_event["hangoutLink"]
|
|
214
|
+
elsif OmniEvent::Utils.valid_url?(raw_event["location"])
|
|
215
|
+
raw_event["location"]
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
return unless video_url
|
|
219
|
+
|
|
220
|
+
{
|
|
221
|
+
entry_points: [
|
|
222
|
+
{
|
|
223
|
+
type: "video",
|
|
224
|
+
uri: video_url,
|
|
225
|
+
label: "",
|
|
226
|
+
code: ""
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
end
|
|
169
231
|
end
|
|
170
232
|
end
|
|
171
233
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omnievent-google
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0.
|
|
4
|
+
version: 0.1.0.pre8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Angus McLeod
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-11-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omnievent
|