Class: SignIn::RedirectUrlGenerator
- Inherits:
-
Object
- Object
- SignIn::RedirectUrlGenerator
- Defined in:
- app/services/sign_in/redirect_url_generator.rb
Instance Attribute Summary collapse
-
#params_hash ⇒ Object
readonly
Returns the value of attribute params_hash.
-
#redirect_uri ⇒ Object
readonly
Returns the value of attribute redirect_uri.
-
#terms_code ⇒ Object
readonly
Returns the value of attribute terms_code.
-
#terms_redirect_uri ⇒ Object
readonly
Returns the value of attribute terms_redirect_uri.
Instance Method Summary collapse
- #full_redirect_uri ⇒ Object private
-
#initialize(redirect_uri:, terms_redirect_uri: nil, terms_code: nil, params_hash: {}) ⇒ RedirectUrlGenerator
constructor
A new instance of RedirectUrlGenerator.
- #original_redirect_uri_with_params ⇒ Object private
- #perform ⇒ Object
- #renderer ⇒ Object private
- #terms_of_use_params ⇒ Object private
- #terms_of_use_redirect_url ⇒ Object private
Constructor Details
#initialize(redirect_uri:, terms_redirect_uri: nil, terms_code: nil, params_hash: {}) ⇒ RedirectUrlGenerator
Returns a new instance of RedirectUrlGenerator.
7 8 9 10 11 12 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 7 def initialize(redirect_uri:, terms_redirect_uri: nil, terms_code: nil, params_hash: {}) @redirect_uri = redirect_uri @terms_redirect_uri = terms_redirect_uri @terms_code = terms_code @params_hash = params_hash end |
Instance Attribute Details
#params_hash ⇒ Object (readonly)
Returns the value of attribute params_hash.
5 6 7 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 5 def params_hash @params_hash end |
#redirect_uri ⇒ Object (readonly)
Returns the value of attribute redirect_uri.
5 6 7 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 5 def redirect_uri @redirect_uri end |
#terms_code ⇒ Object (readonly)
Returns the value of attribute terms_code.
5 6 7 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 5 def terms_code @terms_code end |
#terms_redirect_uri ⇒ Object (readonly)
Returns the value of attribute terms_redirect_uri.
5 6 7 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 5 def terms_redirect_uri @terms_redirect_uri end |
Instance Method Details
#full_redirect_uri ⇒ Object (private)
22 23 24 25 26 27 28 29 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 22 def full_redirect_uri if terms_code Rails.logger.info('Redirecting to /terms-of-use', type: :sis) return terms_of_use_redirect_url end original_redirect_uri_with_params end |
#original_redirect_uri_with_params ⇒ Object (private)
31 32 33 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 31 def original_redirect_uri_with_params "#{redirect_uri}?#{params_hash.to_query}" end |
#perform ⇒ Object
14 15 16 17 18 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 14 def perform renderer.render(template: 'oauth_get_form', locals: { url: full_redirect_uri }, format: :html) end |
#renderer ⇒ Object (private)
35 36 37 38 39 40 41 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 35 def renderer @renderer ||= begin renderer = ActionController::Base.renderer renderer.controller.prepend_view_path(Rails.root.join('lib', 'sign_in', 'templates')) renderer end end |
#terms_of_use_params ⇒ Object (private)
47 48 49 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 47 def terms_of_use_params { redirect_url: original_redirect_uri_with_params, terms_code: } end |
#terms_of_use_redirect_url ⇒ Object (private)
43 44 45 |
# File 'app/services/sign_in/redirect_url_generator.rb', line 43 def terms_of_use_redirect_url "#{terms_redirect_uri}?#{terms_of_use_params.to_query}" end |