omniauth-mindvalley 0.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.
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/README.md +33 -0
- data/Rakefile +9 -0
- data/lib/omniauth-mindvalley.rb +4 -0
- data/lib/omniauth-mindvalley/version.rb +5 -0
- data/lib/omniauth/strategies/mindvalley.rb +39 -0
- data/omniauth-mindvalley.gemspec +21 -0
- metadata +103 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Usage and Installation
|
2
|
+
======================
|
3
|
+
|
4
|
+
In your Gemfile:
|
5
|
+
----------------
|
6
|
+
|
7
|
+
gem 'omniauth-mindvalley', :git => 'git://github.com/mindvalley/omniauth-mindvalley.git'
|
8
|
+
|
9
|
+
In a file called oauth.yml in your config folder:
|
10
|
+
-------------------------------------------------
|
11
|
+
|
12
|
+
production:
|
13
|
+
mindvalley:
|
14
|
+
consumer_key: your_production_key
|
15
|
+
consumer_secret: your_production_secret
|
16
|
+
|
17
|
+
development:
|
18
|
+
mindvalley:
|
19
|
+
consumer_key: your_development_key
|
20
|
+
consumer_secret: your_development_secret
|
21
|
+
|
22
|
+
|
23
|
+
In an initializer:
|
24
|
+
------------------
|
25
|
+
|
26
|
+
OAUTH = YAML.load_file(File.join(Rails.root, "config", "oauth.yml"))
|
27
|
+
|
28
|
+
# load all the possible oauth strategies
|
29
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
30
|
+
provider :mindvalley, OAUTH[Rails.env]['mindvalley']['consumer_key'],
|
31
|
+
OAUTH[Rails.env]['mindvalley']['consumer_secret']
|
32
|
+
end
|
33
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
require 'multi_json'
|
3
|
+
|
4
|
+
module OmniAuth
|
5
|
+
module Strategies
|
6
|
+
class Mindvalley < OmniAuth::Strategies::OAuth2
|
7
|
+
case Rails.env
|
8
|
+
when 'production'
|
9
|
+
option :client_options, {
|
10
|
+
:site => 'http://accounts.mindvalley.com',
|
11
|
+
:authorize_url => 'http://accounts.mindvalley.com/oauth/authorize',
|
12
|
+
:token_url => 'http://accounts.mindvalley.com/oauth/token'
|
13
|
+
}
|
14
|
+
else
|
15
|
+
option :client_options, {
|
16
|
+
:site => 'http://accounts.mindvalley.com',
|
17
|
+
:authorize_url => 'http://accounts.mindvalley.com/oauth/authorize',
|
18
|
+
:token_url => 'http://accounts.mindvalley.com/oauth/token'
|
19
|
+
# :site => 'http://0.0.0.0:3000',
|
20
|
+
# :authorize_url => 'http://0.0.0.0:3000/oauth/authorize',
|
21
|
+
# :token_url => 'http://0.0.0.0:3000/oauth/token'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
uid { raw_info['id'] }
|
26
|
+
|
27
|
+
info do
|
28
|
+
{
|
29
|
+
'email' => raw_info["user"]['email'],
|
30
|
+
'first_name' => raw_info["user"]['first_name']
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def raw_info
|
35
|
+
@raw_info ||= MultiJson.decode(access_token.get('/me').body)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-mindvalley/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_dependency 'hashie', '~> 1.2'
|
6
|
+
gem.add_dependency 'omniauth', '~> 1.1.0'
|
7
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.1.0'
|
8
|
+
|
9
|
+
gem.authors = ["Tristan Gomez"]
|
10
|
+
gem.email = ["tristan@mindvalley.com"]
|
11
|
+
gem.description = %q{An OmniAuth strategy for a Mindvalley account (shamelessly stolen from https://github.com/ZenCocoon/omniauth-testoauth2strategy).}
|
12
|
+
gem.summary = %q{n An OmniAuth strategy for a Mindvalley account.}
|
13
|
+
gem.homepage = "https://github.com/mindvalley/omniauth-mindvalley"
|
14
|
+
|
15
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
gem.name = "omniauth-mindvalley"
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.version = OmniAuth::Mindvalley::VERSION
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-mindvalley
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tristan Gomez
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: hashie
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: omniauth
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.1.0
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: omniauth-oauth2
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.1.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
62
|
+
description: An OmniAuth strategy for a Mindvalley account (shamelessly stolen from
|
63
|
+
https://github.com/ZenCocoon/omniauth-testoauth2strategy).
|
64
|
+
email:
|
65
|
+
- tristan@mindvalley.com
|
66
|
+
executables: []
|
67
|
+
extensions: []
|
68
|
+
extra_rdoc_files: []
|
69
|
+
files:
|
70
|
+
- .gitignore
|
71
|
+
- .rspec
|
72
|
+
- Gemfile
|
73
|
+
- README.md
|
74
|
+
- Rakefile
|
75
|
+
- lib/omniauth-mindvalley.rb
|
76
|
+
- lib/omniauth-mindvalley/version.rb
|
77
|
+
- lib/omniauth/strategies/mindvalley.rb
|
78
|
+
- omniauth-mindvalley.gemspec
|
79
|
+
homepage: https://github.com/mindvalley/omniauth-mindvalley
|
80
|
+
licenses: []
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.24
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: n An OmniAuth strategy for a Mindvalley account.
|
103
|
+
test_files: []
|