class ZoomLauncher::CLI

Constants

ARGUMENTS
CALENDAR

Public Instance Methods

auth() click to toggle source
# File lib/zoom_launcher/cli.rb, line 39
def auth
  calendar.authorization = user_credentials_for(
    Google::Apis::CalendarV3::AUTH_CALENDAR
  )
end
calendar() click to toggle source
# File lib/zoom_launcher/cli.rb, line 51
def calendar
  @calendar ||= Google::Apis::CalendarV3::CalendarService.new
end
events() click to toggle source
# File lib/zoom_launcher/cli.rb, line 55
def events
  @events ||= calendar.list_events(CALENDAR, ARGUMENTS)
end
launch() click to toggle source
# File lib/zoom_launcher/cli.rb, line 18
def launch
  auth
  if next_event.meeting_url
    puts "Your next Zoom meeting is \"#{next_event.summary.bold}\"."
    is_was = next_event.already_started? ? 'was' : 'is'
    puts "It #{is_was} scheduled to start #{next_event.start_time_in_words}."
    puts

    if next_event.more_than_five_minutes_from_now?
      puts "Here's the Zoom URL: #{next_event.meeting_url.to_s.bold}"
    else
      puts "Opening #{next_event.meeting_url.to_s.bold}..."
      `open #{next_event.zoom_url || next_event.meeting_url}`
    end
    puts "Oh, and here's the URL in case you need it: #{next_event.html_link}"
  else
    puts "Can't find any upcoming Zoom meetings"
  end
end
logout() click to toggle source
# File lib/zoom_launcher/cli.rb, line 46
def logout
  FileUtils.rm_rf token_store_path
end
next_event() click to toggle source
# File lib/zoom_launcher/cli.rb, line 59
def next_event
  @next_event ||= events.items.first
end