omniauth-parasut 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f453ecbede380e0cf60e0154dd8db8cc7519230
4
+ data.tar.gz: 38f986233da3f96b31f5745dd1812d1b0f0f477b
5
+ SHA512:
6
+ metadata.gz: 79f9a6474d6f35684a0abd05653a8571803768b6165560ae569a64dc4186c1c0a1b81d3fb21f6081598d2d697d4c52d7172ccab6953d6318bab7c7c7a99ffc7a
7
+ data.tar.gz: 37490a266846c45ce1b4168525e04cc3e175fa7fb4d4f0d6fbd2e534bb906db325585c46699059cc65f64ac33ce63a0e9b7b6cd531362cdc18a915824179de87
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,59 @@
1
+ # This is the configuration used to check the rubocop source code.
2
+
3
+ inherit_from: .rubocop_todo.yml
4
+ require:
5
+ - rubocop/cop/internal_affairs
6
+
7
+ AllCops:
8
+ Exclude:
9
+ - 'vendor/**/*'
10
+ - 'spec/fixtures/**/*'
11
+ - 'tmp/**/*'
12
+ TargetRubyVersion: 2.1
13
+
14
+ Naming/PredicateName:
15
+ # Method define macros for dynamically generated method.
16
+ MethodDefinitionMacros:
17
+ - define_method
18
+ - define_singleton_method
19
+ - def_node_matcher
20
+ - def_node_search
21
+
22
+ Style/FrozenStringLiteralComment:
23
+ EnforcedStyle: always
24
+
25
+ Layout/EndOfLine:
26
+ EnforcedStyle: lf
27
+
28
+ Layout/IndentHeredoc:
29
+ EnforcedStyle: powerpack
30
+
31
+ Lint/AmbiguousBlockAssociation:
32
+ Exclude:
33
+ - 'spec/**/*.rb'
34
+
35
+ Lint/InterpolationCheck:
36
+ Exclude:
37
+ - 'spec/**/*.rb'
38
+
39
+ Lint/UselessAccessModifier:
40
+ MethodCreatingMethods:
41
+ - 'def_matcher'
42
+ - 'def_node_matcher'
43
+
44
+ Lint/BooleanSymbol:
45
+ Enabled: false
46
+
47
+ Metrics/BlockLength:
48
+ Exclude:
49
+ - 'Rakefile'
50
+ - '**/*.rake'
51
+ - 'spec/**/*.rb'
52
+
53
+ Metrics/ModuleLength:
54
+ Exclude:
55
+ - 'spec/**/*.rb'
56
+
57
+ Performance/Caller:
58
+ Exclude:
59
+ - spec/rubocop/cop/performance/caller_spec.rb
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,2 @@
1
+ Metrics/BlockLength:
2
+ ExcludedMethods: ['describe', 'context']
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.1
5
+ - 2.3.0
6
+ - 2.4.0
7
+ before_install: gem install bundler
8
+ deploy:
9
+ provider: rubygems
10
+ api_key:
11
+ secure: oa/o5oeY4cgrqJan9yr+3JfEMs4bHhy32fA+Omkm7RUYvV5gdEekMK7Bwfl0luKNyvlMOukO1eFR8NB1ZJeAto/knlkFdcBAxNIQ/lYvcLHKCj0tir3jn0K3n9nX7rWcOkaukkUOJ/twK7Pcq15UgtOrmus+cS9CxNJosJISP/F3qeCfFAL+bszcdzBdOpo100muNTAREnG75ceFpCnK3wnFj+/izEj/efE+sLMc2SpVF0bO/sXHAZTYpTQS2czuBdbWr48rCcg77Izp/ogPaONUjFjJ+/EVlSj25MNm0OoDTPHWd/qXl8bPaffO1tA9DqoNFtF/KN2riYpxVUk8hx5qeXr+PKlktDcT54D5JIGHdeFhJQjQKN0k/A2ulWjOHIlD90DtQLjxk+SQyDqIrZTvHLgpuhOe9VOeSbU47TYQuqzcCG6OgMLXt3IS+MVARYkEl8I2wZ20fOmF1C78OC05w93lm1LnB+EICSrweM1NVo2Uc1fPExmdyByULIf6neLk27zalO9Cl0dUz3or3dJlUx/CWHtqFRMCTrcP/lxQDZ2Dl6vhMctyQoboFsAHgze7rtSs60xdDdXvlXY+sTbmAmsQS6N0MATkGCNMWioVscSfSG9wcg6ZPNP1U9RcbAoNXGogbArfwBBddjI9KSZxKjyyv6TnWGcvrJIBsAA=
12
+ gem: omniauth-parasut
13
+ on:
14
+ tags: true
15
+ repo: demirhanaydin/omniauth-parasut
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at demirhanaydin@gmail.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ group :test do
6
+ gem 'rubocop', '~> 0.51.0'
7
+ end
8
+
9
+ # Specify your gem's dependencies in omniauth-parasut.gemspec
10
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 demirhanaydin
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,45 @@
1
+ # Omniauth::Parasut
2
+
3
+ This is the unofficial OmniAuth OAuth2 strategy for authenticating to [Parasut](https://apidocs.parasut.com/#section/Authentication).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-parasut'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-parasut
20
+
21
+ ## Usage
22
+
23
+ ### Rails
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ provider :parasut, ENV['PARASUT_CLIENT_ID'], ENV['PARASUT_CLIENT_SECRET']
28
+ end
29
+ ```
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/demirhanaydin/omniauth-parasut. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
+
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
45
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ begin
9
+ require 'rubocop/rake_task'
10
+ RuboCop::RakeTask.new
11
+ rescue LoadError
12
+ task :rubocop do
13
+ warn 'RuboCop is disabled'
14
+ end
15
+ end
16
+
17
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'omniauth/parasut'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/parasut/version'
4
+ require 'omniauth/strategies/parasut'
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ # :nodoc:
5
+ module Parasut
6
+ VERSION = '0.1.0'.freeze
7
+ end
8
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth-oauth2'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ # Authentication strategy for connecting with PARASUT APIs using OAuth2.0
8
+ # the [OAuth 2.0 Specification](http://tools.ietf.org/html/draft-ietf-oauth-v2-10).
9
+ class Parasut < OmniAuth::Strategies::OAuth2
10
+ CONTENT_TYPE = 'application/vnd.api+json'.freeze
11
+ option :client_options, site: 'https://api.parasut.com'
12
+
13
+ uid { raw_info['data']['id'] }
14
+
15
+ info do
16
+ {
17
+ name: user_attributes['name'],
18
+ email: user_attributes['email']
19
+ }
20
+ end
21
+
22
+ extra do
23
+ { raw_info: raw_info }
24
+ end
25
+
26
+ def setup_phase
27
+ ::OAuth2::Response.register_parser(:json, CONTENT_TYPE) do |body|
28
+ MultiJson.load(body)
29
+ end
30
+ end
31
+
32
+ def raw_info
33
+ @raw_info ||= access_token.get('/v4/me').parsed
34
+ end
35
+
36
+ private
37
+
38
+ def user_attributes
39
+ raw_info['data']['attributes']
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'omniauth/parasut/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'omniauth-parasut'
10
+ spec.version = OmniAuth::Parasut::VERSION
11
+ spec.authors = ['demirhanaydin']
12
+ spec.email = ['demirhanaydin@gmail.com']
13
+
14
+ spec.summary = 'Omniauth OAuth2 strategy for Parasut'
15
+ spec.description = 'Omniauth OAuth2 strategy for Parasut'
16
+ spec.homepage = 'https://github.com/demirhanaydin/omniauth-parasut'
17
+ spec.license = 'MIT'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+ spec.bindir = 'exe'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_runtime_dependency 'omniauth-oauth2'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.12'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-parasut
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - demirhanaydin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Omniauth OAuth2 strategy for Parasut
70
+ email:
71
+ - demirhanaydin@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".rubocop.yml"
79
+ - ".rubocop_todo.yml"
80
+ - ".travis.yml"
81
+ - CODE_OF_CONDUCT.md
82
+ - Gemfile
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/setup
88
+ - lib/omniauth/parasut.rb
89
+ - lib/omniauth/parasut/version.rb
90
+ - lib/omniauth/strategies/parasut.rb
91
+ - omniauth-parasut.gemspec
92
+ homepage: https://github.com/demirhanaydin/omniauth-parasut
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.4.8
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Omniauth OAuth2 strategy for Parasut
116
+ test_files: []
117
+ has_rdoc: