Class: Devise::Api::Responses::ErrorResponse
- Inherits:
-
Object
- Object
- Devise::Api::Responses::ErrorResponse
- Defined in:
- lib/devise/api/responses/error_response.rb
Constant Summary collapse
- ERROR_TYPES =
%i[ invalid_token expired_token expired_refresh_token revoked_token refresh_token_disabled sign_up_disabled invalid_refresh_token invalid_email invalid_resource_owner resource_owner_create_error devise_api_token_create_error devise_api_token_revoke_error invalid_authentication ].freeze
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(request, error:, record: nil, resource_class: nil) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #status ⇒ Object
Constructor Details
#initialize(request, error:, record: nil, resource_class: nil) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
33 34 35 36 37 38 |
# File 'lib/devise/api/responses/error_response.rb', line 33 def initialize(request, error:, record: nil, resource_class: nil) @request = request @error = error @record = record @resource_class = resource_class end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/devise/api/responses/error_response.rb', line 7 def error @error end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'lib/devise/api/responses/error_response.rb', line 7 def record @record end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'lib/devise/api/responses/error_response.rb', line 7 def request @request end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
7 8 9 |
# File 'lib/devise/api/responses/error_response.rb', line 7 def resource_class @resource_class end |
Instance Method Details
#body ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/devise/api/responses/error_response.rb', line 40 def body { error: error, error_description: error_description, lockable: devise_lockable_info, confirmable: devise_confirmable_info }.compact end |
#status ⇒ Object
49 50 51 52 53 54 |
# File 'lib/devise/api/responses/error_response.rb', line 49 def status return :unauthorized if return :bad_request if bad_request_status? :unprocessable_entity end |