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
- #auth_method ⇒ Object
- #current_path(redirect_url: nil) ⇒ Object
- #handler_name ⇒ Object
-
#initialize(code, handler_name, data) ⇒ AuthorizationStatus
constructor
A new instance of AuthorizationStatus.
- #ok? ⇒ Boolean
- #pending? ⇒ Boolean
Constructor Details
#initialize(code, handler_name, data) ⇒ AuthorizationStatus
Returns a new instance of AuthorizationStatus.
102 103 104 105 106 |
# File 'app/services/decidim/action_authorizer.rb', line 102 def initialize(code, handler_name, data) @code = code.to_sym @handler_name = handler_name @data = data.symbolize_keys end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
100 101 102 |
# File 'app/services/decidim/action_authorizer.rb', line 100 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
100 101 102 |
# File 'app/services/decidim/action_authorizer.rb', line 100 def data @data end |
Instance Method Details
#auth_method ⇒ Object
108 109 110 111 112 |
# File 'app/services/decidim/action_authorizer.rb', line 108 def auth_method return unless @handler_name @auth_method ||= Verifications::Adapter.from_element(@handler_name) end |
#current_path(redirect_url: nil) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'app/services/decidim/action_authorizer.rb', line 114 def current_path(redirect_url: nil) return unless auth_method if pending? auth_method.(redirect_url: redirect_url) else auth_method.root_path(redirect_url: redirect_url) end end |
#handler_name ⇒ Object
124 125 126 127 128 |
# File 'app/services/decidim/action_authorizer.rb', line 124 def handler_name return unless auth_method auth_method.key end |
#ok? ⇒ Boolean
130 131 132 |
# File 'app/services/decidim/action_authorizer.rb', line 130 def ok? @code == :ok end |
#pending? ⇒ Boolean
134 135 136 |
# File 'app/services/decidim/action_authorizer.rb', line 134 def pending? @code == :pending end |