Sha256: 0c2682f2dcc4267a03c9a4df400e8d4f981ec4d9fb137700eec8e96144380fb9

Contents?: true

Size: 690 Bytes

Versions: 2

Compression:

Stored size: 690 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_root_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
  
  private
  
  def path_with_query(path, params = {})
    query = Rack::Utils.build_query(params)
    query.empty? ? path : "#{path}?#{query}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exvo-auth-0.1.3 lib/exvo_auth/path_helpers.rb
exvo-auth-0.1.2 lib/exvo_auth/path_helpers.rb