omniauth-calendly 0.0.1.alpha → 1.0.0

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: a47a1210cb70e91c44bf8f42907b44c292f101baf5ad93dc5fac58d873b0d473
4
- data.tar.gz: 5c1cb8c3b4b170cd622b80412926f97d318565d1c97ffab73dd730cc517445c0
3
+ metadata.gz: 00d5fefb7352e94038ea44123d0782214eb37b75003ca5a8cd97c456f46955eb
4
+ data.tar.gz: ea79fdd4f4d5673a8b4c2cab5869317e803dcba606add68750fec9772ce281f8
5
5
  SHA512:
6
- metadata.gz: f5dc0d3b3778a0851cb0248a7e82c7d8f58186c729b855c18175c56a4c2b01679047b3dd91a6fa71142b36f421ae7cca194d0c5fb0aff58b0c685b8df922acf1
7
- data.tar.gz: f5e645cfd64c4f95caa3bf9c271cd294117a08d47706fae35b4e9f3e8c262471772fcdce07ef4dced8e746113b754a859dd212438d0e5fe82fd9dd7539e65d06
6
+ metadata.gz: abb3fc2786daf892bb8c7a6eb913b5fe73b9a6b52966366054bb999fadf5bf761c876c21396574f6f0fbd98a91e651664107a9406c5dbc90efc5e374810fce6d
7
+ data.tar.gz: e8e8e4731de4650c19e22dbc0e543b906ea12b1fab2b0aa32bbd887d8ecd0c9668113cdc398ca133aed14a701f89f8e0c315c9a0bac7a4ee60a48fd030c0008f
data/.rubocop.yml CHANGED
@@ -23,12 +23,11 @@ Metrics/BlockNesting:
23
23
  Max: 2
24
24
 
25
25
  Layout/LineLength:
26
- AllowURI: true
27
- Enabled: false
26
+ Max: 120
28
27
 
29
28
  Metrics/MethodLength:
30
29
  CountComments: false
31
- Max: 15
30
+ Max: 20
32
31
 
33
32
  Metrics/ParameterLists:
34
33
  Max: 4
@@ -60,10 +59,13 @@ Style/ExpandPathArguments:
60
59
  Enabled: false
61
60
 
62
61
  Style/HashSyntax:
63
- EnforcedStyle: hash_rockets
62
+ EnforcedStyle: ruby19
64
63
 
65
64
  Style/Lambda:
66
65
  Enabled: false
67
66
 
68
67
  Style/RaiseArgs:
69
68
  EnforcedStyle: compact
69
+
70
+ Style/AsciiComments:
71
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
- # 0.0.1.alpha
1
+ # CHANGELOG
2
+
3
+ ## 1.0.0
4
+
5
+ - allowed for omniauth 2.0 series.
6
+
7
+ ## 0.3.0
8
+
9
+ - be specified dependency for omniauth 1.9.
10
+
11
+ ## 0.2.1
12
+
13
+ - fix rubocop warnings.
14
+
15
+ ## 0.2.0
16
+
17
+ - refs #5 fix dependencies.
18
+ - remove minitest-reporter.
19
+
20
+ ## 0.1.0
21
+
22
+ - #1 extract uid from user api response.
23
+ - #2 make coverage 100%.
24
+
25
+ ## 0.0.1.alpha
2
26
 
3
27
  - Initial release
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
- TODO
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
data/Rakefile CHANGED
@@ -9,4 +9,4 @@ Rake::TestTask.new(:test) do |t|
9
9
  t.test_files = FileList['test/**/*_test.rb']
10
10
  end
11
11
 
12
- task :default => :test
12
+ task default: :test
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Calendly
5
- VERSION = '0.0.1.alpha'
5
+ VERSION = '1.0.0'
6
6
  end
7
7
  end
@@ -7,25 +7,37 @@ module OmniAuth
7
7
  # OmniAuth strategy for Calendly
8
8
  class Calendly < OmniAuth::Strategies::OAuth2
9
9
  option :name, 'calendly'
10
- option :client_options, :site => 'https://auth.calendly.com'
10
+ option :client_options, site: 'https://auth.calendly.com'
11
11
 
12
- uid { raw_info['id'] }
13
- extra { {:raw_info => raw_info} }
12
+ USER_API_URL = 'https://api.calendly.com/users/'
13
+
14
+ uid { extract_uid }
15
+ extra { {raw_info: raw_info} }
14
16
 
15
17
  private
16
18
 
17
19
  def raw_info
18
20
  return @raw_info if defined?(@raw_info)
19
21
 
20
- endpoint = 'https://api.calendly.com/users/me'
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
- full_host + script_name + callback_path
26
+ full_host + callback_path
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]
29
41
  end
30
42
  end
31
43
  end
@@ -28,14 +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 'omniauth', '~> 2.0'
32
+ spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.7.1'
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 'omniauth', '~> 1.9.1'
38
- spec.add_development_dependency 'rake', '~> 13.0'
39
- spec.add_development_dependency 'simplecov', '~> 0.18.5'
40
- spec.add_development_dependency 'webmock', '~> 3.7.6'
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'
41
42
  end
metadata CHANGED
@@ -1,141 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-calendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
4
+ version: 1.0.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-03 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
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
- version: 1.6.0
33
+ version: 1.7.1
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
- version: 1.6.0
40
+ version: 1.7.1
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'
83
97
  - !ruby/object:Gem::Dependency
84
- name: omniauth
98
+ name: rack-test
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: 1.9.1
103
+ version: '0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: 1.9.1
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rake
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '13.0'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '13.0'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: simplecov
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: 0.18.5
131
+ version: '0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - "~>"
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: 0.18.5
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: 3.7.6
145
+ version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: 3.7.6
152
+ version: '0'
139
153
  description: ''
140
154
  email:
141
155
  - koshikawa2009@gmail.com
@@ -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.0.1.alpha
183
+ documentation_uri: https://www.rubydoc.info/gems/omniauth-calendly/1.0.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: 1.3.1
197
+ version: '0'
184
198
  requirements: []
185
199
  rubygems_version: 3.0.3
186
200
  signing_key: