omniauth-kosynierzy 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2df14d23093ca634801694cddb30460d5d61661
4
+ data.tar.gz: 5caa1a92769545aada76bdcbfa6e9d87b83cd232
5
+ SHA512:
6
+ metadata.gz: 06e6ae3ad4518697e1818eddfefbc91c65e19bf873f346d7667093bd8f63ef30f2d016c228fd98029f9837a1a64c3f89c3158d54a28d05ed254517dad8008586
7
+ data.tar.gz: 90f2e40b16daae72a0acb54e108955c5a314c0dcb647810d98bd33258b5af13251377da893f0bd0acf596ebd8272bcd02eb418bffe64b410be8f77b51d6db582
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 2.1.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-kosynierzy.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Jan Dudulski
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ [![Build Status](https://travis-ci.org/kosynierzy/omniauth-kosynierzy.png)](https://travis-ci.org/kosynierzy/omniauth-kosynierzy)
2
+
3
+ # Omniauth::Kosynierzy
4
+
5
+ Omniauth Strategy for Kosynierzy
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'omniauth-kosynierzy'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-kosynierzy
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,3 @@
1
+ require "omniauth"
2
+ require "omniauth/kosynierzy/version"
3
+ require "omniauth/strategies/kosynierzy"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Kosynierzy
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ require 'omniauth/strategies/oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Kosynierzy < OmniAuth::Strategies::OAuth2
6
+ option :name, :kosynierzy
7
+
8
+ option :client_options, {
9
+ site: ENV.fetch('ACCOUNT_KOSYNIERZY_HOST') { 'https://account.kosynierzy.info' },
10
+ authorize_url: '/oauth/authorize'
11
+ }
12
+
13
+ uid { raw_info['id'] }
14
+
15
+ info do
16
+ {
17
+ email: raw_info['email'],
18
+ username: raw_info['username'],
19
+ roles: raw_info['roles'],
20
+ firstname: raw_info['firstname'],
21
+ lastname: raw_info['lastname'],
22
+ personal_identity_number: raw_info['personal_identity_number'],
23
+ identity_card_number: raw_info['identity_card_number'],
24
+ phone_number: raw_info['phone_number'],
25
+ address: raw_info['address']
26
+ }
27
+ end
28
+
29
+ def raw_info
30
+ @raw_info ||= access_token.get('/api/v1/me.json').parsed
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'omniauth/kosynierzy/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-kosynierzy"
8
+ spec.version = OmniAuth::Kosynierzy::VERSION
9
+ spec.authors = ["Jan Dudulski"]
10
+ spec.email = ["jan@dudulski.pl"]
11
+ spec.description = %q{OmniAuth strategy for Kosynierzy}
12
+ spec.summary = %q{OmniAuth strategy for Kosynierzy}
13
+ spec.homepage = "http://kosynierzy.info/"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake", "~> 10.4"
23
+ spec.add_development_dependency "rspec", "~> 3.1"
24
+
25
+ spec.add_runtime_dependency "omniauth-oauth2", "~> 1.2"
26
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Kosynierzy do
4
+ it 'has a version number' do
5
+ expect(OmniAuth::Kosynierzy::VERSION).to_not be_nil
6
+ end
7
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Kosynierzy do
4
+ let(:request) { double('Request', params: {}, cookies: {}, env: {}) }
5
+
6
+ subject do
7
+ args = ['appid', 'secret', @options || {}].compact
8
+ OmniAuth::Strategies::Kosynierzy.new(*args).tap do |strategy|
9
+ strategy.stub(:request) {
10
+ request
11
+ }
12
+ end
13
+ end
14
+
15
+ describe 'client options' do
16
+ describe 'name' do
17
+ it { expect(subject.options.name).to eq(:kosynierzy) }
18
+ end
19
+
20
+ describe 'site' do
21
+ it { expect(subject.options.client_options.site).to eq('https://account.kosynierzy.info') }
22
+ end
23
+
24
+ describe 'authorize_url' do
25
+ it { expect(subject.options.client_options.authorize_url).to eq('/oauth/authorize') }
26
+ end
27
+ end
28
+
29
+ describe '#info' do
30
+ before(:each) do
31
+ subject.stub(:raw_info) { {} }
32
+ end
33
+
34
+ it { expect(subject.info).to have_key(:email) }
35
+ it { expect(subject.info).to have_key(:username) }
36
+ it { expect(subject.info).to have_key(:roles) }
37
+ it { expect(subject.info).to have_key(:firstname) }
38
+ it { expect(subject.info).to have_key(:lastname) }
39
+ it { expect(subject.info).to have_key(:personal_identity_number) }
40
+ it { expect(subject.info).to have_key(:identity_card_number) }
41
+ it { expect(subject.info).to have_key(:phone_number) }
42
+ it { expect(subject.info).to have_key(:address) }
43
+ end
44
+ end
@@ -0,0 +1,6 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'omniauth-kosynierzy'
3
+
4
+ RSpec.configure do |config|
5
+ config.order = 'random'
6
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-kosynierzy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jan Dudulski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-oauth2
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
69
+ description: OmniAuth strategy for Kosynierzy
70
+ email:
71
+ - jan@dudulski.pl
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - lib/omniauth-kosynierzy.rb
84
+ - lib/omniauth/kosynierzy/version.rb
85
+ - lib/omniauth/strategies/kosynierzy.rb
86
+ - omniauth-kosynierzy.gemspec
87
+ - spec/omniauth/kosynierzy_spec.rb
88
+ - spec/omniauth/strategies/kosynierzy_spec.rb
89
+ - spec/spec_helper.rb
90
+ homepage: http://kosynierzy.info/
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.2.2
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: OmniAuth strategy for Kosynierzy
114
+ test_files:
115
+ - spec/omniauth/kosynierzy_spec.rb
116
+ - spec/omniauth/strategies/kosynierzy_spec.rb
117
+ - spec/spec_helper.rb
118
+ has_rdoc: