omniauth-zoom 0.0.1 → 0.2.1

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
  SHA256:
3
- metadata.gz: aa4294741f1df3f9a9ae4ff1cb73eac7eb499a2fa8ed6f87540b251d8fc4798b
4
- data.tar.gz: 45c5a9fdc85e7efd5f7dabab8b3cf6d7fdcf5ddf7e83c7068e798930366033bf
3
+ metadata.gz: 2d0df87b2e92b61de2b23d86f48177b2ff7a02763c41b5633c7a78c91f3630d5
4
+ data.tar.gz: 8c375cfa778c72415d4d565e63c214048dad00cf12193ee00492486a374f4fd9
5
5
  SHA512:
6
- metadata.gz: dc8f04e1533d1e5c7b7101908f068ee6fad98c16845eebac9d32dd0abbede078e1e2a218a5853cc0bf53546b1ed916f13bb21360cabb4f0d34bd53ee29692a39
7
- data.tar.gz: 1e3fc9916a8bbd9ef259d305db613385cd342a61afbb485adf403c710926b104ad2c1972bffa84d77676707543752a002f7c27c88c79f06fd3c2e9e93c98ba95
6
+ metadata.gz: 7997a196e912f1b63985f35c7ae43c548497f5355fb409794b9662804fe0f47ad043655cd1eeb80721381c102a3a2cd2f21fdcb70bcaec9c0bbbc05f3d78d558
7
+ data.tar.gz: 90718a1fc0fe0dd89c377db42e934f2a876ee000e56ec19ab19d36b80fbb7565811a845c8796685a66486d1b6a6899466f73546245d7311564388cfdfd7f8a0a
@@ -32,5 +32,6 @@ jobs:
32
32
  printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
33
  gem build *.gemspec
34
34
  gem push *.gem
35
+ continue-on-error: true
35
36
  env:
36
37
  GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,71 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Layout/AccessModifierIndentation:
5
+ EnforcedStyle: outdent
6
+
7
+ Layout/HashAlignment:
8
+ Enabled: false
9
+
10
+ Layout/DotPosition:
11
+ EnforcedStyle: trailing
12
+
13
+ Layout/SpaceInsideHashLiteralBraces:
14
+ EnforcedStyle: no_space
15
+
16
+ Lint/SuppressedException:
17
+ Enabled: false
18
+
19
+ Metrics/BlockLength:
20
+ Enabled: false
21
+
22
+ Metrics/BlockNesting:
23
+ Max: 2
24
+
25
+ Layout/LineLength:
26
+ Max: 120
27
+
28
+ Metrics/MethodLength:
29
+ CountComments: false
30
+ Max: 20
31
+
32
+ Metrics/ParameterLists:
33
+ Max: 4
34
+ CountKeywordArgs: true
35
+
36
+ Metrics/AbcSize:
37
+ Enabled: false
38
+
39
+ Style/CollectionMethods:
40
+ PreferredMethods:
41
+ map: "collect"
42
+ reduce: "inject"
43
+ find: "detect"
44
+ find_all: "select"
45
+
46
+ Style/Documentation:
47
+ Enabled: false
48
+
49
+ Style/DoubleNegation:
50
+ Enabled: false
51
+
52
+ Style/EachWithObject:
53
+ Enabled: false
54
+
55
+ Style/Encoding:
56
+ Enabled: false
57
+
58
+ Style/ExpandPathArguments:
59
+ Enabled: false
60
+
61
+ Style/HashSyntax:
62
+ EnforcedStyle: ruby19
63
+
64
+ Style/Lambda:
65
+ Enabled: false
66
+
67
+ Style/RaiseArgs:
68
+ EnforcedStyle: compact
69
+
70
+ Style/AsciiComments:
71
+ Enabled: false
@@ -0,0 +1,22 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.2.1
4
+
5
+ - fix rubocop warnings.
6
+
7
+ ## 0.2.0
8
+
9
+ - refs #11 fix library dependencies.
10
+ - remove minitest-reporter.
11
+
12
+ ## 0.1.2
13
+
14
+ - make the error handling when missing scope for reading user info better.
15
+
16
+ ## 0.1.1
17
+
18
+ - refs #4 Add tests and make code coverage 100%.
19
+
20
+ ## 0.1.0
21
+
22
+ - Initial release
data/README.md CHANGED
@@ -31,7 +31,8 @@ Next, tell OmniAuth about this provider. For a Rails app, your `config/initializ
31
31
 
32
32
  ```ruby
33
33
  Rails.application.config.middleware.use OmniAuth::Builder do
34
- provider :zoom, "API_KEY", "API_SECRET"
34
+ zoom_scopes = %i[user_profile meeting:write]
35
+ provider :zoom, zoom_client_id, zoom_client_secret, :scope => zoom_scopes.join(',')
35
36
  end
36
37
  ```
37
38
 
@@ -42,7 +43,47 @@ Replace `"API_KEY"` and `"API_SECRET"` with the appropriate values you obtained
42
43
  The auth hash `request.env['omniauth.auth']` would look like this:
43
44
 
44
45
  ```js
45
- TODO
46
+ {
47
+ "provider": "zoom",
48
+ "uid": "KdYKjnimT4KPd8FFgQt9FQ",
49
+ "info": {},
50
+ "credentials": {
51
+ "token": "ACCESS_TOKEN",
52
+ "refresh_token": "REFRESH_TOKEN",
53
+ "expires_at": 1594035991,
54
+ "expires": true
55
+ },
56
+ "extra": {
57
+ "raw_info": {
58
+ "id": "KdYKjnimT4KPd8FFgQt9FQ",
59
+ "first_name": "Jane",
60
+ "last_name": "Dev",
61
+ "email": "jane.dev@email.com",
62
+ "type": 2,
63
+ "role_name": "Owner",
64
+ "pmi": 1234567890,
65
+ "use_pmi": false,
66
+ "vanity_url": "https://janedevinc.zoom.us/my/janedev",
67
+ "personal_meeting_url": "https://janedevinc.zoom.us/j/1234567890",
68
+ "timezone": "America/Denver",
69
+ "verified": 1,
70
+ "dept": "",
71
+ "created_at": "2019-04-05T15:24:32Z",
72
+ "last_login_time": "2019-12-16T18:02:48Z",
73
+ "last_client_version": "4.6.12611.1124(mac)",
74
+ "pic_url": "https://janedev.zoom.us/p/KdYKjnimFR5Td8KKdQt9FQ/19f6430f-ca72-4154-8998-ede6be4542c7-837",
75
+ "host_key": "533895",
76
+ "jid": "kdykjnimt4kpd8kkdqt9fq@xmpp.zoom.us",
77
+ "group_ids": [],
78
+ "im_group_ids": ["3NXCD9VFTCOUH8LD-QciGw"],
79
+ "account_id": "gVcjZnYYRLDbb_MfgHuaxg",
80
+ "language": "en-US",
81
+ "phone_country": "US",
82
+ "phone_number": "+1 1234567891",
83
+ "status": "active"
84
+ }
85
+ }
86
+ }
46
87
  ```
47
88
 
48
89
  ## Contributing
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
3
5
 
4
6
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
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"
4
+ require 'bundler/setup'
5
+ require 'omniauth-zoom'
6
+ require 'irb'
14
7
  IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -4,5 +4,3 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omniauth
3
+ module OmniAuth
4
4
  module Zoom
5
- VERSION = '0.0.1'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
@@ -1,26 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'base64'
4
+ require 'oauth2'
3
5
  require 'omniauth-oauth2'
4
6
 
5
7
  module OmniAuth
6
8
  module Strategies
9
+ # OmniAuth strategy for zoom.us
7
10
  class Zoom < OmniAuth::Strategies::OAuth2
8
11
  option :name, 'zoom'
9
- option :client_options, site: 'https://zoom.us',
10
- authorize_url: '/oauth/authorize',
11
- token_url: '/oauth/token'
12
+ option :client_options, site: 'https://zoom.us'
12
13
 
13
- uid { raw_info[:id] }
14
+ uid { raw_info['id'] }
15
+ extra { {raw_info: raw_info} }
14
16
 
15
- extra do
16
- { raw_info: raw_info }
17
+ protected
18
+
19
+ def build_access_token
20
+ params = {
21
+ grant_type: 'authorization_code',
22
+ code: request.params['code'],
23
+ redirect_uri: callback_url
24
+ }
25
+ path = "#{client.options[:token_url]}?#{URI.encode_www_form(params)}"
26
+ headers_secret = Base64.strict_encode64("#{client.id}:#{client.secret}")
27
+ opts = {headers: {Authorization: "Basic #{headers_secret}"}}
28
+
29
+ res = client.request(:post, path, opts)
30
+ ::OAuth2::AccessToken.from_hash(client, res.parsed)
17
31
  end
18
32
 
33
+ private
34
+
19
35
  def raw_info
20
- return @raw_info unless @raw_info.nil?
36
+ return @raw_info if defined?(@raw_info)
37
+
38
+ @raw_info = access_token.get('/v2/users/me').parsed || {}
39
+ rescue ::OAuth2::Error => e
40
+ raise e unless e.response.status == 400
21
41
 
22
- res = access_token.get '/v2/users/me'
23
- @raw_info = JSON.parse(res.body, symbolize_names: true)
42
+ # in case of missing a scope for reading current user info
43
+ log(:error, "#{e.class} occured. message:#{e.message}")
44
+ @raw_info = {}
24
45
  end
25
46
 
26
47
  def callback_url
@@ -4,7 +4,7 @@ require_relative 'lib/omniauth-zoom/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'omniauth-zoom'
7
- spec.version = Omniauth::Zoom::VERSION
7
+ spec.version = OmniAuth::Zoom::VERSION
8
8
  spec.authors = ['Kenji Koshikawa']
9
9
  spec.email = ['koshikawa2009@gmail.com']
10
10
 
@@ -28,12 +28,15 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.6.0'
31
+ spec.add_runtime_dependency 'oauth2', '>= 1.4.4'
32
+ spec.add_runtime_dependency 'omniauth-oauth2', '>= 1.6.0'
32
33
 
33
- spec.add_development_dependency 'bundler', '~> 2.1'
34
- spec.add_development_dependency 'codecov', '~> 0.1.17'
35
- spec.add_development_dependency 'minitest', '~> 5.14.1'
36
- spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
37
- spec.add_development_dependency 'rake', '~> 13.0'
38
- spec.add_development_dependency 'simplecov', '~> 0.18.5'
34
+ spec.add_development_dependency 'bundler'
35
+ spec.add_development_dependency 'codecov'
36
+ spec.add_development_dependency 'minitest'
37
+ spec.add_development_dependency 'omniauth'
38
+ spec.add_development_dependency 'rack-test'
39
+ spec.add_development_dependency 'rake'
40
+ spec.add_development_dependency 'simplecov'
41
+ spec.add_development_dependency 'webmock'
39
42
  end
metadata CHANGED
@@ -1,113 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-zoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenji Koshikawa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-06 00:00:00.000000000 Z
11
+ date: 2020-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.4.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.4.4
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: omniauth-oauth2
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
- - - "~>"
31
+ - - ">="
18
32
  - !ruby/object:Gem::Version
19
33
  version: 1.6.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
- - - "~>"
38
+ - - ">="
25
39
  - !ruby/object:Gem::Version
26
40
  version: 1.6.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
- - - "~>"
45
+ - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '2.1'
47
+ version: '0'
34
48
  type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
- - - "~>"
52
+ - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '2.1'
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: codecov
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: 0.1.17
61
+ version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "~>"
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: 0.1.17
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 5.14.1
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 5.14.1
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: minitest-reporters
84
+ name: omniauth
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: 1.4.2
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: 1.4.2
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rack-test
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rake
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - "~>"
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
- version: '13.0'
117
+ version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - "~>"
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
- version: '13.0'
124
+ version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - "~>"
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: webmock
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
102
144
  - !ruby/object:Gem::Version
103
- version: 0.18.5
145
+ version: '0'
104
146
  type: :development
105
147
  prerelease: false
106
148
  version_requirements: !ruby/object:Gem::Requirement
107
149
  requirements:
108
- - - "~>"
150
+ - - ">="
109
151
  - !ruby/object:Gem::Version
110
- version: 0.18.5
152
+ version: '0'
111
153
  description: ''
112
154
  email:
113
155
  - koshikawa2009@gmail.com
@@ -118,6 +160,8 @@ files:
118
160
  - ".github/workflows/gem-push.yml"
119
161
  - ".github/workflows/test.yml"
120
162
  - ".gitignore"
163
+ - ".rubocop.yml"
164
+ - CHANGELOG.md
121
165
  - CODE_OF_CONDUCT.md
122
166
  - Gemfile
123
167
  - LICENSE.txt
@@ -136,7 +180,7 @@ metadata:
136
180
  homepage_uri: https://github.com/koshilife/omniauth-zoom
137
181
  source_code_uri: https://github.com/koshilife/omniauth-zoom
138
182
  changelog_uri: https://github.com/koshilife/omniauth-zoom/blob/master/CHANGELOG.md
139
- documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.0.1
183
+ documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.2.1
140
184
  post_install_message:
141
185
  rdoc_options: []
142
186
  require_paths: