omniauth-allplayers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/.travis.yml ADDED
@@ -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 "http://rubygems.org"
2
+
3
+ gem 'rake'
4
+ # Specify your gem's dependencies in omniauth-allplayers.gemspec
5
+ gemspec
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # OmniAuth AllPlayers.com
2
+
3
+ This gem contains the AllPlayers.com strategy for OmniAuth.
4
+
5
+ AllPlayers.com uses the OAuth 1.0 flow, you can read about it here: http://develop.allplayers.com/
6
+
7
+ ## How To Use It
8
+
9
+ Usage is as per any other OmniAuth 1.0 strategy. So let's say you're using Rails, you need to add the strategy to your `Gemfile`:
10
+
11
+ gem 'omniauth-allplayers'
12
+
13
+ You can pull them in directly from github e.g.:
14
+
15
+ gem 'omniauth-allplayers', :git => 'https://github.com/allplayers/omniauth-allplayers.git'
16
+
17
+ Once these are in, you need to add the following to your `config/initializers/omniauth.rb`:
18
+
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :allplayers, "consumer_key", "consumer_secret"
21
+ end
22
+
23
+
24
+ ## Note on Patches/Pull Requests
25
+
26
+ - Fork the project.
27
+ - Make your feature addition or bug fix.
28
+ - Add tests for it. This is important so I don’t break it in a future version unintentionally.
29
+ - Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
30
+ - Send me a pull request. Bonus points for topic branches.
31
+
data/Rakefile ADDED
@@ -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,61 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+
7
+ # An omniauth 1.0 strategy for AllPlayers.com authentication
8
+ # Based on http://develop.allplayers.com/oauth.html
9
+ class AllPlayers < OmniAuth::Strategies::OAuth
10
+
11
+ option :name, 'allplayers'
12
+
13
+ option :client_options, {
14
+ :access_token_path => "/oauth/access_token",
15
+ :authorize_path => "/oauth/authorize",
16
+ :request_token_path => "/oauth/request_token",
17
+ :site => "https://www.allplayers.com"
18
+ }
19
+
20
+ uid {
21
+ user_info['uuid']
22
+ }
23
+
24
+ info do
25
+ {
26
+ :name => user_info['username'],
27
+ :nickname => user_info['nickname'],
28
+ :picture => user_info['picture'],
29
+ :urls => {
30
+ "Profile" => user_info['uri'],
31
+ }
32
+ }
33
+ end
34
+
35
+ extra do
36
+ {
37
+ :raw_info => raw_info
38
+ }
39
+ end
40
+
41
+ def raw_info
42
+ # This is a public API and does not need signing or authentication
43
+ request = "/api/v1/rest/users/current.json"
44
+ @raw_info ||= MultiJson.decode(access_token.get(request).body)
45
+ rescue ::Errno::ETIMEDOUT
46
+ raise ::Timeout::Error
47
+ end
48
+
49
+ # Provide the "Person" portion of the raw_info
50
+
51
+ def user_info
52
+ @user_info ||= raw_info.nil? ? {} : raw_info
53
+ end
54
+
55
+ #def request_phase
56
+ # options[:authorize_params] = {:perms => options[:scope]} if options[:scope]
57
+ # super
58
+ #end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module AllPlayers
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ require "omniauth-allplayers/version"
2
+ require 'omniauth/strategies/allplayers'
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-allplayers/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-allplayers"
7
+ s.version = OmniAuth::AllPlayers::VERSION
8
+ s.authors = ["Chris Christensen"]
9
+ s.email = ["chris@allplayers.com"]
10
+ s.homepage = "https://github.com/AllPlayers/omniauth-allplayers"
11
+ s.summary = %q{OmniAuth strategy for AllPlayers.com}
12
+ s.description = %q{OmniAuth strategy for AllPlayers.com}
13
+
14
+ s.rubyforge_project = "omniauth-allplayers"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency 'multi_json', '~> 1.3'
22
+ s.add_runtime_dependency 'omniauth-oauth', '~> 1.0'
23
+ s.add_development_dependency 'rspec', '~> 2.7'
24
+ s.add_development_dependency 'rack-test'
25
+ s.add_development_dependency 'simplecov'
26
+ s.add_development_dependency 'webmock'
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OmniAuth::Strategies::AllPlayers do
4
+ subject do
5
+ OmniAuth::Strategies::AllPlayers.new({})
6
+ end
7
+
8
+ context "client options" do
9
+ it 'should have correct name' do
10
+ subject.options.name.should eq("allplayers")
11
+ end
12
+
13
+ it 'should have correct site' do
14
+ subject.options.client_options.site.should eq('https://www.allplayers.com')
15
+ end
16
+
17
+ it 'should have correct authorize url' do
18
+ subject.options.client_options.authorize_path.should eq('/oauth/authorize')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,16 @@
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-allplayers'
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
+ end
16
+
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-allplayers
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Chris Christensen
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-10-01 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: multi_json
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 9
29
+ segments:
30
+ - 1
31
+ - 3
32
+ version: "1.3"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: omniauth-oauth
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 15
44
+ segments:
45
+ - 1
46
+ - 0
47
+ version: "1.0"
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rspec
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 13
59
+ segments:
60
+ - 2
61
+ - 7
62
+ version: "2.7"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rack-test
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: simplecov
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ type: :development
92
+ version_requirements: *id005
93
+ - !ruby/object:Gem::Dependency
94
+ name: webmock
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
105
+ type: :development
106
+ version_requirements: *id006
107
+ description: OmniAuth strategy for AllPlayers.com
108
+ email:
109
+ - chris@allplayers.com
110
+ executables: []
111
+
112
+ extensions: []
113
+
114
+ extra_rdoc_files: []
115
+
116
+ files:
117
+ - .rspec
118
+ - .travis.yml
119
+ - Gemfile
120
+ - README.md
121
+ - Rakefile
122
+ - lib/omniauth-allplayers.rb
123
+ - lib/omniauth-allplayers/version.rb
124
+ - lib/omniauth/strategies/allplayers.rb
125
+ - omniauth-allplayers.gemspec
126
+ - spec/omniauth/strategies/allplayers_spec.rb
127
+ - spec/spec_helper.rb
128
+ homepage: https://github.com/AllPlayers/omniauth-allplayers
129
+ licenses: []
130
+
131
+ post_install_message:
132
+ rdoc_options: []
133
+
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
144
+ version: "0"
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ none: false
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ hash: 3
151
+ segments:
152
+ - 0
153
+ version: "0"
154
+ requirements: []
155
+
156
+ rubyforge_project: omniauth-allplayers
157
+ rubygems_version: 1.8.24
158
+ signing_key:
159
+ specification_version: 3
160
+ summary: OmniAuth strategy for AllPlayers.com
161
+ test_files:
162
+ - spec/omniauth/strategies/allplayers_spec.rb
163
+ - spec/spec_helper.rb