Class: Decidim::ActionAuthorizer::AuthorizationStatus
- Inherits:
-
Object
- Object
- Decidim::ActionAuthorizer::AuthorizationStatus
- Defined in:
- app/services/decidim/action_authorizer.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #current_path(redirect_url: nil) ⇒ Object
- #handler_name ⇒ Object
-
#initialize(code, authorization_handler, data) ⇒ AuthorizationStatus
constructor
A new instance of AuthorizationStatus.
- #ok? ⇒ Boolean
- #pending? ⇒ Boolean
Constructor Details
#initialize(code, authorization_handler, data) ⇒ AuthorizationStatus
Returns a new instance of AuthorizationStatus.
73 74 75 76 77 |
# File 'app/services/decidim/action_authorizer.rb', line 73 def initialize(code, , data) @code = code.to_sym @authorization_handler = @data = data.symbolize_keys end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
71 72 73 |
# File 'app/services/decidim/action_authorizer.rb', line 71 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
71 72 73 |
# File 'app/services/decidim/action_authorizer.rb', line 71 def data @data end |
Instance Method Details
#current_path(redirect_url: nil) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'app/services/decidim/action_authorizer.rb', line 79 def current_path(redirect_url: nil) return unless @authorization_handler if pending? @authorization_handler.(redirect_url: redirect_url) else @authorization_handler.root_path(redirect_url: redirect_url) end end |
#handler_name ⇒ Object
89 90 91 92 93 |
# File 'app/services/decidim/action_authorizer.rb', line 89 def handler_name return unless @authorization_handler @authorization_handler.key end |
#ok? ⇒ Boolean
95 96 97 |
# File 'app/services/decidim/action_authorizer.rb', line 95 def ok? @code == :ok end |
#pending? ⇒ Boolean
99 100 101 |
# File 'app/services/decidim/action_authorizer.rb', line 99 def pending? @code == :pending end |