Skip to content
This repository was archived by the owner on Jun 29, 2024. It is now read-only.

Commit d195f61

Browse files
committed
first commit
0 parents  commit d195f61

File tree

16 files changed

+357
-0
lines changed

16 files changed

+357
-0
lines changed

.github/workflows/gem-push.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Ruby Gem
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build:
9+
name: Build + Publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Ruby 2.6
15+
uses: actions/setup-ruby@v1
16+
with:
17+
ruby-version: 2.6
18+
19+
- name: Build and test
20+
run: |
21+
gem install bundler
22+
bundle install --jobs 4 --retry 3
23+
bundle exec rspec
24+
env:
25+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
26+
27+
- name: Publish to RubyGems
28+
run: |
29+
mkdir -p $HOME/.gem
30+
touch $HOME/.gem/credentials
31+
chmod 0600 $HOME/.gem/credentials
32+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33+
gem build *.gemspec
34+
gem push *.gem
35+
env:
36+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on: pull_request
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Ruby
12+
uses: ruby/setup-ruby@v1
13+
with:
14+
ruby-version: 2.6
15+
- name: Build and test
16+
run: |
17+
gem install bundler
18+
bundle install --jobs 4 --retry 3
19+
bundle exec rspec
20+
env:
21+
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
Gemfile.lock

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at koshikawa2009@gmail.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [https://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: https://contributor-covenant.org
74+
[version]: https://contributor-covenant.org/version/1/4/

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source "https://rubygems.org"
2+
3+
# Specify your gem's dependencies in omniauth-zoom.gemspec
4+
gemspec
5+

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2020 Kenji Koshikawa
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
13+
all 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
21+
THE SOFTWARE.

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# OmniAuth::Zoom
2+
3+
[![Test](https://github.com/koshilife/omniauth-zoom/workflows/Test/badge.svg)](https://github.com/koshilife/omniauth-zoom/actions?query=workflow%3ATest)
4+
[![codecov](https://codecov.io/gh/koshilife/omniauth-zoom/branch/master/graph/badge.svg)](https://codecov.io/gh/koshilife/omniauth-zoom)
5+
[![Gem Version](https://badge.fury.io/rb/omniauth-zoom.svg)](http://badge.fury.io/rb/omniauth-zoom)
6+
[![license](https://img.shields.io/github/license/koshilife/omniauth-zoom)](https://github.com/koshilife/omniauth-zoom/blob/master/LICENSE.txt)
7+
8+
This gem contains the [zoom.us](https://zoom.us/) strategy for OmniAuth.
9+
10+
## Before You Begin
11+
12+
You should have already installed OmniAuth into your app; if not, read the [OmniAuth README](https://github.com/intridea/omniauth) to get started.
13+
14+
Now sign into the [zoom App Marketplace](https://marketplace.zoom.us/docs/guides) and create an application. Take note of your API keys.
15+
16+
## Using This Strategy
17+
18+
First start by adding this gem to your Gemfile:
19+
20+
```ruby
21+
gem 'omniauth-zoom'
22+
```
23+
24+
If you need to use the latest HEAD version, you can do so with:
25+
26+
```ruby
27+
gem 'omniauth-zoom', :github => 'koshilife/omniauth-zoom'
28+
```
29+
30+
Next, tell OmniAuth about this provider. For a Rails app, your `config/initializers/omniauth.rb` file should look like this:
31+
32+
```ruby
33+
Rails.application.config.middleware.use OmniAuth::Builder do
34+
provider :zoom, "API_KEY", "API_SECRET"
35+
end
36+
```
37+
38+
Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained [earlier](https://marketplace.zoom.us/user/build).
39+
40+
## Auth Hash Example
41+
42+
The auth hash `request.env['omniauth.auth']` would look like this:
43+
44+
```js
45+
TODO
46+
```
47+
48+
## Contributing
49+
50+
Bug reports and pull requests are welcome on [GitHub](https://github.com/koshilife/omniauth-zoom). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51+
52+
## License
53+
54+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
55+
56+
## Code of Conduct
57+
58+
Everyone interacting in the omniauth-zoom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/koshilife/omniauth-zoom/blob/master/CODE_OF_CONDUCT.md).

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require "bundler/gem_tasks"
2+
require "rake/testtask"
3+
4+
Rake::TestTask.new(:test) do |t|
5+
t.libs << "test"
6+
t.libs << "lib"
7+
t.test_files = FileList["test/**/*_test.rb"]
8+
end
9+
10+
task :default => :test

bin/console

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env ruby
2+
3+
require "bundler/setup"
4+
require "omniauth/zoom"
5+
6+
# You can add fixtures and/or initialization code here to make experimenting
7+
# with your gem easier. You can also use a different console, if you like.
8+
9+
# (If you use this, don't forget to add pry to your Gemfile!)
10+
# require "pry"
11+
# Pry.start
12+
13+
require "irb"
14+
IRB.start(__FILE__)

bin/setup

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install
7+
8+
# Do any other automated setup that you need to do here

lib/omniauth-zoom.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
require 'omniauth-zoom/version'
4+
require 'omniauth/strategies/zoom'

lib/omniauth-zoom/version.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
module Omniauth
4+
module Zoom
5+
VERSION = '0.0.1'
6+
end
7+
end

lib/omniauth/strategies/zoom.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# frozen_string_literal: true
2+
3+
require 'omniauth-oauth2'
4+
5+
module OmniAuth
6+
module Strategies
7+
class Zoom < OmniAuth::Strategies::OAuth2
8+
option :name, 'zoom'
9+
option :client_options, site: 'https://zoom.us',
10+
authorize_url: '/oauth/authorize',
11+
token_url: '/oauth/token'
12+
13+
uid { raw_info[:id] }
14+
15+
extra do
16+
{ raw_info: raw_info }
17+
end
18+
19+
def raw_info
20+
return @raw_info unless @raw_info.nil?
21+
22+
res = access_token.get '/v2/users/me'
23+
@raw_info = JSON.parse(res.body, symbolize_names: true)
24+
end
25+
26+
def callback_url
27+
full_host + script_name + callback_path
28+
end
29+
end
30+
end
31+
end

omniauth-zoom.gemspec

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'lib/omniauth-zoom/version'
4+
5+
Gem::Specification.new do |spec|
6+
spec.name = 'omniauth-zoom'
7+
spec.version = Omniauth::Zoom::VERSION
8+
spec.authors = ['Kenji Koshikawa']
9+
spec.email = ['koshikawa2009@gmail.com']
10+
11+
spec.summary = 'OmniAuth strategy for zoom.us'
12+
spec.description = spec.description
13+
spec.homepage = 'https://github.com/koshilife/omniauth-zoom'
14+
spec.license = 'MIT'
15+
spec.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
16+
17+
spec.metadata['homepage_uri'] = spec.homepage
18+
spec.metadata['source_code_uri'] = 'https://github.com/koshilife/omniauth-zoom'
19+
spec.metadata['changelog_uri'] = "#{spec.metadata['source_code_uri']}/blob/master/CHANGELOG.md"
20+
spec.metadata['documentation_uri'] = "https://www.rubydoc.info/gems/omniauth-zoom/#{spec.version}"
21+
22+
# Specify which files should be added to the gem when it is released.
23+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
25+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26+
end
27+
spec.bindir = 'exe'
28+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29+
spec.require_paths = ['lib']
30+
31+
spec.add_development_dependency 'bundler', '~> 2.1'
32+
spec.add_development_dependency 'codecov', '~> 0.1.17'
33+
spec.add_development_dependency 'minitest', '~> 5.14.1'
34+
spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
35+
spec.add_development_dependency 'rake', '~> 13.0'
36+
spec.add_development_dependency 'simplecov', '~> 0.18.5'
37+
end

test/omniauth/zoom_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require "test_helper"
2+
3+
class Omniauth::ZoomTest < Minitest::Test
4+
def test_that_it_has_a_version_number
5+
refute_nil ::Omniauth::Zoom::VERSION
6+
end
7+
8+
def test_it_does_something_useful
9+
assert false
10+
end
11+
end

test/test_helper.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
2+
3+
require 'simplecov'
4+
SimpleCov.start
5+
if ENV['CI'] == 'true'
6+
require 'codecov'
7+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
8+
end
9+
require "omniauth/zoom"
10+
require "minitest/autorun"

0 commit comments

Comments
 (0)