omniauth-zoom 0.1.0 → 0.1.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: 828d66467f60af0483a276e8b5ffe8d9e36aa05c30f0776fd34701abb1acb91f
4
- data.tar.gz: a7983a8bdfdce90fa65f034924ebc94081904cae8d3264c9e1a3267a9fa46678
3
+ metadata.gz: a1f3099d19df722ab4f801ddda9e44eaff4d4d96c8497cd810633004ef92effa
4
+ data.tar.gz: 0a019d86402f77b45752e1ef700d9dd6a99ac1dedd10a2bd9db047fc2d7b547d
5
5
  SHA512:
6
- metadata.gz: 5b49341b7c53dbf7c37cd57430a31eb1234678bf24ade879858cf7376c807f5d25af0539554f0b94b2c9513b3590eb979496344626047e6b0447116287522b7c
7
- data.tar.gz: 71164e28b3c4450f734e0349dbc82bfbc34b346fc9fc5bad8fd9dffe6ca2fd132681c249bfbc98acd731edbd0b6caba652f10bcca63412b32903dea29f2b24bd
6
+ metadata.gz: f4bca33dbe6596ce2d61984173b871088fdd7bcbc77d866c23c982cd1b874836208a5ce24f8ec54a7a7eee97e815060b66dab6aed3b6548c985bdfb2b7f57998
7
+ data.tar.gz: a74b0c8f8be96b354be15d4750646a8cd6cab70b6fef9600325e359eda11858133a90a54d7b818bf193cb653ec58cdc82b3efa542161a17edc4dba50115d3359
@@ -0,0 +1,69 @@
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
+ AllowURI: true
27
+ Enabled: false
28
+
29
+ Metrics/MethodLength:
30
+ CountComments: false
31
+ Max: 15
32
+
33
+ Metrics/ParameterLists:
34
+ Max: 4
35
+ CountKeywordArgs: true
36
+
37
+ Metrics/AbcSize:
38
+ Enabled: false
39
+
40
+ Style/CollectionMethods:
41
+ PreferredMethods:
42
+ map: 'collect'
43
+ reduce: 'inject'
44
+ find: 'detect'
45
+ find_all: 'select'
46
+
47
+ Style/Documentation:
48
+ Enabled: false
49
+
50
+ Style/DoubleNegation:
51
+ Enabled: false
52
+
53
+ Style/EachWithObject:
54
+ Enabled: false
55
+
56
+ Style/Encoding:
57
+ Enabled: false
58
+
59
+ Style/ExpandPathArguments:
60
+ Enabled: false
61
+
62
+ Style/HashSyntax:
63
+ EnforcedStyle: hash_rockets
64
+
65
+ Style/Lambda:
66
+ Enabled: false
67
+
68
+ Style/RaiseArgs:
69
+ EnforcedStyle: compact
@@ -1,3 +1,7 @@
1
+ # 0.1.1
2
+
3
+ - refs #4 Add tests and make code coverage 100%.
4
+
1
5
  # 0.1.0
2
6
 
3
7
  - Initial release
data/README.md CHANGED
@@ -31,7 +31,7 @@ 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
- zoom_scopes = %i[user:read meeting:read meeting:write]
34
+ zoom_scopes = %i[user_profile meeting:write]
35
35
  provider :zoom, zoom_client_id, zoom_client_secret, :scope => zoom_scopes.join(',')
36
36
  end
37
37
  ```
@@ -44,49 +44,45 @@ The auth hash `request.env['omniauth.auth']` would look like this:
44
44
 
45
45
  ```js
46
46
  {
47
- "result": {
48
- "provider": "zoom",
49
- "uid": "KdYKjnimT4KPd8FFgQt9FQ",
50
- "info": {},
51
- "credentials": {
52
- "token": "ACCESS_TOKEN",
53
- "refresh_token": "REFRESH_TOKEN",
54
- "expires_at": 1594035991,
55
- "expires": true
56
- },
57
- "extra": {
58
- "raw_info": {
59
- "id": "KdYKjnimT4KPd8FFgQt9FQ",
60
- "first_name": "Jane",
61
- "last_name": "Dev",
62
- "email": "jane.dev@email.com",
63
- "type": 2,
64
- "role_name": "Owner",
65
- "pmi": 1234567890,
66
- "use_pmi": false,
67
- "vanity_url": "https://janedevinc.zoom.us/my/janedev",
68
- "personal_meeting_url": "https://janedevinc.zoom.us/j/1234567890",
69
- "timezone": "America/Denver",
70
- "verified": 1,
71
- "dept": "",
72
- "created_at": "2019-04-05T15:24:32Z",
73
- "last_login_time": "2019-12-16T18:02:48Z",
74
- "last_client_version": "4.6.12611.1124(mac)",
75
- "pic_url": "https://janedev.zoom.us/p/KdYKjnimFR5Td8KKdQt9FQ/19f6430f-ca72-4154-8998-ede6be4542c7-837",
76
- "host_key": "533895",
77
- "jid": "kdykjnimt4kpd8kkdqt9fq@xmpp.zoom.us",
78
- "group_ids": [],
79
- "im_group_ids": [
80
- "3NXCD9VFTCOUH8LD-QciGw"
81
- ],
82
- "account_id": "gVcjZnYYRLDbb_MfgHuaxg",
83
- "language": "en-US",
84
- "phone_country": "US",
85
- "phone_number": "+1 1234567891",
86
- "status": "active"
87
- }
88
- }
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"
89
84
  }
85
+ }
90
86
  }
91
87
  ```
92
88
 
@@ -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.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
@@ -6,51 +6,44 @@ require 'omniauth-oauth2'
6
6
 
7
7
  module OmniAuth
8
8
  module Strategies
9
+ # OmniAuth strategy for zoom.us
9
10
  class Zoom < OmniAuth::Strategies::OAuth2
10
11
  option :name, 'zoom'
11
- option :client_options, site: 'https://zoom.us'
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
- end
18
-
19
- protected
17
+ protected
20
18
 
21
19
  def build_access_token
22
20
  params = {
23
- grant_type: 'authorization_code',
24
- code: request.params['code'],
25
- redirect_uri: callback_url
21
+ :grant_type => 'authorization_code',
22
+ :code => request.params['code'],
23
+ :redirect_uri => callback_url
26
24
  }
27
- path = "#{client.options[:token_url]}?#{params.to_query}"
28
- token = Base64.strict_encode64("#{client.id}:#{client.secret}")
29
- opts = { headers: { Authorization: "Basic #{token}" } }
30
-
31
- response = client.request(:post, path, opts)
32
- access_token_opts = response.parsed.merge(deep_symbolize(options.auth_token_params))
33
- ::OAuth2::AccessToken.from_hash(client, access_token_opts).tap do |access_token|
34
- if access_token.respond_to?(:response=)
35
- access_token.response = response
36
- end
37
- end
38
- end
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}"}}
39
28
 
40
- def callback_url
41
- full_host + script_name + callback_path
29
+ res = client.request(:post, path, opts)
30
+ ::OAuth2::AccessToken.from_hash(client, res.parsed)
42
31
  end
43
32
 
33
+ private
34
+
44
35
  def raw_info
45
- return @raw_info unless @raw_info.nil?
36
+ return @raw_info if defined?(@raw_info)
46
37
 
47
- res = access_token.get('/v2/users/me')
48
- @raw_info = JSON.parse(res.body, symbolize_names: true)
38
+ @raw_info = access_token.get('/v2/users/me').parsed || {}
49
39
  rescue StandardError => e
50
- logger = OmniAuth.config.logger
51
- logger&.debug("#{self.class}.#{__method__} #{e.class} occured. message:#{e.message}")
40
+ log(:error, "#{e.class} occured. message:#{e.message}")
52
41
  @raw_info = {}
53
42
  end
43
+
44
+ def callback_url
45
+ full_host + script_name + callback_path
46
+ end
54
47
  end
55
48
  end
56
49
  end
@@ -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
 
@@ -35,6 +35,9 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'codecov', '~> 0.1.17'
36
36
  spec.add_development_dependency 'minitest', '~> 5.14.1'
37
37
  spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
38
+ spec.add_development_dependency 'omniauth', '~> 1.9.1'
39
+ spec.add_development_dependency 'rack-test', '~> 1.1.0'
38
40
  spec.add_development_dependency 'rake', '~> 13.0'
39
41
  spec.add_development_dependency 'simplecov', '~> 0.18.5'
42
+ spec.add_development_dependency 'webmock', '~> 3.7.6'
40
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-zoom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.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-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.4.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: omniauth
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.9.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.9.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack-test
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.1.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.1.0
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: rake
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +150,20 @@ dependencies:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
152
  version: 0.18.5
153
+ - !ruby/object:Gem::Dependency
154
+ name: webmock
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 3.7.6
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 3.7.6
125
167
  description: ''
126
168
  email:
127
169
  - koshikawa2009@gmail.com
@@ -132,6 +174,7 @@ files:
132
174
  - ".github/workflows/gem-push.yml"
133
175
  - ".github/workflows/test.yml"
134
176
  - ".gitignore"
177
+ - ".rubocop.yml"
135
178
  - CHANGELOG.md
136
179
  - CODE_OF_CONDUCT.md
137
180
  - Gemfile
@@ -151,7 +194,7 @@ metadata:
151
194
  homepage_uri: https://github.com/koshilife/omniauth-zoom
152
195
  source_code_uri: https://github.com/koshilife/omniauth-zoom
153
196
  changelog_uri: https://github.com/koshilife/omniauth-zoom/blob/master/CHANGELOG.md
154
- documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.1.0
197
+ documentation_uri: https://www.rubydoc.info/gems/omniauth-zoom/0.1.1
155
198
  post_install_message:
156
199
  rdoc_options: []
157
200
  require_paths: