Class: Google::Apis::CalendarV3::Event
- Inherits:
-
Object
- Object
- Google::Apis::CalendarV3::Event
- Includes:
- ActionView::Helpers::DateHelper
- Defined in:
- lib/google/apis/calendar_v3/event.rb
Constant Summary collapse
- MEETING_URL_REGEX =
%r{https://.*?\.zoom\.us/(?:j/(\d+)|my/(\S+))}
Instance Method Summary collapse
- #already_started? ⇒ Boolean
- #meeting_id ⇒ Object
- #meeting_url ⇒ Object
- #more_than_five_minutes_from_now? ⇒ Boolean
- #start_time_in_words ⇒ Object
- #zoom_url ⇒ Object
Instance Method Details
#already_started? ⇒ Boolean
22 23 24 |
# File 'lib/google/apis/calendar_v3/event.rb', line 22 def already_started? start.date_time <= DateTime.now end |
#meeting_id ⇒ Object
10 11 12 |
# File 'lib/google/apis/calendar_v3/event.rb', line 10 def meeting_id @meeting_id ||= (matches[1] || matches[2]) end |
#meeting_url ⇒ Object
14 15 16 |
# File 'lib/google/apis/calendar_v3/event.rb', line 14 def meeting_url @meeting_url ||= URI(matches[0]) if matches end |
#more_than_five_minutes_from_now? ⇒ Boolean
26 27 28 |
# File 'lib/google/apis/calendar_v3/event.rb', line 26 def more_than_five_minutes_from_now? start.date_time.to_time >= (DateTime.now.to_time + 5 * 60) end |
#start_time_in_words ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/google/apis/calendar_v3/event.rb', line 30 def start_time_in_words distance = time_ago_in_words(start.date_time) if already_started? "#{distance} ago".bold.red else "in #{distance}".bold end end |
#zoom_url ⇒ Object
18 19 20 |
# File 'lib/google/apis/calendar_v3/event.rb', line 18 def zoom_url "zoommtg://zoom.us/join?confno=#{meeting_id}" if meeting_id && !vanity_url? end |