omniauth-tendril 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'omniauth/tendril/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'omniauth-tendril'
7
+ s.version = OmniAuth::Tendril::VERSION
8
+ s.authors = ['Matt Solt']
9
+ s.email = ['mattsolt@gmail.com']
10
+ s.summary = 'Tendril OAuth2 strategy for OmniAuth'
11
+ s.description = %q{ Tendril OAuth2 strategy for OmniAuth.
12
+ Learn more and sign up at http://dev.tendrilinc.com/. }
13
+ s.homepage = 'https://github.com/activefx/omniauth-tendril'
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
+
20
+ s.add_runtime_dependency 'omniauth-oauth2', '~> 1.0.0'
21
+ s.add_runtime_dependency 'faraday', '~> 0.7.6'
22
+ s.add_runtime_dependency 'multi_json', '~> 1.2.0'
23
+ s.add_runtime_dependency 'multi_xml', '~> 0.4.2'
24
+
25
+ s.add_development_dependency 'rspec', '~> 2.9.0'
26
+ s.add_development_dependency 'rake'
27
+ end
28
+
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ .rspec
4
+ Gemfile.lock
5
+ pkg/*
6
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source :rubygems
2
+
3
+ gemspec
4
+
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2012 Matthew Solt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README ADDED
@@ -0,0 +1,2 @@
1
+ Tendril OAuth strategy for OmniAuth 1.0
2
+
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,54 @@
1
+ require 'omniauth/strategies/oauth2'
2
+ require 'faraday'
3
+ require 'multi_json'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Tendril < OmniAuth::Strategies::OAuth2
8
+ option :name, "tendril"
9
+
10
+ option :client_options, {
11
+ :site => 'https://dev.tendrilinc.com',
12
+ :request_token_path => '/oauth/request_token',
13
+ :access_token_path => '/oauth/access_token',
14
+ :token_url => 'https://dev.tendrilinc.com/oauth/access_token',
15
+ :token_method => :get,
16
+ :authorize_url => 'https://dev.tendrilinc.com/oauth/authorize',
17
+ }
18
+
19
+ option :authorize_options, [:scope]
20
+
21
+ uid{ raw_info['@id'] }
22
+
23
+ info do
24
+ {
25
+ :first_name => raw_info['firstName'],
26
+ :last_name => raw_info['lastName'],
27
+ :name => "#{raw_info['firstName']} #{raw_info['lastName']}",
28
+ :email => raw_info['emailAddress'],
29
+ :user_name => raw_info['userName'],
30
+ :using_temporary_password => raw_info['usingTemporaryPassword'],
31
+ :expert => raw_info['expert'],
32
+ :author_id => raw_info['authorId']
33
+ }
34
+ end
35
+
36
+ extra do
37
+ { 'raw_info' => raw_info }
38
+ end
39
+
40
+ def raw_info
41
+ conn = Faraday.new('https://dev.tendrilinc.com')
42
+ response = conn.get do |req|
43
+ req.url '/connect/user/current-user'
44
+ req.headers['Accept'] = 'application/json'
45
+ req.headers['Content-Type'] = 'application/json'
46
+ req.headers['Access_Token'] = access_token.token
47
+ end
48
+ @raw_info ||= MultiJson.decode response.env[:body]
49
+ end
50
+
51
+ end
52
+ end
53
+ end
54
+
@@ -0,0 +1,6 @@
1
+ module OmniAuth
2
+ module Tendril
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
6
+
@@ -0,0 +1,3 @@
1
+ require 'omniauth/tendril/version'
2
+ require 'omniauth/strategies/tendril'
3
+
@@ -0,0 +1,2 @@
1
+ require 'omniauth/tendril'
2
+
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-tendril
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matt Solt
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: omniauth-oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.0
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.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: faraday
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.7.6
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: 0.7.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: multi_json
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.2.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.2.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: multi_xml
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.4.2
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.4.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 2.9.0
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 2.9.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: rake
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: ! " Tendril OAuth2 strategy for OmniAuth.\n Learn
111
+ more and sign up at http://dev.tendrilinc.com/. "
112
+ email:
113
+ - mattsolt@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gemspec
119
+ - .gitignore
120
+ - Gemfile
121
+ - LICENSE
122
+ - README
123
+ - Rakefile
124
+ - lib/omniauth-tendril.rb
125
+ - lib/omniauth/strategies/tendril.rb
126
+ - lib/omniauth/tendril.rb
127
+ - lib/omniauth/tendril/version.rb
128
+ homepage: https://github.com/activefx/omniauth-tendril
129
+ licenses: []
130
+ post_install_message:
131
+ rdoc_options: []
132
+ require_paths:
133
+ - lib
134
+ required_ruby_version: !ruby/object:Gem::Requirement
135
+ none: false
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 1.8.21
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Tendril OAuth2 strategy for OmniAuth
152
+ test_files: []
153
+ has_rdoc: