class OmniAuth::Strategies::Nationbuilder
Public Instance Methods
callback_phase()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/nationbuilder.rb, line 49 def callback_phase options.client_options[:slug] = session.delete("omniauth.nationbuilder.slug") super end
callback_url()
click to toggle source
Nationbuilder
fails with an invalid callback if the query string is passed along
# File lib/omniauth/strategies/nationbuilder.rb, line 56 def callback_url full_host + script_name + callback_path end
client()
click to toggle source
Configure site before super initialises the OAuth2 Client
Calls superclass method
# File lib/omniauth/strategies/nationbuilder.rb, line 24 def client options.client_options[:site] = 'https://' + options.client_options[:slug] + '.nationbuilder.com' log :debug, "Nation to authorise " + deep_symbolize(options.client_options).inspect super end
get_slug()
click to toggle source
Build a form to get the nations slug if one has not been supplied
# File lib/omniauth/strategies/nationbuilder.rb, line 15 def get_slug f = OmniAuth::Form.new(:title => 'NationBuilder Authentication') f.label_field("Your Nation's Slug", options.slug_param) f.input_field('url', options.slug_param) f.button "Connect to your Nation" f.to_response end
request_phase()
click to toggle source
Override the normal OAuth request_phase
to get a slug from the user if one hasn’t been supplied, and insert the slug into the site url
Calls superclass method
# File lib/omniauth/strategies/nationbuilder.rb, line 39 def request_phase if slug # Store slug on the session session["omniauth.nationbuilder.slug"] = options.client_options[:slug] = slug super else get_slug end end
slug()
click to toggle source
Returns the slug, nil if one has not been specified anywhere
# File lib/omniauth/strategies/nationbuilder.rb, line 31 def slug s = options.nation_slug || request.params[options.slug_param.to_s] s = nil if s == '' s end