omniauth-accounts9 1.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9474535d0a10e2ea1bd79560ec7bd8dd697ef3aa
4
+ data.tar.gz: 8916398cc9dc2e9eb8fc274f3de1166d3507b57c
5
+ SHA512:
6
+ metadata.gz: f71cac319e21c79682469229e9a206baae7dc09ed81b842af27d0462f195197bfd7ccfb9679d1a3d4b642bbc6c014a9a953210f4b8de2902f83501c6af8e82ec
7
+ data.tar.gz: 8a6d66c4e6bb8e9909895f846a3b0ff2b2580cc1140fb3e4202be6518f8e48c8012c51bf07e9634326db2418399fa9312d868b5092d76e9a65c88d256c0f6035
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ree
6
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-accounts9.gemspec
5
+ gemspec
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ desc 'Default: run specs.'
8
+ task :default => :spec
@@ -0,0 +1,2 @@
1
+ require "omniauth-accounts9/version"
2
+ require 'omniauth/strategies/accounts9'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Accounts9
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1,58 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Accounts9 < OmniAuth::Strategies::OAuth2
6
+ option :name, 'accounts9'
7
+
8
+ option :client_options, {:authorize_url => '/api/authorize',
9
+ :token_url => '/api/access_token',
10
+ :site => 'https://accounts.net9.org'}
11
+ option :token_params, { :parse => :json }
12
+
13
+ def request_phase
14
+ super
15
+ end
16
+
17
+ def authorize_params
18
+ super.tap do |params|
19
+ %w[scope client_options].each do |v|
20
+ if request.params[v]
21
+ params[v.to_sym] = request.params[v]
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ uid { raw_info['uid'].to_s }
28
+
29
+ info do
30
+ {
31
+ :email => raw_info['email'],
32
+ :nickname => raw_info['name'],
33
+ :last_name => raw_info['surname'],
34
+ :first_name => raw_info['givenname'],
35
+ :name => raw_info['fullname'],
36
+ :location => raw_info['address'],
37
+ :description => raw_info['bio'],
38
+ :urls => {
39
+ 'Website' => raw_info['website'],
40
+ }
41
+ }
42
+ end
43
+
44
+ extra do
45
+ {
46
+ :raw_info => raw_info
47
+ }
48
+ end
49
+
50
+ def raw_info
51
+ access_token.options[:mode] = :query
52
+ access_token.options[:param_name] = 'access_token'
53
+ @raw_info ||= access_token.get('https://accounts.net9.org/api/userinfo').parsed['user']
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-accounts9/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-accounts9"
7
+ s.version = OmniAuth::Accounts9::VERSION
8
+ s.authors = ["moreD Wen"]
9
+ s.email = ["moreDatPublic@gmail.com"]
10
+ s.homepage = "https://git.net9.org/mored/omniauth-accounts9"
11
+ s.summary = %q{OmniAuth strategy for Accounts9}
12
+ s.description = %q{OmniAuth strategy for Accounts9}
13
+ s.license = "MIT"
14
+
15
+ s.rubyforge_project = "omniauth-accounts9"
16
+
17
+ s.files = `git ls-files`.split("\n")
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-oauth2', '~> 1.1'
23
+ s.add_development_dependency 'rspec', '~> 2.7'
24
+ s.add_development_dependency 'rake', '~> 0'
25
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::Accounts9 do
4
+ let(:request) { double('Request', :params => {}, :cookies => {}, :env => {}) }
5
+
6
+ subject do
7
+ args = ['appid', 'secret', @options || {}].compact
8
+ OmniAuth::Strategies::Accounts9.new(*args).tap do |strategy|
9
+ strategy.stub(:request) {
10
+ request
11
+ }
12
+ end
13
+ end
14
+
15
+ describe 'client options' do
16
+ it 'should have correct name' do
17
+ expect(subject.options.name).to eq('accounts9')
18
+ end
19
+
20
+ it 'should have correct site' do
21
+ expect(subject.options.client_options.site).to eq('https://accounts.net9.org')
22
+ end
23
+
24
+ it 'should have correct authorize url' do
25
+ expect(subject.options.client_options.authorize_path).to eq('/api/authorize')
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,18 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'rspec'
6
+ require 'rack/test'
7
+ require 'webmock/rspec'
8
+ require 'omniauth'
9
+ require 'omniauth-twitter'
10
+
11
+ RSpec.configure do |config|
12
+ config.include WebMock::API
13
+ config.include Rack::Test::Methods
14
+ config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
15
+ config.expect_with :rspec do |c|
16
+ c.syntax = :expect
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-accounts9
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - moreD Wen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-04 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: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
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 Accounts9
56
+ email:
57
+ - moreDatPublic@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - Rakefile
67
+ - lib/omniauth-accounts9.rb
68
+ - lib/omniauth-accounts9/version.rb
69
+ - lib/omniauth/strategies/accounts9.rb
70
+ - omniauth-accounts9.gemspec
71
+ - spec/omniauth/strategies/twitter_spec.rb
72
+ - spec/spec_helper.rb
73
+ homepage: https://git.net9.org/mored/omniauth-accounts9
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project: omniauth-accounts9
93
+ rubygems_version: 2.2.3
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: OmniAuth strategy for Accounts9
97
+ test_files: []