omniauth-todoist 0.3 → 0.6.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
- SHA1:
3
- metadata.gz: 0935c38d959c38bb589902becff12c1e20c4e6ce
4
- data.tar.gz: 7dd6b444a59f460265d014b8ea253e5d923a424f
2
+ SHA256:
3
+ metadata.gz: d29816ef507d52e5326905bb48fb9dd46757d1eedaccf83f61b34e6529518cd3
4
+ data.tar.gz: 6fd8386c3f35661fe6fe03cc5e28a18c3116e69c0d2e34dbf247774592e72609
5
5
  SHA512:
6
- metadata.gz: 378aedbcd5d2384513131c4c1197f97fd92bc9737761190bb19877a5ba070df3b1a943e462405b5f32ceb37d1209f462e9b382337d1e718c461d013b4904e57c
7
- data.tar.gz: 7ed8853b3c0abe5ef8b0035d38a041fe2238cbce3284fb5bfd826249e0a95e896a1d176590739b23a3d9a82d2d519eaa48b0dab678960986fd25b2868b23ca86
6
+ metadata.gz: e274c236747373710172d8d40d3815030ea187532e3d282b0fa0e5e02bba783f85c3032cf7dbd3859fd3fa663be3f2165327acff40239440610c95120341687e
7
+ data.tar.gz: 859d83e0d937540fa60c7d429bbeef0d99b4e1d3694fd2faa659321ef261736033cecadc67a4e141fb79548b82bc08ac93090777007072e69f9d266d3f219e29
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ Gemfile.lock
@@ -5,39 +5,34 @@ require 'multi_json'
5
5
  module OmniAuth
6
6
  module Strategies
7
7
  class Todoist < OmniAuth::Strategies::OAuth2
8
- DEFAULT_SCOPE = 'data:read'
9
-
10
- # Give your strategy a name.
11
8
  option :name, "todoist"
12
9
 
13
- # This is where you pass the options you would pass when
14
- # initializing your consumer from the OAuth gem.
15
10
  option :client_options, {
16
- :site => "https://todoist.com",
17
- :authorize_url => "/oauth/authorize",
18
- :token_url => "/oauth/access_token"
11
+ site: "https://todoist.com",
12
+ authorize_url: "/oauth/authorize",
13
+ token_url: "/oauth/access_token"
19
14
  }
20
15
 
16
+ option :authorize_options, [:scope]
17
+
21
18
  # These are called after authentication has succeeded. If
22
19
  # possible, you should try to set the UID without making
23
20
  # additional calls (if the user id is returned with the token
24
21
  # or as a URI parameter). This may not be possible with all
25
22
  # providers.
26
- uid{ raw_info['id'] }
23
+ uid{ raw_info['id'].to_s }
27
24
 
28
25
  info do
29
- { :email => raw_info["email"],
30
- :name => raw_info["full_name"] }
26
+ prune!(
27
+ name: raw_info['full_name'],
28
+ email: raw_info['email'],
29
+ image: raw_info['avatar_big'],
30
+ time_zone: raw_info['tz_info']['timezone']
31
+ )
31
32
  end
32
-
33
- extra{ raw_info }
34
33
 
35
- def request_phase
36
- super
37
- end
38
-
39
- def callback_phase
40
- super
34
+ extra do
35
+ prune!(raw_info: raw_info)
41
36
  end
42
37
 
43
38
  # Bugfix for regression introduced after omniauth-oauth2 v1.3.1
@@ -47,25 +42,29 @@ module OmniAuth
47
42
  end
48
43
 
49
44
  def raw_info
50
- unless @raw_info
51
- user_info = access_token.post("/API/v7/sync", {
52
- body: {
53
- token: access_token.token,
54
- sync_token: "*",
55
- resource_types: '["user"]' },
45
+ @raw_info ||= begin
46
+ params = {
56
47
  headers: {
57
- "Content-Type"=>"application/x-www-form-urlencoded" }
58
- }).parsed
59
- if user_info["user"]
60
- @raw_info = user_info["user"]
61
- else
62
- @raw_info = {}
63
- end
48
+ "Content-Type" => "application/x-www-form-urlencoded"
49
+ },
50
+ body: {
51
+ token: access_token.token,
52
+ sync_token: "*",
53
+ resource_types: '["user"]'
54
+ }
55
+ }
56
+ access_token.post("https://api.todoist.com/sync/v9/sync", params).parsed.fetch('user', {})
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def prune!(hash)
63
+ hash.delete_if do |_, value|
64
+ prune!(value) if value.is_a?(Hash)
65
+ value.nil? || (value.respond_to?(:empty?) && value.empty?)
64
66
  end
65
- @raw_info
66
67
  end
67
68
  end
68
69
  end
69
70
  end
70
-
71
-
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Todoist
3
+ VERSION = "0.6.0"
4
+ end
5
+ end
@@ -1,15 +1,28 @@
1
- Gem::Specification.new do |gem|
2
- gem.name = 'omniauth-todoist'
3
- gem.version = '0.3'
4
- gem.date = Date.today.to_s
5
- gem.license = 'MIT'
6
- gem.summary = "OmniAuth strategy for Todoist"
7
- gem.description = "OmniAuth strategy for Todoist"
8
-
9
- gem.authors = ['Bethany Soule']
10
- gem.email = 'bsoule@beeminder.com'
11
- gem.homepage = 'https://github.com/beeminder/omniauth-todoist'
12
-
13
- gem.files = `git ls-files`.split("\n")
14
- gem.require_path = 'lib'
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/todoist/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "omniauth-todoist"
8
+ s.version = Omniauth::Todoist::VERSION
9
+ s.authors = ["Bethany Soule", "Joel Van Horn"]
10
+ s.email = ["bsoule@beeminder.com", "joel@joelvanhorn.com"]
11
+
12
+ s.summary = %q{OmniAuth strategy for Todoist}
13
+ s.description = %q{OmniAuth strategy for Todoist}
14
+ s.homepage = "https://github.com/beeminder/omniauth-todoist"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_runtime_dependency "omniauth", ">= 1.1.1"
23
+ s.add_runtime_dependency "omniauth-oauth2", ">= 1.3.1"
24
+
25
+ s.add_development_dependency "bundler"
26
+ s.add_development_dependency "rspec"
27
+ s.add_development_dependency "rake"
15
28
  end
metadata CHANGED
@@ -1,27 +1,101 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-todoist
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bethany Soule
8
+ - Joel Van Horn
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
12
- dependencies: []
12
+ date: 2022-12-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 1.1.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.1.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: omniauth-oauth2
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.3.1
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.3.1
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
13
84
  description: OmniAuth strategy for Todoist
14
- email: bsoule@beeminder.com
85
+ email:
86
+ - bsoule@beeminder.com
87
+ - joel@joelvanhorn.com
15
88
  executables: []
16
89
  extensions: []
17
90
  extra_rdoc_files: []
18
91
  files:
92
+ - ".gitignore"
19
93
  - Gemfile
20
94
  - LICENSE.txt
21
95
  - README.md
22
96
  - lib/omniauth-todoist.rb
23
97
  - lib/omniauth/strategies/todoist.rb
24
- - omniauth-todoist-0.1.gem
98
+ - lib/omniauth/todoist/version.rb
25
99
  - omniauth-todoist.gemspec
26
100
  homepage: https://github.com/beeminder/omniauth-todoist
27
101
  licenses:
@@ -43,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
117
  version: '0'
44
118
  requirements: []
45
119
  rubyforge_project:
46
- rubygems_version: 2.4.5
120
+ rubygems_version: 2.7.6.3
47
121
  signing_key:
48
122
  specification_version: 4
49
123
  summary: OmniAuth strategy for Todoist
Binary file