zoom_slack 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +32 -0
- data/Rakefile +3 -0
- data/bin/zoom_slack +8 -0
- data/lib/zoom_slack.rb +10 -0
- data/lib/zoom_slack/process_detector/factory.rb +10 -0
- data/lib/zoom_slack/process_detector/mac.rb +32 -0
- data/lib/zoom_slack/process_detector/source/in_zoom_meeting.applescript +11 -0
- data/lib/zoom_slack/profile_updater.rb +45 -0
- data/lib/zoom_slack/status.rb +7 -0
- data/lib/zoom_slack/syncer.rb +32 -0
- data/lib/zoom_slack/version.rb +5 -0
- data/zoom_slack.gemspec +23 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c1ef070b91f2106a719a6692ec1dc922a7eb92b3
|
4
|
+
data.tar.gz: 6fa3e4c5fcaa389a623fa0b1419dd0401c3cb3e1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6e975763ae19ebd3c87674117da6ca35b44a6d09b58520bd770933ce6e1b038e176e5236283912a1f5270223f6c8fc1216ec5cd25b71cb2de7c3f18f8d00a2c0
|
7
|
+
data.tar.gz: 40f1e2584259d236eb61530477a8c9d9a5ec8ef787c387a7925394e3936e6e52fb3f6de01871f61ce61df3085a5623b6032d6eff49171a08eb50947b8f710426
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.5
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
### Added
|
9
|
+
- Initial version, working on Mac.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Burke Webster
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# zoom_slack
|
2
|
+
|
3
|
+
This gem provides an easy way to automatically set your Slack status any time you are in a Zoom meeting.
|
4
|
+
|
5
|
+
The current implementation will only work on Mac OS X, but other operating system implementations are welcome!
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
Install via Rubygems
|
10
|
+
|
11
|
+
gem install zoom_slack
|
12
|
+
|
13
|
+
Next, [create a new Slack app](#Creating-a-New-App), and install it in your workspace to get a oauth token.
|
14
|
+
|
15
|
+
Then add a cron entry via `crontab -e` like this
|
16
|
+
|
17
|
+
* * * * * zoom_slack <oauth_access_token>
|
18
|
+
|
19
|
+
## Creating a New App
|
20
|
+
|
21
|
+
You can obtain an oauth token by creating a new app and installing it into your workspace with these directions:
|
22
|
+
|
23
|
+
1. Go to https://api.slack.com/apps
|
24
|
+
1. Click "Create New App"
|
25
|
+
1. Give it an App Name (like "zoom_slack"), and assign it to your Workspace
|
26
|
+
1. Click "Create App"
|
27
|
+
1. Click "Permissions"
|
28
|
+
1. Add the "Modify user's profile" scope
|
29
|
+
1. Click "Save Changes"
|
30
|
+
1. Under the "Settings" sidebar, click "Install App", then click "Install App to Workspace"
|
31
|
+
1. Click "Authorize"
|
32
|
+
1. Copy you OAuth Access Token
|
data/Rakefile
ADDED
data/bin/zoom_slack
ADDED
data/lib/zoom_slack.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tmpdir"
|
4
|
+
|
5
|
+
module ZoomSlack
|
6
|
+
module ProcessDetector
|
7
|
+
class Mac
|
8
|
+
def running?
|
9
|
+
compile
|
10
|
+
process_running?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def compile
|
16
|
+
`osacompile -o #{bin_path} #{source_path}` unless Dir.exist?(bin_path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def process_running?
|
20
|
+
`osascript #{bin_path}`.chomp == "true"
|
21
|
+
end
|
22
|
+
|
23
|
+
def bin_path
|
24
|
+
@bin_path ||= File.join(Dir.tmpdir, "in_zoom_meeting.scptd")
|
25
|
+
end
|
26
|
+
|
27
|
+
def source_path
|
28
|
+
@source_path ||= File.join(File.dirname(__FILE__), "source", "in_zoom_meeting.applescript")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
tell application "System Events"
|
2
|
+
try
|
3
|
+
if exists (window 2 of process "zoom.us") then
|
4
|
+
#do shell script "~/bin/update_slack_status meeting"
|
5
|
+
return true
|
6
|
+
else
|
7
|
+
#do shell script "~/bin/update_slack_status clear"
|
8
|
+
return false
|
9
|
+
end if
|
10
|
+
end try
|
11
|
+
end tell
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module ZoomSlack
|
7
|
+
class ProfileUpdater
|
8
|
+
def initialize(token:)
|
9
|
+
self.token = token
|
10
|
+
end
|
11
|
+
|
12
|
+
def status(status)
|
13
|
+
update_profile status
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_accessor :token
|
19
|
+
|
20
|
+
def update_profile(status)
|
21
|
+
response = connection.post do |req|
|
22
|
+
req.url "/api/users.profile.set"
|
23
|
+
req.headers["Content-Type"] = "application/json;charset=utf-8"
|
24
|
+
req.body = JSON.generate(profile: {
|
25
|
+
status_text: status.text,
|
26
|
+
status_emoji: status.emoji,
|
27
|
+
status_expiration: status.expires
|
28
|
+
})
|
29
|
+
end
|
30
|
+
human_readable_error response
|
31
|
+
end
|
32
|
+
|
33
|
+
def human_readable_error(response)
|
34
|
+
json = JSON.parse(response.body)
|
35
|
+
puts "Unable to update Slack profile. Did you pass in the right token?" unless json.fetch("ok")
|
36
|
+
end
|
37
|
+
|
38
|
+
def connection
|
39
|
+
Faraday.new(url: "https://slack.com") do |faraday|
|
40
|
+
faraday.adapter Faraday.default_adapter
|
41
|
+
faraday.authorization :Bearer, token
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ZoomSlack
|
4
|
+
class Syncer
|
5
|
+
def initialize(token:,
|
6
|
+
profile_updater: ProfileUpdater.new(token: token),
|
7
|
+
process_detector: ProcessDetector.for_platform)
|
8
|
+
self.profile_updater = profile_updater
|
9
|
+
self.process_detector = process_detector
|
10
|
+
end
|
11
|
+
|
12
|
+
def sync
|
13
|
+
if process_detector.running?
|
14
|
+
profile_updater.status in_meeting_status
|
15
|
+
else
|
16
|
+
profile_updater.status clear_status
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_accessor :profile_updater, :process_detector
|
23
|
+
|
24
|
+
def in_meeting_status
|
25
|
+
Status.new(text: "In a meeting", emoji: ":spiral_calendar_pad:", expires: 0)
|
26
|
+
end
|
27
|
+
|
28
|
+
def clear_status
|
29
|
+
Status.new
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/zoom_slack.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "zoom_slack"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
s.date = "2018-11-29"
|
7
|
+
s.summary = "Zoom to Slack integration"
|
8
|
+
s.description = "Automatically update your Slack status when you're in a Zoom meeting."
|
9
|
+
s.authors = ["Burke Webster"]
|
10
|
+
s.email = "burke.webster@gmail.com"
|
11
|
+
s.homepage = "https://github.com/bwebster/zoom_slack"
|
12
|
+
s.license = "MIT"
|
13
|
+
|
14
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
s.bindir = "bin"
|
16
|
+
s.executables << "zoom_slack"
|
17
|
+
|
18
|
+
s.add_dependency "faraday"
|
19
|
+
s.add_dependency "immutable-struct"
|
20
|
+
|
21
|
+
s.add_development_dependency "bundler"
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zoom_slack
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Burke Webster
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: immutable-struct
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Automatically update your Slack status when you're in a Zoom meeting.
|
70
|
+
email: burke.webster@gmail.com
|
71
|
+
executables:
|
72
|
+
- zoom_slack
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".ruby-version"
|
78
|
+
- CHANGELOG.md
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/zoom_slack
|
84
|
+
- lib/zoom_slack.rb
|
85
|
+
- lib/zoom_slack/process_detector/factory.rb
|
86
|
+
- lib/zoom_slack/process_detector/mac.rb
|
87
|
+
- lib/zoom_slack/process_detector/source/in_zoom_meeting.applescript
|
88
|
+
- lib/zoom_slack/profile_updater.rb
|
89
|
+
- lib/zoom_slack/status.rb
|
90
|
+
- lib/zoom_slack/syncer.rb
|
91
|
+
- lib/zoom_slack/version.rb
|
92
|
+
- zoom_slack.gemspec
|
93
|
+
homepage: https://github.com/bwebster/zoom_slack
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.6.14.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Zoom to Slack integration
|
117
|
+
test_files: []
|