Sha256: 567174edbf35917942b44c9e04ef22d355dd66564d91b72a2b4fabb582958574

Contents?: true

Size: 891 Bytes

Versions: 4

Compression:

Stored size: 891 Bytes

Contents

module ExvoAuth::PathHelpers
  def self.included(base)
    if base.respond_to?(:helper_method)
      base.helper_method :interactive_sign_in_path, :non_interactive_sign_in_path, 
        :auth_sign_out_url, :auth_sign_in_url, :auth_sign_up_url
    end
  end
  
  def interactive_sign_in_path(params = {})
    path_with_query("/auth/interactive", params)
  end

  def non_interactive_sign_in_path(params = {})
    path_with_query("/auth/non_interactive", params)
  end
  
  # Redirect users after logout there
  def auth_sign_out_url
    ExvoAuth::Config.host + "/users/sign_out"
  end

  def auth_sign_in_url
    ExvoAuth::Config.host + "/users/sign_in"
  end

  def auth_sign_up_url
    ExvoAuth::Config.host + "/users/sign_up"
  end
  
  private
  
  def path_with_query(path, params = {})
    query = Rack::Utils.build_query(params)
    query.empty? ? path : "#{path}?#{query}"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
exvo-auth-0.2.1 lib/exvo_auth/path_helpers.rb
exvo-auth-0.2.0 lib/exvo_auth/path_helpers.rb
exvo-auth-0.1.7 lib/exvo_auth/path_helpers.rb
exvo-auth-0.1.6 lib/exvo_auth/path_helpers.rb