class Google::Apis::CalendarV3::Event

Constants

MEETING_URL_REGEX

Public Instance Methods

already_started?() click to toggle source
# File lib/google/apis/calendar_v3/event.rb, line 22
def already_started?
  start.date_time <= DateTime.now
end
meeting_id() click to toggle source
# File lib/google/apis/calendar_v3/event.rb, line 10
def meeting_id
  @meeting_id ||= (matches[1] || matches[2])
end
meeting_url() click to toggle source
# 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?() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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

Private Instance Methods

matches() click to toggle source
# File lib/google/apis/calendar_v3/event.rb, line 41
def matches
  @matches ||= "#{location} #{description}".match(MEETING_URL_REGEX)
end
vanity_url?() click to toggle source
# File lib/google/apis/calendar_v3/event.rb, line 45
def vanity_url?
  meeting_id && meeting_id !~ /\A\d+\z/
end