omniauth-yahoo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ coverage
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-yahoo.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 Software Brewmasters Incorporated
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,11 @@
1
+ An Omniauth 1.0 Strategy for yahoo
2
+
3
+ For more information see the following:
4
+
5
+ * https://github.com/intridea/omniauth/wiki/List-of-Strategies
6
+
7
+ Release notes:
8
+
9
+ * Version 0.0.1
10
+
11
+ - First cut
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+
2
+
@@ -0,0 +1,2 @@
1
+ require "omniauth-yahoo/version"
2
+ require 'omniauth/strategies/yahoo'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Yahoo
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,58 @@
1
+ require 'omniauth-oauth'
2
+ require 'multi_json'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+
7
+ # An omniauth 1.0 strategy for yahoo authentication
8
+ class Yahoo < OmniAuth::Strategies::OAuth
9
+
10
+ option :name, 'yahoo'
11
+
12
+ option :client_options, {
13
+ :access_token_path => '/oauth/v2/get_token',
14
+ :authorize_path => '/oauth/v2/request_auth',
15
+ :request_token_path => '/oauth/v2/get_request_token',
16
+ :site => 'https://api.login.yahoo.com'
17
+ }
18
+
19
+ uid {
20
+ access_token.params['xoauth_yahoo_guid']
21
+ }
22
+
23
+ info do
24
+ {
25
+ :nickname => user_info['nickname'],
26
+ :name => user_info['givenName'] || user_info['nickname'],
27
+ :image => user_info['image']['imageUrl'],
28
+ :description => user_info['message'],
29
+ :urls => {
30
+ 'Profile' => user_info['profileUrl'],
31
+ }
32
+ }
33
+ end
34
+
35
+ extra do
36
+ {
37
+ :raw_info => raw_info
38
+ }
39
+ end
40
+
41
+ # Return info gathered from the yahoo.people.getInfo API call
42
+
43
+ def raw_info
44
+ # This is a public API and does not need signing or authentication
45
+ request = "http://social.yahooapis.com/v1/user/#{uid}/profile?format=json"
46
+ @raw_info ||= MultiJson.decode(access_token.get(request).body)
47
+ rescue ::Errno::ETIMEDOUT
48
+ raise ::Timeout::Error
49
+ end
50
+
51
+ # Provide the "Person" portion of the raw_info
52
+
53
+ def user_info
54
+ @user_info ||= raw_info.nil? ? {} : raw_info["profile"]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "omniauth-yahoo/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "omniauth-yahoo"
7
+ s.version = Omniauth::Yahoo::VERSION
8
+ s.authors = ["Tim Breitkreutz"]
9
+ s.email = ["tim@sbrew.com"]
10
+ s.homepage = "https://github.com/timbreitkreutz/omniauth-yahoo"
11
+ s.summary = %q{OmniAuth strategy for yahoo}
12
+ s.description = %q{OmniAuth strategy for yahoo}
13
+
14
+ s.rubyforge_project = "omniauth-yahoo"
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_runtime_dependency 'omniauth-oauth', '~> 1.0'
22
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-yahoo
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Tim Breitkreutz
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-12-13 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: omniauth-oauth
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 0
31
+ version: "1.0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: OmniAuth strategy for yahoo
35
+ email:
36
+ - tim@sbrew.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - TODO
50
+ - lib/omniauth-yahoo.rb
51
+ - lib/omniauth-yahoo/version.rb
52
+ - lib/omniauth/strategies/yahoo.rb
53
+ - omniauth-yahoo.gemspec
54
+ has_rdoc: true
55
+ homepage: https://github.com/timbreitkreutz/omniauth-yahoo
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project: omniauth-yahoo
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: OmniAuth strategy for yahoo
86
+ test_files: []
87
+