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: a09359c904523452ba46358cf476a4e0c39e28fd
4
- data.tar.gz: 60aef520596990d65851598a7991203fe0028bb1
3
+ metadata.gz: 3511d0f723c8d735738fd825950919e2c3ed5a37
4
+ data.tar.gz: a687e3220fa77d8c262b472e47cade12165f3c95
5
5
  SHA512:
6
- metadata.gz: 2bc8b79a24ba40dc23920418521826c1041ae036783a0e6231bf7273ee59a89b4bc460a1f607b59bd2c2d2ad35cb31d1340519eaac64cc06b191f6090af40327
7
- data.tar.gz: 79b3b3de168b33ead7c6a5fdb543b2e90b2fb0ab3985c49b2a70e0dca71f405084b9fa0250aa671643ff6b5a89416b3abfb165d0feb6ee4167ecf8167c773442
6
+ metadata.gz: 7399246d8e87ff587c50ef362556070a6cf332a5acd3fff699de4afe4021fca1ed0bccc91ef44736dedaa042ed697cf07c20dae53b89bfcc77ff68418abc9c49
7
+ data.tar.gz: 7a1baaf5f4960a2d133c614a1f04eefb60b1b3cea69d861450af0f544f20ea6b36b2cc68461bb10b9b6b35d5581ae65f36dc922d6217892740f32a0b9e386318
data/README.md CHANGED
@@ -1,9 +1,13 @@
1
+ [![Gem Version](https://badge.fury.io/rb/omniauth-nationbuilder.svg)](https://badge.fury.io/rb/omniauth-nationbuilder)
1
2
  [![Build Status](https://travis-ci.org/chrisjensen/omniauth-nationbuilder.svg?branch=master)](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:
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Nationbuilder
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -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
- super
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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-nationbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Jensen