omniauth-bungie-oauth2 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/README.md +3 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth/strategies/bungie.rb +23 -6
- data/lib/omniauth-bungie-oauth2/version.rb +2 -2
- data/omniauth-bungie-oauth2.gemspec +3 -1
- data/spec/omniauth/strategies/bungie_oauth2_spec.rb +3 -6
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61ec53e71ca799b4ca1b7d81e660c2e66420af2
|
4
|
+
data.tar.gz: '080e78001f67eacdc86d5e606673f67c128b3eb9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2523fa010311c7786fbfad35b4ca2d13f207c8e47023ae8d53e64b5f4ee609ce6f257fcb13c682258302b76364439ebe691819216dd705a3ad959d495c72539
|
7
|
+
data.tar.gz: e4781cfe6382f59ec9d9d77a8a7737ce928559850e4a657928fec2536f84eb0466063e7124a2b0fa2d0d9ce45ab908c071b562f097913b04d997303cbd605cab
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Omniauth::Bungie::Oauth2
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/omniauth-bungie-oauth2.svg)](https://badge.fury.io/rb/omniauth-bungie-oauth2)
|
4
|
+
[![Build Status](https://travis-ci.org/RuBAN-GT/omniauth-bungie-oauth2.svg?branch=master)](https://travis-ci.org/RuBAN-GT/omniauth-bungie-oauth2)
|
5
|
+
|
3
6
|
A Bungie OAuth2 strategy for Omniauth.
|
4
7
|
|
5
8
|
## Installation
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bungie_client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -26,6 +26,13 @@ module OmniAuth
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def merge_stack(stack)
|
30
|
+
stack.inject({}) do |a, e|
|
31
|
+
a.merge!(e) unless e.nil?
|
32
|
+
a
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
29
36
|
# Updated callback phase with new refreshing
|
30
37
|
def callback_phase
|
31
38
|
error = request.params["error_reason"] || request.params["error"]
|
@@ -39,6 +46,7 @@ module OmniAuth
|
|
39
46
|
self.access_token = access_token.refresh!(token_params) if access_token.expired?
|
40
47
|
|
41
48
|
env['omniauth.auth'] = auth_hash
|
49
|
+
|
42
50
|
call_app!
|
43
51
|
end
|
44
52
|
rescue ::OAuth2::Error, CallbackError => e
|
@@ -74,13 +82,22 @@ module OmniAuth
|
|
74
82
|
# Get important data
|
75
83
|
uid { raw_info.dig('bungieNetUser', 'membershipId') }
|
76
84
|
info do
|
77
|
-
|
85
|
+
if raw_info['destinyAccounts'].any?
|
86
|
+
destiny = raw_info['destinyAccounts'].first
|
87
|
+
{
|
88
|
+
:membership_id => destiny.dig('userInfo', 'membershipId'),
|
89
|
+
:membership_type => destiny.dig('userInfo', 'membershipType'),
|
90
|
+
:display_name => destiny.dig('userInfo', 'displayName')
|
91
|
+
}
|
92
|
+
else
|
93
|
+
destiny = raw_info['bungieNetUser']
|
78
94
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
95
|
+
{
|
96
|
+
:membership_id => destiny['membershipId'],
|
97
|
+
:membership_type => 254,
|
98
|
+
:display_name => destiny['displayName']
|
99
|
+
}
|
100
|
+
end
|
84
101
|
end
|
85
102
|
extra do
|
86
103
|
{
|
@@ -5,7 +5,7 @@ require 'omniauth-bungie-oauth2/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'omniauth-bungie-oauth2'
|
8
|
-
spec.version =
|
8
|
+
spec.version = OmniAuth::BungieOauth2::VERSION
|
9
9
|
spec.authors = ['Dmitry Ruban']
|
10
10
|
spec.email = ['dkruban@gmail.com']
|
11
11
|
|
@@ -15,6 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split("\n")
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
20
|
spec.require_paths = ['lib']
|
19
21
|
|
20
22
|
spec.add_development_dependency 'bundler', '~> 1.13'
|
@@ -1,12 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'omniauth-bungie-oauth2/version'
|
2
3
|
require 'omniauth-bungie-oauth2'
|
3
4
|
|
4
|
-
describe
|
5
|
+
describe OmniAuth::Strategies::Bungie do
|
5
6
|
it "has a version number" do
|
6
|
-
expect(
|
7
|
-
end
|
8
|
-
|
9
|
-
it "does something useful" do
|
10
|
-
expect(false).to eq(true)
|
7
|
+
expect(OmniAuth::BungieOauth2::VERSION).not_to be nil
|
11
8
|
end
|
12
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-bungie-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Ruban
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -155,6 +155,8 @@ files:
|
|
155
155
|
- LICENSE.txt
|
156
156
|
- README.md
|
157
157
|
- Rakefile
|
158
|
+
- bin/console
|
159
|
+
- bin/setup
|
158
160
|
- lib/oauth2/bungie_access_token.rb
|
159
161
|
- lib/oauth2/bungie_client.rb
|
160
162
|
- lib/omniauth-bungie-oauth2.rb
|