omniauth-nationbuilder 0.0.1 → 0.1.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3511d0f723c8d735738fd825950919e2c3ed5a37
|
4
|
+
data.tar.gz: a687e3220fa77d8c262b472e47cade12165f3c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7399246d8e87ff587c50ef362556070a6cf332a5acd3fff699de4afe4021fca1ed0bccc91ef44736dedaa042ed697cf07c20dae53b89bfcc77ff68418abc9c49
|
7
|
+
data.tar.gz: 7a1baaf5f4960a2d133c614a1f04eefb60b1b3cea69d861450af0f544f20ea6b36b2cc68461bb10b9b6b35d5581ae65f36dc922d6217892740f32a0b9e386318
|
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
[](https://badge.fury.io/rb/omniauth-nationbuilder)
|
1
2
|
[](https://travis-ci.org/chrisjensen/omniauth-nationbuilder)
|
2
3
|
|
3
4
|
# Omniauth::Nationbuilder
|
4
5
|
|
5
6
|
Strategy to authenticate with Nationbuilder in OmniAuth.
|
6
7
|
|
8
|
+
This strategy can be used to authorise your application to use the NationBuilder API.
|
9
|
+
At this stage it is not possible to use it to authenticate your NationBuilder supporters.
|
10
|
+
|
7
11
|
## Installation
|
8
12
|
|
9
13
|
Add this line to your application's Gemfile:
|
@@ -23,7 +23,8 @@ module OmniAuth
|
|
23
23
|
# Configure site before super initialises the OAuth2 Client
|
24
24
|
def client
|
25
25
|
options.client_options[:site] = 'https://' + options.client_options[:slug] + '.nationbuilder.com'
|
26
|
-
|
26
|
+
log :debug, "Nation to authorise " + deep_symbolize(options.client_options).inspect
|
27
|
+
super
|
27
28
|
end
|
28
29
|
|
29
30
|
# Returns the slug, nil if one has not been specified anywhere
|
@@ -50,6 +51,12 @@ module OmniAuth
|
|
50
51
|
super
|
51
52
|
end
|
52
53
|
|
54
|
+
# Nationbuilder fails with an invalid callback if the
|
55
|
+
# query string is passed along
|
56
|
+
def callback_url
|
57
|
+
full_host + script_name + callback_path
|
58
|
+
end
|
59
|
+
|
53
60
|
# These are called after authentication has succeeded. If
|
54
61
|
# possible, you should try to set the UID without making
|
55
62
|
# additional calls (if the user id is returned with the token
|
@@ -51,6 +51,21 @@ describe OmniAuth::Strategies::Nationbuilder, :type => :strategy do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
+
describe 'callback_url' do
|
55
|
+
let(:nation_slug) { 'nationofkinggeorge' }
|
56
|
+
|
57
|
+
before do
|
58
|
+
allow(subject).to receive(:request) { double('Rack::Test::Request', {:params => {'nation_slug' => nation_slug }, :query_string => 'nation_slug=' + nation_slug, :env => { }}) }
|
59
|
+
|
60
|
+
allow(subject).to receive(:full_host) { 'example.org' }
|
61
|
+
allow(subject).to receive(:script_name) { '' }
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should not include query string" do
|
65
|
+
expect(subject.callback_url).to eq('example.org/auth/nationbuilder/callback')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
54
69
|
### NOTE ###
|
55
70
|
# This section involves heavy stubbing of Omniauth and OAuth methods to verify
|
56
71
|
# a small amount of code.
|