zoom_launcher 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 749f9399b1f7da6cec06469522d170acc99abd7a
4
- data.tar.gz: 935e1023661e5321d3c83c9e0e596766ec55f851
3
+ metadata.gz: a97115f729c88166794dd66c165edef9f485dc55
4
+ data.tar.gz: '08c006a6948afc194ca8aed68764caeb101716a3'
5
5
  SHA512:
6
- metadata.gz: cc441c828c94650ee851283209fc9a050e486c6fbed38d15336b401833aca3323b73ef6844d7148144714870459890e42f70b37c0439d71e96aff0047fd84f8d
7
- data.tar.gz: ab7c2bd1a1b2b037d93fc0eb1a86eea60a0eb9cfbb596d2fcc0d34407c4ce064ac2ed1334f902085ab184ebaf59ccba3d35bc9ddb6369ab8a284dad5de7f3c4c
6
+ metadata.gz: ce8c748864d9bc5f73f9f56852f3b9d34922eef47d96e99e5de6a997aa74d3f271786465af723b1b78e17b47dd7babe6852721d74647b4a2877974639f05f6bb
7
+ data.tar.gz: 766228884541290465858cf0dacd87bd2e2834574e30bfd7974489984b202319b333943c65f4727e552aaea2aed09a461779cd2c3c9e16314187729634fdf08b
data/README.md CHANGED
@@ -19,13 +19,22 @@ Oh, and here's the URL in case you need it: https://www.google.com/calendar/even
19
19
 
20
20
  ## Setup
21
21
 
22
- In order to use Zoom Launcher, you need to create an OAuth app and authorize it to access your calendar:
23
-
24
- 1. Go to https://console.developers.google.com and create a new project (you may need to switch to your work account)
25
- 2. Click "Credentials" on the left side and create a new OAuth credential with type "other" for that project
26
- 3. Create a new OAuth credential, and download the resulting JSON file
27
- 4. Move the file to `~/.config/google/client_secrets.json`
28
- 5. Run `zoom auth` and follow the instructions to authorize the app
22
+ In order to use Zoom Launcher, you need to create an OAuth app and authorize it to access your calendar. You can do it in four, not-so-easy steps:
23
+
24
+ 1. Create a new project
25
+ 1. Go to https://console.developers.google.com
26
+ 2. Switch to your work account if need be (top right)
27
+ 3. Create a new project dropdown, top left next to your domain
28
+ 2. Grant the project Calendar API access
29
+ 1. Click "Enable API"
30
+ 2. Type "Calendar" in the search box
31
+ 3. Click "Calendar API"
32
+ 4. Click "Enable"
33
+ 3. Grab your creds
34
+ 1. Click "Credentials" on the left side
35
+ 2. Create a new OAuth credential with type "other"
36
+ 3. Download the credential to `~/.config/google/client_secrets.json` (icon, right side)
37
+ 4. Run `zoom auth` and follow the instructions to authorize the app
29
38
 
30
39
  ## Project status
31
40
 
@@ -4,12 +4,19 @@ module Google
4
4
  module Apis
5
5
  module CalendarV3
6
6
  class Event
7
- MEETING_URL_REGEX = %r{https://.*\.zoom\.us/j/\d+}
7
+ MEETING_URL_REGEX = %r{https://.*?\.zoom\.us/(?:j/(\d+)|my/(\S+))}
8
8
  include ActionView::Helpers::DateHelper
9
9
 
10
+ def meeting_id
11
+ @meeting_id ||= (matches[1] || matches[2])
12
+ end
13
+
10
14
  def meeting_url
11
- matches = (location + description).match(MEETING_URL_REGEX)
12
- matches[0] if matches
15
+ @meeting_url ||= URI(matches[0]) if matches
16
+ end
17
+
18
+ def zoom_url
19
+ "zoommtg://zoom.us/join?confno=#{meeting_id}" if meeting_id && !vanity_url?
13
20
  end
14
21
 
15
22
  def already_started?
@@ -28,6 +35,16 @@ module Google
28
35
  "in #{distance}".bold
29
36
  end
30
37
  end
38
+
39
+ private
40
+
41
+ def matches
42
+ @matches ||= "#{location} #{description}".match(MEETING_URL_REGEX)
43
+ end
44
+
45
+ def vanity_url?
46
+ meeting_id && meeting_id !~ /\A\d+\z/
47
+ end
31
48
  end
32
49
  end
33
50
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'uri'
4
+
3
5
  module ZoomLauncher
4
6
  class CLI < GoogleAuth
5
7
  CALENDAR = 'primary'
@@ -22,15 +24,14 @@ module ZoomLauncher
22
24
  puts
23
25
 
24
26
  if next_event.more_than_five_minutes_from_now?
25
- puts "Here's the Zoom URL: #{next_event.meeting_url.bold}"
27
+ puts "Here's the Zoom URL: #{next_event.meeting_url.to_s.bold}"
26
28
  else
27
- puts "Opening #{next_event.meeting_url.bold}..."
28
- `open #{next_event.meeting_url}`
29
-
29
+ puts "Opening #{next_event.meeting_url.to_s.bold}..."
30
+ `open #{next_event.zoom_url || next_event.meeting_url}`
30
31
  end
31
32
  puts "Oh, and here's the URL in case you need it: #{next_event.html_link}"
32
33
  else
33
- puts "Can't find any upcomming Zoom meetings"
34
+ puts "Can't find any upcoming Zoom meetings"
34
35
  end
35
36
  end
36
37
 
@@ -56,7 +56,7 @@ module ZoomLauncher
56
56
  end
57
57
 
58
58
  # Returns user credentials for the given scope. Requests authorization
59
- # if requrired.
59
+ # if required.
60
60
  def user_credentials_for(scope)
61
61
  FileUtils.mkdir_p(File.dirname(token_store_path))
62
62
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZoomLauncher
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.email = ['ben.balter@github.com']
13
13
 
14
14
  spec.summary = 'A command line tool for joining your next Zoom meeting'
15
- spec.homepage = "https://github.com/benbalter/zoom-launcher"
15
+ spec.homepage = 'https://github.com/benbalter/zoom-launcher'
16
16
  spec.license = 'MIT'
17
17
 
18
18
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoom_launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-31 00:00:00.000000000 Z
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview