omniauth-savvycal 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.dir-locals.el +2 -0
- data/.standard.yml +3 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +62 -0
- data/Rakefile +14 -0
- data/lib/omniauth/savvycal/strategy.rb +25 -0
- data/lib/omniauth/savvycal/version.rb +7 -0
- data/lib/omniauth/savvycal.rb +4 -0
- data/lib/omniauth/strategies/savvycal.rb +47 -0
- data/omniauth-savvycal.gemspec +39 -0
- data/sig/omniauth/savvycal.rbs +6 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 945356c5202471eecef5412d1cfabcaf22a2028fb3304ed814feb44f25b28155
|
4
|
+
data.tar.gz: aae7a807e55bb267d78f0f039e3b5037526adf67b5216abcf023edb0f55e3513
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 397d8f5a5d18c5f167d8126a62a1150c53da7e9d12379f4672863a9ef0657e679bb75716cd1eec118276ae5730d59c04fb4e0a331139d00b5c9c010d9f6c849f
|
7
|
+
data.tar.gz: 9ec37b463c26efab7a47017b20a8a72981321d0d42eb624e4bfdddb4cf8c49965429a09621916eae65773a2c988814d0bb607141589f45a88e7b9bbddc6fb95f
|
data/.dir-locals.el
ADDED
data/.standard.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Julian Rubisch
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Omniauth::Savvycal
|
2
|
+
|
3
|
+
This gem provides an OmniAuth strategy for authenticating with [SavvyCal](https://www.savvycal.com)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-savvycal'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install omniauth-savvycal
|
20
|
+
|
21
|
+
## Basic Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
use OmniAuth::Builder do
|
25
|
+
provider :savvycal, ENV['SAVVYCAL_KEY'], ENV['SAVVYCAL_SECRET']
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
|
30
|
+
## Basic Usage Rails
|
31
|
+
|
32
|
+
In `config/initializers/savvycal.rb`
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
36
|
+
provider :savvycal, ENV['SAVVYCAL_KEY'], ENV['SAVVYCAL_SECRET']
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
### With Devise
|
41
|
+
|
42
|
+
In `config/initializers/devise.rb`
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
config.omniauth :savvycal, ENV['SAVVYCAL_KEY'], ENV['SAVVYCAL_SECRET']
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
53
|
+
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
Bug reports and pull requests are welcome on Savvycal at https://savvycal.com/julianrubisch/omniauth-savvycal.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "standard/rake"
|
13
|
+
|
14
|
+
task default: %i[test standard]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class SavvyCal < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
site: "https://api.savvycal.com",
|
8
|
+
authorize_url: "https://savvycal.com/oauth/authorize",
|
9
|
+
token_url: "https://savvycal.com/oauth/token"
|
10
|
+
}
|
11
|
+
|
12
|
+
uid { raw_info["id"].to_s }
|
13
|
+
|
14
|
+
extra do
|
15
|
+
{raw_info: raw_info}
|
16
|
+
end
|
17
|
+
|
18
|
+
def raw_info
|
19
|
+
@raw_info ||= access_token.get("user").parsed
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
OmniAuth.config.add_camelization "savvycal", "SavvyCal"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class SavvyCal < OmniAuth::Strategies::OAuth2
|
6
|
+
option :name, "savvycal"
|
7
|
+
option :client_options, {
|
8
|
+
site: "https://api.savvycal.com/v1",
|
9
|
+
authorize_url: "https://savvycal.com/oauth/authorize",
|
10
|
+
token_url: "https://savvycal.com/oauth/token"
|
11
|
+
}
|
12
|
+
|
13
|
+
uid { raw_info["id"].to_s }
|
14
|
+
|
15
|
+
info do
|
16
|
+
{
|
17
|
+
first_name: raw_info["first_name"],
|
18
|
+
last_name: raw_info["last_name"],
|
19
|
+
email: raw_info["email"]
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
extra do
|
24
|
+
{raw_info: raw_info}
|
25
|
+
end
|
26
|
+
|
27
|
+
def raw_info
|
28
|
+
@raw_info ||= access_token.get("me", {headers: {"Authorization" => "Bearer #{access_token.token}"}}).parsed
|
29
|
+
end
|
30
|
+
|
31
|
+
def callback_url
|
32
|
+
options[:callback_url] || (full_host + callback_path)
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_access_token
|
36
|
+
options.token_params.merge!(
|
37
|
+
client_id: options.client_id,
|
38
|
+
client_secret: options.client_secret
|
39
|
+
)
|
40
|
+
|
41
|
+
super
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
OmniAuth.config.add_camelization "savvycal", "SavvyCal"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/omniauth/savvycal/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "omniauth-savvycal"
|
7
|
+
spec.version = Omniauth::Savvycal::VERSION
|
8
|
+
spec.authors = ["Julian Rubisch"]
|
9
|
+
spec.email = ["julian@julianrubisch.at"]
|
10
|
+
|
11
|
+
spec.summary = "OmniAuth Strategy for SavvyCal"
|
12
|
+
spec.description = "OmniAuth Strategy for SavvyCal"
|
13
|
+
spec.homepage = "https://github.com/julianrubisch/omniauth-savvycal"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/julianrubisch/omniauth-savvycal"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
24
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
# Uncomment to register a new dependency of your gem
|
32
|
+
spec.add_dependency "omniauth", "~> 2.0"
|
33
|
+
spec.add_dependency "omniauth-oauth2", "~> 1.7.1"
|
34
|
+
|
35
|
+
spec.add_development_dependency "minitest"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-savvycal
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julian Rubisch
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-09-12 00:00:00.000000000 Z
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: omniauth-oauth2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: OmniAuth Strategy for SavvyCal
|
56
|
+
email:
|
57
|
+
- julian@julianrubisch.at
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".dir-locals.el"
|
63
|
+
- ".standard.yml"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/omniauth/savvycal.rb
|
69
|
+
- lib/omniauth/savvycal/strategy.rb
|
70
|
+
- lib/omniauth/savvycal/version.rb
|
71
|
+
- lib/omniauth/strategies/savvycal.rb
|
72
|
+
- omniauth-savvycal.gemspec
|
73
|
+
- sig/omniauth/savvycal.rbs
|
74
|
+
homepage: https://github.com/julianrubisch/omniauth-savvycal
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata:
|
78
|
+
homepage_uri: https://github.com/julianrubisch/omniauth-savvycal
|
79
|
+
source_code_uri: https://github.com/julianrubisch/omniauth-savvycal
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.6.0
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubygems_version: 3.3.7
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: OmniAuth Strategy for SavvyCal
|
99
|
+
test_files: []
|