omniauth-calendly 0.0.1.alpha → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +28 -1
- data/lib/omniauth-calendly/version.rb +1 -1
- data/lib/omniauth/strategies/calendly.rb +18 -6
- data/omniauth-calendly.gemspec +1 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07db7da420c059a9aad8a228031254fca84856d76654cfe65985d02a4c5e6e8a
|
4
|
+
data.tar.gz: ad34222ebfcce6696565943487e2aeef521bf7171e17600011ec9e28d7b857e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8cb083df5432b150c61d044c9e4c0b868776bceada4371562a83c43373d294914833f83c88f61f07dd196138312cca39f6a69cbd0acefa1789176615f4acc25
|
7
|
+
data.tar.gz: 6c25a690bace4d4c4944a4f8ca7dddb44f35ba740c2b059c1492169e4dd1886d240ac12f71d65b98815b12cb2ecaf12798a198c07eb312050e3c55ae40f0b928
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -47,7 +47,34 @@ end
|
|
47
47
|
The auth hash `request.env['omniauth.auth']` would look like this:
|
48
48
|
|
49
49
|
```js
|
50
|
-
|
50
|
+
{
|
51
|
+
"result": {
|
52
|
+
"provider": "calendly",
|
53
|
+
"uid": "U12345678",
|
54
|
+
"info": {},
|
55
|
+
"credentials": {
|
56
|
+
"token": "ACCESS_TOKEN",
|
57
|
+
"refresh_token": "REFRESH_TOKEN",
|
58
|
+
"expires_at": 1596529477,
|
59
|
+
"expires": true
|
60
|
+
},
|
61
|
+
"extra": {
|
62
|
+
"raw_info": {
|
63
|
+
"resource": {
|
64
|
+
"avatar_url": "https://xxx.cloudfront.net/uploads/user/avatar/xxx/xxx.gif",
|
65
|
+
"created_at": "2020-07-17T05:36:18.596606Z",
|
66
|
+
"email": "hoge@example.com",
|
67
|
+
"name": "USER_NAME",
|
68
|
+
"scheduling_url": "https://calendly.com/hogehoge",
|
69
|
+
"slug": "hogehoge",
|
70
|
+
"timezone": "Asia/Tokyo",
|
71
|
+
"updated_at": "2020-08-03T15:28:55.101449Z",
|
72
|
+
"uri": "https://api.calendly.com/users/U12345678"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
51
78
|
```
|
52
79
|
|
53
80
|
## Contributing
|
@@ -9,7 +9,9 @@ module OmniAuth
|
|
9
9
|
option :name, 'calendly'
|
10
10
|
option :client_options, :site => 'https://auth.calendly.com'
|
11
11
|
|
12
|
-
|
12
|
+
USER_API_URL = 'https://api.calendly.com/users/'
|
13
|
+
|
14
|
+
uid { extract_uid }
|
13
15
|
extra { {:raw_info => raw_info} }
|
14
16
|
|
15
17
|
private
|
@@ -17,16 +19,26 @@ module OmniAuth
|
|
17
19
|
def raw_info
|
18
20
|
return @raw_info if defined?(@raw_info)
|
19
21
|
|
20
|
-
|
21
|
-
@raw_info = access_token.get(endpoint).parsed
|
22
|
-
rescue ::OAuth2::Error => e
|
23
|
-
log(:error, "#{e.class} occured. message:#{e.message}")
|
24
|
-
@raw_info = {}
|
22
|
+
@raw_info = access_token.get("#{USER_API_URL}me").parsed
|
25
23
|
end
|
26
24
|
|
27
25
|
def callback_url
|
28
26
|
full_host + script_name + callback_path
|
29
27
|
end
|
28
|
+
|
29
|
+
def extract_uid
|
30
|
+
user_info = raw_info
|
31
|
+
return unless user_info
|
32
|
+
return unless raw_info['resource']
|
33
|
+
return unless raw_info['resource']['uri']
|
34
|
+
|
35
|
+
uri = raw_info['resource']['uri']
|
36
|
+
re = /\A#{USER_API_URL}(.+)\z/
|
37
|
+
m = re.match uri
|
38
|
+
return if m.nil?
|
39
|
+
|
40
|
+
m[1]
|
41
|
+
end
|
30
42
|
end
|
31
43
|
end
|
32
44
|
end
|
data/omniauth-calendly.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency 'minitest', '~> 5.14.1'
|
36
36
|
spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
|
37
37
|
spec.add_development_dependency 'omniauth', '~> 1.9.1'
|
38
|
+
spec.add_development_dependency 'rack-test', '~> 1.1.0'
|
38
39
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
40
|
spec.add_development_dependency 'simplecov', '~> 0.18.5'
|
40
41
|
spec.add_development_dependency 'webmock', '~> 3.7.6'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-calendly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
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-08-
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.9.1
|
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: 1.1.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.1.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,7 +180,7 @@ metadata:
|
|
166
180
|
homepage_uri: https://github.com/koshilife/omniauth-calendly
|
167
181
|
source_code_uri: https://github.com/koshilife/omniauth-calendly
|
168
182
|
changelog_uri: https://github.com/koshilife/omniauth-calendly/blob/master/CHANGELOG.md
|
169
|
-
documentation_uri: https://www.rubydoc.info/gems/omniauth-calendly/0.
|
183
|
+
documentation_uri: https://www.rubydoc.info/gems/omniauth-calendly/0.1.0
|
170
184
|
post_install_message:
|
171
185
|
rdoc_options: []
|
172
186
|
require_paths:
|
@@ -178,9 +192,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
192
|
version: 2.4.0
|
179
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
194
|
requirements:
|
181
|
-
- - "
|
195
|
+
- - ">="
|
182
196
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
197
|
+
version: '0'
|
184
198
|
requirements: []
|
185
199
|
rubygems_version: 3.0.3
|
186
200
|
signing_key:
|