Class: CalendarAssistant::Event
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- CalendarAssistant::Event
show all
- Includes:
- HasDuration
- Defined in:
- lib/calendar_assistant/event.rb
Defined Under Namespace
Modules: RealResponse, Response, Transparency, Visibility
Constant Summary
collapse
- PREDICATES =
{
"response": %I[
accepted?
declined?
awaiting?
tentative?
],
"temporal": %I[
all_day?
past?
current?
future?
],
"visibility": %I[
private?
public?
explicitly_visible?
visible_guestlist?
],
"attributes": %I[
location_event?
self?
one_on_one?
busy?
commitment?
recurring?
abandoned?
anyone_can_add_self?
attendees_omitted?
end_time_unspecified?
guests_can_invite_others?
guests_can_modify?
guests_can_see_other_guests?
private_copy?
locked?
needs_action?
],
}
Class Method Summary
collapse
Instance Method Summary
collapse
#all_day?, cast_datetime, #contains?, #cover?, #current?, #duration, duration_in_seconds, #duration_in_seconds, #end_date, #end_time, #future?, #overlaps_end_of?, #overlaps_start_of?, #past?, #start_date, #start_time
Constructor Details
#initialize(obj, config: CalendarAssistant::Config.new) ⇒ Event
85
86
87
88
|
# File 'lib/calendar_assistant/event.rb', line 85
def initialize(obj, config: CalendarAssistant::Config.new)
super(obj)
@config = config
end
|
Class Method Details
.location_event_prefix(config) ⇒ Object
Instance Method Details
#abandoned? ⇒ Boolean
154
155
156
157
158
159
160
161
|
# File 'lib/calendar_assistant/event.rb', line 154
def abandoned?
return false if declined? || self? || response_status.nil? || !visible_guestlist?
human_attendees.each do |attendee|
next if attendee.self
return false if attendee.response_status != CalendarAssistant::Event::Response::DECLINED
end
return true
end
|
#attendee(id) ⇒ Object
178
179
180
181
182
183
|
# File 'lib/calendar_assistant/event.rb', line 178
def attendee(id)
return nil if attendees.nil?
attendees.find do |attendee|
attendee.email == id
end
end
|
#av_uri ⇒ Object
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/calendar_assistant/event.rb', line 193
def av_uri
@av_uri ||= begin
if conference_data && conference_data.conference_solution.name == "Zoom Meeting"
return conference_data.entry_points.detect{|d| d.entry_point_type == "video" }.uri
end
description_link = CalendarAssistant::StringHelpers.find_uri_for_domain(description, "zoom.us")
return description_link if description_link
location_link = CalendarAssistant::StringHelpers.find_uri_for_domain(location, "zoom.us")
return location_link if location_link
return hangout_link if hangout_link
nil
end
end
|
#awaiting? ⇒ Boolean
Also known as:
needs_action?
#commitment? ⇒ Boolean
132
133
134
135
136
|
# File 'lib/calendar_assistant/event.rb', line 132
def commitment?
return false if human_attendees.nil? || human_attendees.length < 2
return false if declined?
true
end
|
#explicitly_visible? ⇒ Boolean
146
147
148
|
# File 'lib/calendar_assistant/event.rb', line 146
def explicitly_visible?
private? || public?
end
|
#human_attendees ⇒ Object
173
174
175
176
|
# File 'lib/calendar_assistant/event.rb', line 173
def human_attendees
return nil if attendees.nil?
attendees.select { |a| !a.resource }
end
|
#location_event? ⇒ Boolean
95
96
97
|
# File 'lib/calendar_assistant/event.rb', line 95
def location_event?
!!summary.try(:starts_with?, Event.location_event_prefix(@config))
end
|
#one_on_one? ⇒ Boolean
121
122
123
124
125
126
|
# File 'lib/calendar_assistant/event.rb', line 121
def one_on_one?
return false if attendees.nil?
return false unless attendees.any? { |a| a.self }
return false if human_attendees.length != 2
true
end
|
#other_human_attendees ⇒ Object
168
169
170
171
|
# File 'lib/calendar_assistant/event.rb', line 168
def other_human_attendees
return nil if attendees.nil?
attendees.select { |a| !a.resource && !a.self }
end
|
#recurring? ⇒ Boolean
150
151
152
|
# File 'lib/calendar_assistant/event.rb', line 150
def recurring?
!!recurring_event_id
end
|
#response_status ⇒ Object
185
186
187
188
189
190
191
|
# File 'lib/calendar_assistant/event.rb', line 185
def response_status
return CalendarAssistant::Event::Response::SELF if attendees.nil?
attendees.each do |attendee|
return attendee.response_status if attendee.self
end
nil
end
|
#update(**args) ⇒ Object
90
91
92
93
|
# File 'lib/calendar_assistant/event.rb', line 90
def update(**args)
update!(**args)
self
end
|
#visible_guestlist? ⇒ Boolean
163
164
165
166
|
# File 'lib/calendar_assistant/event.rb', line 163
def visible_guestlist?
gcsog = guests_can_see_other_guests?
gcsog.nil? ? true : !!gcsog
end
|