omniauth-steam 1.0.0
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 +4 -0
- data/Gemfile +6 -0
- data/Rakefile +1 -0
- data/lib/omniauth/strategies/steam.rb +47 -0
- data/lib/omniauth-steam/version.rb +5 -0
- data/lib/omniauth-steam.rb +2 -0
- data/omniauth-steam.gemspec +22 -0
- metadata +80 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module Strategies
|
3
|
+
class Steam < OmniAuth::Strategies::OpenID
|
4
|
+
args :api_key
|
5
|
+
|
6
|
+
option :api_key, nil
|
7
|
+
option :name, "steam"
|
8
|
+
option :identifier, "http://steamcommunity.com/openid"
|
9
|
+
|
10
|
+
uid { steam_id }
|
11
|
+
|
12
|
+
info do
|
13
|
+
{
|
14
|
+
"nickname" => player["personaname"],
|
15
|
+
"name" => player["realname"],
|
16
|
+
"location" => [player["loccityid"], player["locstatecode"], player["loccountrycode"]].compact.join(", "),
|
17
|
+
"image" => player["avatarmedium"],
|
18
|
+
"urls" => {
|
19
|
+
"Profile" => player["profileurl"]
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
extra do
|
25
|
+
{ "raw_info" => player }
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def raw_info
|
31
|
+
@raw_info ||= options.api_key ? MultiJson.decode(Net::HTTP.get(player_profile_uri)) : {}
|
32
|
+
end
|
33
|
+
|
34
|
+
def player
|
35
|
+
@player ||= raw_info["response"]["players"]["player"].first
|
36
|
+
end
|
37
|
+
|
38
|
+
def steam_id
|
39
|
+
openid_response.display_identifier.split("/").last
|
40
|
+
end
|
41
|
+
|
42
|
+
def player_profile_uri
|
43
|
+
URI.parse("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0001/?key=#{options.api_key}&steamids=#{steam_id}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "omniauth-steam/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "omniauth-steam"
|
7
|
+
s.version = OmniAuth::Steam::VERSION
|
8
|
+
s.authors = ["Rodrigo Navarro"]
|
9
|
+
s.email = ["rnavarro1@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/reu/omniauth-steam"
|
11
|
+
s.summary = "Steam strategy for OmniAuth"
|
12
|
+
|
13
|
+
s.rubyforge_project = "omniauth-steam"
|
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-openid"
|
21
|
+
s.add_runtime_dependency "multi_json"
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-steam
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rodrigo Navarro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-openid
|
16
|
+
requirement: &2156030380 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2156030380
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: multi_json
|
27
|
+
requirement: &2156393460 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2156393460
|
36
|
+
description:
|
37
|
+
email:
|
38
|
+
- rnavarro1@gmail.com
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- Rakefile
|
46
|
+
- lib/omniauth-steam.rb
|
47
|
+
- lib/omniauth-steam/version.rb
|
48
|
+
- lib/omniauth/strategies/steam.rb
|
49
|
+
- omniauth-steam.gemspec
|
50
|
+
homepage: https://github.com/reu/omniauth-steam
|
51
|
+
licenses: []
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
hash: 3343329316515483262
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
hash: 3343329316515483262
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project: omniauth-steam
|
76
|
+
rubygems_version: 1.8.10
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Steam strategy for OmniAuth
|
80
|
+
test_files: []
|